Пример #1
0
        private void PopulatePanel(DynamicBrowserGr6View view)
        {
            switch (this.SelectedPosition)
            {
            case "1":


                view.Row1.Height = new GridLength(293, GridUnitType.Auto);
                view.Row2.Height = new GridLength(177, GridUnitType.Auto);
                view.Row3.Height = new GridLength(177, GridUnitType.Auto);
                view.Row4.Height = new GridLength(177, GridUnitType.Auto);
                view.Row5.Height = new GridLength(177, GridUnitType.Auto);
                view.Row6.Height = new GridLength(177, GridUnitType.Auto);

                this.LeftImage1 = this.ButtonsDetails[0].SelectedGrImg;
                this.LeftImage2 = this.ButtonsDetails[1].InternalGrImg;
                this.LeftImage3 = this.ButtonsDetails[2].InternalGrImg;
                this.LeftImage4 = this.ButtonsDetails[3].InternalGrImg;
                this.LeftImage5 = this.ButtonsDetails[4].InternalGrImg;
                this.LeftImage6 = this.ButtonsDetails[5].InternalGrImg;

                break;

            case "2":

                view.Row1.Height = new GridLength(177, GridUnitType.Auto);
                view.Row2.Height = new GridLength(293, GridUnitType.Auto);
                view.Row3.Height = new GridLength(177, GridUnitType.Auto);
                view.Row4.Height = new GridLength(177, GridUnitType.Auto);
                view.Row5.Height = new GridLength(177, GridUnitType.Auto);
                view.Row6.Height = new GridLength(177, GridUnitType.Auto);

                this.LeftImage1 = this.ButtonsDetails[0].InternalGrImg;
                this.LeftImage2 = this.ButtonsDetails[1].SelectedGrImg;
                this.LeftImage3 = this.ButtonsDetails[2].InternalGrImg;
                this.LeftImage4 = this.ButtonsDetails[3].InternalGrImg;
                this.LeftImage5 = this.ButtonsDetails[4].InternalGrImg;
                this.LeftImage6 = this.ButtonsDetails[5].InternalGrImg;

                break;

            case "3":

                view.Row1.Height = new GridLength(177, GridUnitType.Auto);
                view.Row2.Height = new GridLength(177, GridUnitType.Auto);
                view.Row3.Height = new GridLength(293, GridUnitType.Auto);
                view.Row4.Height = new GridLength(177, GridUnitType.Auto);
                view.Row5.Height = new GridLength(177, GridUnitType.Auto);
                view.Row6.Height = new GridLength(177, GridUnitType.Auto);

                this.LeftImage1 = this.ButtonsDetails[0].InternalGrImg;
                this.LeftImage2 = this.ButtonsDetails[1].InternalGrImg;
                this.LeftImage3 = this.ButtonsDetails[2].SelectedGrImg;
                this.LeftImage4 = this.ButtonsDetails[3].InternalGrImg;
                this.LeftImage5 = this.ButtonsDetails[4].InternalGrImg;
                this.LeftImage6 = this.ButtonsDetails[5].InternalGrImg;

                break;

            case "4":


                view.Row1.Height = new GridLength(177, GridUnitType.Auto);
                view.Row2.Height = new GridLength(177, GridUnitType.Auto);
                view.Row3.Height = new GridLength(177, GridUnitType.Auto);
                view.Row4.Height = new GridLength(293, GridUnitType.Auto);
                view.Row5.Height = new GridLength(177, GridUnitType.Auto);
                view.Row6.Height = new GridLength(177, GridUnitType.Auto);

                this.LeftImage1 = this.ButtonsDetails[0].InternalGrImg;
                this.LeftImage2 = this.ButtonsDetails[1].InternalGrImg;
                this.LeftImage3 = this.ButtonsDetails[2].InternalGrImg;
                this.LeftImage4 = this.ButtonsDetails[3].SelectedGrImg;
                this.LeftImage5 = this.ButtonsDetails[4].InternalGrImg;
                this.LeftImage6 = this.ButtonsDetails[5].InternalGrImg;

                break;

            case "5":

                view.Row1.Height = new GridLength(177, GridUnitType.Auto);
                view.Row2.Height = new GridLength(177, GridUnitType.Auto);
                view.Row3.Height = new GridLength(177, GridUnitType.Auto);
                view.Row4.Height = new GridLength(177, GridUnitType.Auto);
                view.Row5.Height = new GridLength(293, GridUnitType.Auto);
                view.Row6.Height = new GridLength(177, GridUnitType.Auto);

                this.LeftImage1 = this.ButtonsDetails[0].InternalGrImg;
                this.LeftImage2 = this.ButtonsDetails[1].InternalGrImg;
                this.LeftImage3 = this.ButtonsDetails[2].InternalGrImg;
                this.LeftImage4 = this.ButtonsDetails[3].InternalGrImg;
                this.LeftImage5 = this.ButtonsDetails[4].SelectedGrImg;
                this.LeftImage6 = this.ButtonsDetails[5].InternalGrImg;

                break;

            case "6":
                view.Row1.Height = new GridLength(177, GridUnitType.Auto);
                view.Row2.Height = new GridLength(177, GridUnitType.Auto);
                view.Row3.Height = new GridLength(177, GridUnitType.Auto);
                view.Row4.Height = new GridLength(177, GridUnitType.Auto);
                view.Row5.Height = new GridLength(177, GridUnitType.Auto);
                view.Row6.Height = new GridLength(293, GridUnitType.Auto);

                this.LeftImage1 = this.ButtonsDetails[0].InternalGrImg;
                this.LeftImage2 = this.ButtonsDetails[1].InternalGrImg;
                this.LeftImage3 = this.ButtonsDetails[2].InternalGrImg;
                this.LeftImage4 = this.ButtonsDetails[3].InternalGrImg;
                this.LeftImage5 = this.ButtonsDetails[4].InternalGrImg;
                this.LeftImage6 = this.ButtonsDetails[5].SelectedGrImg;

                break;
            }

            NotifyOfPropertyChange(() => LeftImage1);
            NotifyOfPropertyChange(() => LeftImage2);
            NotifyOfPropertyChange(() => LeftImage3);
            NotifyOfPropertyChange(() => LeftImage4);
            NotifyOfPropertyChange(() => LeftImage5);
            NotifyOfPropertyChange(() => LeftImage6);
        }
Пример #2
0
        protected override void OnViewLoaded(object view)
        {
            currentView = ((DynamicBrowserGr6View)view);

            _internetAccessBrowser = new ChromiumWebBrowser()
            {
                Address = this.HomeUrl
            };

            _internetAccessBrowser.BrowserSettings = new CefSharp.BrowserSettings()
            {
                OffScreenTransparentBackground = false,
            };

            _internetAccessBrowser.Load(this.HomeUrl);

            _internetAccessBrowser.BrowserSettings.FileAccessFromFileUrls      = CefState.Enabled;
            _internetAccessBrowser.BrowserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
            _internetAccessBrowser.BrowserSettings.WebSecurity = CefState.Enabled;
            _internetAccessBrowser.BrowserSettings.Javascript  = CefState.Enabled;


            _internetAccessBrowser.RequestContext  = new RequestContext();
            _internetAccessBrowser.LifeSpanHandler = new LifeSpanHandler();

            _internetAccessBrowser.RequestHandler = new CustomRequestHandler("", log, sender, this.numberOfAvailablePagesToPrint, events);
            _internetAccessBrowser.DialogHandler  = new CustomDialogHandler();

            _internetAccessBrowser.MenuHandler = new CustomMenuHandler();

            var boundGrObject = new CustomBoundObjectEl(this.numberOfAvailablePagesToPrint, this.log, sender, events);

            _internetAccessBrowser.RegisterJsObject("bound", boundGrObject);
            _internetAccessBrowser.FrameLoadEnd += boundGrObject.OnFrameLoadEnd;

            PopulatePanel(currentView);

            if (this.SelectedPosition == "8" || this.SelectedPosition == "7" || this.SelectedPosition == "6" || this.SelectedPosition == "5")
            {
                currentView.scroller.ScrollToEnd();
            }

            currentView.scroller.PreviewMouseDown += Scroller_PreviewMouseDown;
            currentView.scroller.PreviewMouseMove += Scroller_PreviewMouseMove;
            currentView.scroller.PreviewMouseUp   += Scroller_PreviewMouseUp;

            ((DynamicBrowserGr6View)view).DynamicBrowser.Children.Add(_internetAccessBrowser);

            _internetAccessBrowser.MouseDown += _internetAccessBrowser_MouseDown;
            _internetAccessBrowser.TouchDown += _internetAccessBrowser_TouchDown;
            _internetAccessBrowser.TouchMove += _internetAccessBrowser_TouchMove;

            _internetAccessBrowser.PreviewMouseUp += _internetAccessBrowser_PreviewMouseUp;

            _internetAccessBrowser.Focus();

            this.RemainingTime = "30";

            // this.OpenKeyboard = true;

            this.TimeElapsed = 30;
            timer            = new DispatcherTimer();
            timer.Interval   = new TimeSpan(0, 1, 0);
            timer.Tick      += TimerTick;
            timer.Start();

            startTime     = DateTime.Now;
            UnitStartTime = DateTime.Now;

            base.OnViewLoaded(view);
        }