Ejemplo n.º 1
0
 public void GoBack() => r_Browser.GoBack();
Ejemplo n.º 2
0
 public void GoBack()
 {
     view.GoBack();
 }
Ejemplo n.º 3
0
        public KanColleBrowser()
        {
            InitializeComponent();
            WebBrowser.Navigated     += (_, __) => ApplyZoomFactor(zoomFactor);
            WebBrowser.LoadCompleted += (_, __) => LockFlash(IsFlashLocked);
            SetSilence(true);
            SetAllowDrop(false);

            btnBack.Click   += (_, __) => WebBrowser.GoBack();
            btnFoward.Click += (_, __) => WebBrowser.GoForward();
            GotoUrlCommand   = new DelegateCommand(() =>
            {
                if (!txtAddress.Text.Contains(":"))
                {
                    txtAddress.Text = "http://" + txtAddress.Text;
                }
                try
                {
                    WebBrowser.Navigate(txtAddress.Text);
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e);
                }
            });
            btnRefresh.Click      += (_, __) => WebBrowser.Navigate(WebBrowser.Source);
            btnBackToGame.Click   += (_, __) => WebBrowser.Navigate(Properties.Settings.Default.GameUrl);
            btnStop.Click         += (_, __) => Stop();
            WebBrowser.Navigating += (_, e) =>
            {
                txtAddress.Text     = e.Uri.AbsoluteUri;
                btnBack.IsEnabled   = WebBrowser.CanGoBack;
                btnFoward.IsEnabled = WebBrowser.CanGoForward;
                styleSheet          = null;
                UpdateSize(false);
            };
            btnScreenShot.Click += (_, __) => TakeScreenShot(Config.Current.GenerateScreenShotFileName());
            btnCleanCache.Click += async(sender, _) =>
            {
                var button = sender as Button;
                button.IsEnabled = false;
                if (MessageBox.Show(StringTable.CleanCache_Alert, "", MessageBoxButton.YesNo, MessageBoxImage.Asterisk) == MessageBoxResult.Yes)
                {
                    if (await WinInetHelper.DeleteInternetCacheAsync())
                    {
                        MessageBox.Show(StringTable.CleanCache_Success);
                    }
                    else
                    {
                        MessageBox.Show(StringTable.CleanCache_Fail);
                    }
                }
                button.IsEnabled = true;
            };

            this.Loaded += (_, __) =>
            {
                if (firstLoad && Officer.Staff.IsStarted)
                {
                    WebBrowser.Navigate(Properties.Settings.Default.GameUrl);
                    firstLoad = false;
                }
            };
        }