Example #1
0
        static async Task WorkWithAttachmentAsync(LargeBadgeView lbv, Random rnd)
        {
            Tuple <WebkitBrowserWindow, ImageWindow, ReaderWindow2> result =
                await lbv.BotLaunchRandomAttachmentAsync(rnd);

            WebkitBrowserWindow browserWindow = result.Item1;

            if (browserWindow != null)
            {
                await Utils.DelayAsync(500);

                browserWindow.Deinit();
                return;
            }

            ImageWindow imgWindow = result.Item2;

            if (imgWindow != null)
            {
                await Utils.DelayAsync(300);

                ExplanationModeMediator.Inst.LasersEnabled = true;

                await imgWindow.BotManipulationsAsync();

                await Utils.DelayAsync(400);

                ExplanationModeMediator.Inst.LasersEnabled = false;
                await Utils.DelayAsync(1000);

                imgWindow.Deinit();
                return;
            }

            ReaderWindow2 pdf = result.Item3;

            if (pdf != null)
            {
                await Utils.DelayAsync(1000);

                await pdf.BotScrollAsync(rnd);

                await Utils.DelayAsync(600);

                await pdf.BotLaserActivityAsync();

                await Utils.DelayAsync(400);

                pdf.Deinit();
                return;
            }
        }
Example #2
0
        /// <summary>
        /// Raised when this control btnPlay is clicked
        /// </summary>
        protected virtual void OnSelectedEvent(YouTubeResultEventArgs e)
        {
            if (SelectedEvent != null)
            {
                //Invokes the delegates.
                SelectedEvent(this, e);
            }

            //wnd = new VideoWindow();
            //wnd.viewer.ClosedEvent += OnBrowserClosed;
            //wnd.viewer.Video = e.Info;
            //wnd.ShowDialog();

            RaiseEvent(new RoutedEventArgs(SourceUC.SourceViewEvent));

            var attachment = DataContext as Attachment;
            var browser    = WebkitBrowserWindow.Instance(e.Info.EmbedUrl,
                                                          attachment != null ? attachment.ArgPoint.Topic.Id : (int?)null);

            browser.Show();
            browser.Activate();
        }