当前位置: 首页>>代码示例>>C#>>正文


C# Event.get方法代码示例

本文整理汇总了C#中Event.get方法的典型用法代码示例。如果您正苦于以下问题:C# Event.get方法的具体用法?C# Event.get怎么用?C# Event.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Event的用法示例。


在下文中一共展示了Event.get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnPointerStrokeReceived

        private bool OnPointerStrokeReceived(Event ev)
        {
            if (!(IsStudent && LessonExists && Catalog.CurrentPageName == "QuestionsPage"))
                return true;

            var sharedPointer = ev.get<SharedPointer>();

            Application.Current.Dispatcher.BeginInvoke(
                new Action(
                    () =>
                    {
                        int position;

                        try
                        {
                            position = Data.Instance.Lesson.Exercises.GetPositionOfUID(sharedPointer.Offset);

                            // We select the good slide
                            (QuestionsPage.LessonPage as Exercises).GoingToPage(position);

                            // We tell the PointerManager that we want to show a new stroke
                            PointerManager.Instance.DrawStroke(StrokeConverter.ToWindowsStroke(sharedPointer.Stroke));
                        }
                        catch (Exception)
                        {
                            Console.WriteLine("UID (Exercise Pointer) not found.");
                        }
                    }
                    ),
                DispatcherPriority.Normal
                );

            return true;
        }
开发者ID:aragoubi,项目名称:Nine,代码行数:34,代码来源:YEvents.cs

示例2: OnGraphicalAnswer

        /// <summary>
        ///     Called when graphical answer answer is received
        /// </summary>
        /// <param name="ev">The ev.</param>
        /// <returns></returns>
        private bool OnGraphicalAnswer(Event ev)
        {
            if (!(IsTeacher && LessonExists))
                return true;

            var answer = ev.get<AnswerLayer<BasicLayer>>();

            Application.Current.Dispatcher.BeginInvoke(
                new Action(
                    () =>
                    {
                        try
                        {
                            var exercise = Data.Instance.Lesson.Exercises.GetContentByUID(answer.UID);
                            if (exercise.Accept)
                            {
                                (exercise.Processing as GraphicalProcessing).CollectLayer(answer.Layer);
                                (exercise.AnswerLayer as GraphicalAnswerLayer).NbParticipants++;
                            }
                        }
                        catch (Exception e)
                        {
                            // UID not found
                            Console.WriteLine(e.Message);
                        }
                    }
                    ),
                DispatcherPriority.Normal
                );

            return true;
        }
开发者ID:aragoubi,项目名称:Nine,代码行数:37,代码来源:YEvents.cs

示例3: OnGraphicalReceived

        /// <summary>
        ///     Called when graphical exercise is received on the student
        /// </summary>
        /// <param name="ev">The ev.</param>
        /// <returns></returns>
        private bool OnGraphicalReceived(Event ev)
        {
            if (!(IsStudent && LessonExists))
                return true;

            var exercise = ev.get<SharedGraphicExercise>();

            Application.Current.Dispatcher.BeginInvoke(
                new Action(
                    () =>
                    {
                        try
                        {
                            // If exercise already exists we authorize to be answered again
                            Data.Lesson.Exercises.GetContentByUID(exercise.UID).Answered = false;
                            return;
                        }
                        catch
                        {
                        }

                        exercise.AddIt(Data.Lesson.Exercises);
                        // Last layer of last exercise
                        var exHolder = Data.Lesson.Exercises;
                        var lastContent = exHolder.Contents.Count - 1;

                        (QuestionsPage.LessonPage as Exercises).Questions.Add(
                            new KeyValuePair<int, DescEx>(
                                (QuestionsPage.LessonPage as Exercises).Questions.Count,
                                new DescEx(
                                    exercise.ExerciseName,
                                    (Data.Instance.Lesson.Exercises.Contents[
                                        Data.Instance.Lesson.Exercises.Contents.Count - 1] as ExerciseContent).Kind)));

                        QuestionsPage.LessonPage.ChangeCurrentPage(lastContent);
                        QuestionsPage.LayerStackDC.SetLayers();
                        QuestionsPage.LayerStackDC.CurrentLayerIndex = exHolder.Contents[lastContent].Layers.Count - 1;
                    }
                    ),
                DispatcherPriority.Normal
                );

            return true;
        }
开发者ID:aragoubi,项目名称:Nine,代码行数:49,代码来源:YEvents.cs

示例4: OnAskingSlideIndex

        private bool OnAskingSlideIndex(Event ev)
        {
            if (!(IsTeacher && LessonExists))
                return true;

            var asking = ev.get<AskingSlide>();

            Application.Current.Dispatcher.BeginInvoke(
                new Action(
                    () =>
                    {
                        var list = new List<User>();
                        list.Add(User.getTestUsers().Find(u => u.ID == asking.User + ""));
                        LinkIOImp.Instance.send(
                            "new-page-index",
                            (MainPage.LessonPage.DataContext as Lesson).CurrentPageIndex
                            , list);
                    }
                    ),
                DispatcherPriority.Normal
                );

            return true;
        }
开发者ID:aragoubi,项目名称:Nine,代码行数:24,代码来源:YEvents.cs

示例5: OnQuestionLayerReceived

        private bool OnQuestionLayerReceived(Event ev)
        {
            if (!LessonExists)
                return true;

            var layerReceived = ev.get<SharedExerciseLayer>();

            Application.Current.Dispatcher.BeginInvoke(
                new Action(
                    () =>
                    {
                        layerReceived.AddThem(Data.Instance.Lesson.Exercises);
                        QuestionsPage.LayerStackDC.SetLayers();
                    }
                    ),
                DispatcherPriority.Normal
                );

            return true;
        }
开发者ID:aragoubi,项目名称:Nine,代码行数:20,代码来源:YEvents.cs

示例6: OnFreeNotesLayerReceived

        private bool OnFreeNotesLayerReceived(Event ev)
        {
            var layerReceived = ev.get<SharedParallelLayer>();

            Application.Current.Dispatcher.BeginInvoke(
                new Action(
                    () =>
                    {
                        layerReceived.AddThem(Data.Instance.Lesson.GlobalNotes);
                        FreeNotesPage.LayerStackDC.SetLayers();
                    }
                    ),
                DispatcherPriority.Normal
                );

            return true;
        }
开发者ID:aragoubi,项目名称:Nine,代码行数:17,代码来源:YEvents.cs

示例7: OnSlidePointerStrokeReceived

        private bool OnSlidePointerStrokeReceived(Event ev)
        {
            if (!(IsStudent && LessonExists))
                return true;

            var sharedPointer = ev.get<SharedPointer>();

            Application.Current.Dispatcher.BeginInvoke(
                new Action(
                    () =>
                    {
                        var lesson = (MainPage.LessonPage.DataContext as Lesson);

                        // If we're not sync or on Question mode, we don't care
                        if (!lesson.IsSync.Value || Catalog.CurrentPageName != "MainPage")
                            return;

                        // We redirect to the correct view (beacause, if we are on FreeNotesPage in Sync mode, we want to follow
                        Catalog.NavigateTo("MainPage");

                        // We select the good slide
                        lesson.ChangeCurrentPage(sharedPointer.Offset);

                        // We tell the PointerManager that we want to show a new stroke
                        PointerManager.Instance.DrawStroke(StrokeConverter.ToWindowsStroke(sharedPointer.Stroke));
                    }
                    ),
                DispatcherPriority.Normal
                );

            return true;
        }
开发者ID:aragoubi,项目名称:Nine,代码行数:32,代码来源:YEvents.cs

示例8: OnSlideLayerReceived

        private bool OnSlideLayerReceived(Event ev)
        {
            if (!LessonExists)
                return true;

            var layerReceived = ev.get<SharedParallelLayer>();

            Application.Current.Dispatcher.BeginInvoke(
                new Action(
                    () =>
                    {
                        if (Catalog.CurrentPageName == "FreeNotesPage")
                            Catalog.NavigateTo("MainPage");

                        try
                        {
                            layerReceived.AddThem(Data.Instance.Lesson.Slides);
                            (MainPage.LessonPage.DataContext as Lesson).LayerStack.SetLayers();
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.Message);
                        }
                    }
                    ),
                DispatcherPriority.Normal
                );

            return true;
        }
开发者ID:aragoubi,项目名称:Nine,代码行数:30,代码来源:YEvents.cs

示例9: OnPageIndexReceived

        private bool OnPageIndexReceived(Event ev)
        {
            if (!(IsStudent && LessonExists))
                return true;

            Lesson lesson = null;
            Application.Current.Dispatcher.BeginInvoke(
                new Action(
                    () =>
                    {
                        lesson = (MainPage.LessonPage.DataContext as Lesson);
                        lesson.TeacherPageIndex = (int)ev.get<int>();

                        // If the receiver is ok to switch slide, we update his current page
                        if (lesson.IsSync.HasValue && lesson.IsSync.Value && Catalog.CurrentPageName != "QuestionsPage")
                        {
                            lesson.ChangeCurrentPage(lesson.TeacherPageIndex);
                        }
                    }
                    ),
                DispatcherPriority.Normal
                );

            return true;
        }
开发者ID:aragoubi,项目名称:Nine,代码行数:25,代码来源:YEvents.cs

示例10: OnLessonReceived

        private bool OnLessonReceived(Event ev)
        {
            var lessonReceived = ev.get<SharedLesson>();

            Application.Current.Dispatcher.BeginInvoke(
                new Action(
                    () =>
                    {
                        NM.ShowConfirmDialogReceiveLesson("Réception d'une leçon",
                            "   " + lessonReceived.OwnerName + " vous a envoyé une leçon, voulez-vous l'ouvrir ?",
                            lessonReceived.Name,
                            lessonReceived.PDF
                            );
                    }
                    ),
                DispatcherPriority.Normal
                );

            return true;
        }
开发者ID:aragoubi,项目名称:Nine,代码行数:20,代码来源:YEvents.cs


注:本文中的Event.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。