Example #1
0
        private bool OnQuestionPointerStrokeReceived(Event ev)
        {
            if (!(IsStudent && LessonExists))
            {
                return(true);
            }

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

            Application.Current.Dispatcher.Invoke(() =>
            {
                // If we're not sync or on Question mode, we don't care
                if (Catalog.CurrentPageName != "QuestionsPage")
                {
                    return;
                }

                int position;
                try
                {
                    position = Data.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.");
                }
            });

            return(true);
        }
Example #2
0
        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);
        }