private void PopulatePanel(DynamicBannerBrowserEn5View view) { switch (this.ButtonsDetails.Count) { case 2: view.Row1.Height = new GridLength(177, GridUnitType.Auto); view.Row2.Height = new GridLength(177, GridUnitType.Auto); view.Row3.IsEnabled = false; view.Row4.IsEnabled = false; view.Row5.IsEnabled = false; view.Row6.IsEnabled = false; view.Row7.IsEnabled = false; view.Row8.IsEnabled = false; this.LeftImage1 = this.ButtonsDetails[0].InternalEngImg; this.LeftImage2 = this.ButtonsDetails[1].InternalEngImg; break; case 3: 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.IsEnabled = false; view.Row5.IsEnabled = false; view.Row6.IsEnabled = false; view.Row7.IsEnabled = false; view.Row8.IsEnabled = false; this.LeftImage1 = this.ButtonsDetails[0].InternalEngImg; this.LeftImage2 = this.ButtonsDetails[1].InternalEngImg; this.LeftImage3 = this.ButtonsDetails[2].InternalEngImg; 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(177, GridUnitType.Auto); view.Row5.IsEnabled = false; view.Row6.IsEnabled = false; view.Row7.IsEnabled = false; view.Row8.IsEnabled = false; this.LeftImage1 = this.ButtonsDetails[0].InternalEngImg; this.LeftImage2 = this.ButtonsDetails[1].InternalEngImg; this.LeftImage3 = this.ButtonsDetails[2].InternalEngImg; this.LeftImage4 = this.ButtonsDetails[3].InternalEngImg; 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(177, GridUnitType.Auto); view.Row6.IsEnabled = false; view.Row7.IsEnabled = false; view.Row8.IsEnabled = false; this.LeftImage1 = this.ButtonsDetails[0].InternalEngImg; this.LeftImage2 = this.ButtonsDetails[1].InternalEngImg; this.LeftImage3 = this.ButtonsDetails[2].InternalEngImg; this.LeftImage4 = this.ButtonsDetails[3].InternalEngImg; this.LeftImage5 = this.ButtonsDetails[4].InternalEngImg; 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(177, GridUnitType.Auto); view.Row7.IsEnabled = false; view.Row8.IsEnabled = false; this.LeftImage1 = this.ButtonsDetails[0].InternalEngImg; this.LeftImage2 = this.ButtonsDetails[1].InternalEngImg; this.LeftImage3 = this.ButtonsDetails[2].InternalEngImg; this.LeftImage4 = this.ButtonsDetails[3].InternalEngImg; this.LeftImage5 = this.ButtonsDetails[4].InternalEngImg; this.LeftImage6 = this.ButtonsDetails[5].InternalEngImg; break; case 7: 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(177, GridUnitType.Auto); view.Row7.Height = new GridLength(177, GridUnitType.Auto); view.Row8.IsEnabled = false; this.LeftImage1 = this.ButtonsDetails[0].InternalEngImg; this.LeftImage2 = this.ButtonsDetails[1].InternalEngImg; this.LeftImage3 = this.ButtonsDetails[2].InternalEngImg; this.LeftImage4 = this.ButtonsDetails[3].InternalEngImg; this.LeftImage5 = this.ButtonsDetails[4].InternalEngImg; this.LeftImage6 = this.ButtonsDetails[5].InternalEngImg; this.LeftImage7 = this.ButtonsDetails[6].InternalEngImg; break; case 8: 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(177, GridUnitType.Auto); view.Row7.Height = new GridLength(177, GridUnitType.Auto); view.Row8.Height = new GridLength(177, GridUnitType.Auto); this.LeftImage1 = this.ButtonsDetails[0].InternalEngImg; this.LeftImage2 = this.ButtonsDetails[1].InternalEngImg; this.LeftImage3 = this.ButtonsDetails[2].InternalEngImg; this.LeftImage4 = this.ButtonsDetails[3].InternalEngImg; this.LeftImage5 = this.ButtonsDetails[4].InternalEngImg; this.LeftImage6 = this.ButtonsDetails[5].InternalEngImg; this.LeftImage7 = this.ButtonsDetails[6].InternalEngImg; this.LeftImage8 = this.ButtonsDetails[7].InternalEngImg; break; } NotifyOfPropertyChange(() => LeftImage1); NotifyOfPropertyChange(() => LeftImage2); NotifyOfPropertyChange(() => LeftImage3); NotifyOfPropertyChange(() => LeftImage4); NotifyOfPropertyChange(() => LeftImage5); NotifyOfPropertyChange(() => LeftImage6); NotifyOfPropertyChange(() => LeftImage7); NotifyOfPropertyChange(() => LeftImage8); }
protected override void OnViewLoaded(object view) { base.OnViewLoaded(view); currentView = ((DynamicBannerBrowserEn5View)view); _internetAccessBrowser = new ChromiumWebBrowser() { Address = this.bannerLinkEnApi }; _internetAccessBrowser.BrowserSettings = new CefSharp.BrowserSettings() { OffScreenTransparentBackground = false, }; _internetAccessBrowser.Load(this.bannerLinkEnApi); _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(); var boundEnObject = new CustomBoundObject(this.numberOfAvailablePagesToPrint, log, sender, events); _internetAccessBrowser.RegisterJsObject("bound", boundEnObject); _internetAccessBrowser.FrameLoadEnd += boundEnObject.OnFrameLoadEnd; _internetAccessBrowser.MouseDown += _internetAccessBrowser_MouseDown; _internetAccessBrowser.TouchDown += _internetAccessBrowser_TouchDown; _internetAccessBrowser.TouchMove += _internetAccessBrowser_TouchMove; currentView.scroller.PreviewMouseDown += Scroller_PreviewMouseDown; currentView.scroller.PreviewMouseMove += Scroller_PreviewMouseMove; currentView.scroller.PreviewMouseUp += Scroller_PreviewMouseUp; _internetAccessBrowser.PreviewMouseUp += _internetAccessBrowser_PreviewMouseUp; ((DynamicBannerBrowserEn5View)view).DynamicBrowser.Children.Add(_internetAccessBrowser); PopulatePanel(currentView); _internetAccessBrowser.Focus(); this.RemainingTime = "30"; this.TimeElapsed = 30; timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 1, 0); timer.Tick += TimerTick; timer.Start(); startTime = DateTime.Now; UnitStartTime = DateTime.Now; }