Beispiel #1
0
        public MainForm()
        {
            InitializeComponent();

            this.BackColor = Color.White; //Looks better with embedded browser background
            MainWebBrowser.Navigate("landmarkplastic.on.spiceworks.com/portal");
        }
 private void BrowseForwardCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (MainWebBrowser.CanGoForward)
     {
         MainWebBrowser.GoForward();
     }
 }
 private void BrowseHomeCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (ViewModel.IsLoad)
     {
         MainWebBrowser.Navigate(new Uri(ViewModel.HomeAddress));
     }
 }
Beispiel #4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Log.AddLogCallback(WriteLog);

            MainWebBrowser.ObjectForScripting = new StringPipe(SendMessage, ReceiveMessage);

            string basePath = Directory.GetCurrentDirectory();

            const string ModuleFolder = "Modules";
            const string MainModule   = "main.html";

            while (!Directory.Exists(Path.Combine(basePath, ModuleFolder)))
            {
                var parent = Directory.GetParent(basePath);
                if (parent == null)
                {
                    MessageBox.Show(string.Format("Unable to find module root!"));
                    return;
                }
                else
                {
                    basePath = parent.FullName;
                }
            }

            basePath = Path.Combine(basePath, ModuleFolder);
            Log.MessageFormat(Log.Level.Info, "Base path: {0}", basePath);

            MainWebBrowser.Navigate(Path.Combine(basePath, MainModule));
        }
 private void BrowseBackCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (MainWebBrowser.CanGoBack)
     {
         MainWebBrowser.GoBack();
     }
 }
Beispiel #6
0
 /// <summary>
 /// This overrides the windows messaging processing. Be careful with this method,
 /// because this method is responsible for all the windows messages that are coming to the form.
 /// </summary>
 protected override void OnSourceInitialized(EventArgs e)
 {
     base.OnSourceInitialized(e);
     // Handle created.
     //MainWebBrowser.ScrollBarsEnabled = false;
     MainWebBrowser.Navigate(NavigateUrl);
     MainWebBrowser.LoadCompleted += MainWebBrowser_LoadCompleted;
 }
Beispiel #7
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var mainViewModel = ServiceLocator.Current.GetInstance <MainViewModel>();

            mainViewModel.NavigateHelpDocumentWebBrowserCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand <string>(NavigateHelpDocumentWebBrowser);
            mainViewModel.NavigateMainWebBrowserCommand         = new GalaSoft.MvvmLight.CommandWpf.RelayCommand <string>(NavigateMainWebBrowser);
            MainWebBrowser.Navigate("about:blank");
            HelpDocumentWebBrowser.Navigate("about:blank");
        }
Beispiel #8
0
 private void NavigateMainWebBrowser(string source)
 {
     MainWebBrowser.Navigate(source);
 }
 private void GotoPageCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     MainWebBrowser.Navigate(ViewModel.NowAddress);
 }
 private void RefreshCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     MainWebBrowser.Refresh();
 }
Beispiel #11
0
 void Form_HandleCreated(object sender, EventArgs e)
 {
     MainWebBrowser.ScrollBarsEnabled = false;
     MainWebBrowser.Navigate(NavigateUrl);
 }
Beispiel #12
0
 void Form_HandleCreated(object sender, EventArgs e)
 {
     MainWebBrowser.ScrollBarsEnabled = false;
     MainWebBrowser.Navigate(NavigateUrl);
     MainWebBrowser.DocumentCompleted += MainWebBrowser_DocumentCompleted;
 }
 private void GetTextFromModel()
 {
     Dispatcher?.Invoke(new Action(() => MainWebBrowser.NavigateToString(_textModel.Text)));
 }
        public MainWindow()
        {
            InitializeComponent();

#if DEBUG
            IsDebugMode = true;
#endif

            // Self Updater
            SelfUpdater.DeleteOldFiles(); // not really needed since CleanAndLaunch.exe

            SelfUpdater TheSelfUpdater = new SelfUpdater();
            TheSelfUpdater.SetMainWindowRef(this);
            TheSelfUpdater.UpdateLauncher();

            if (SelfUpdater.LaucherRemoteVNumber != SelfUpdater.LaucherLocalVNumber && SelfUpdater.isSelfUpdating)
            {
                Hide();
            }
            else
            {
                // Set the title of the window with the correct launcher version
                if (SelfUpdater.isSelfUpdating)
                {
                    Launcher_Window.Title = "Natural Launcher v " + SelfUpdater.LaucherLocalVNumber;
                }
                else
                {
                    Launcher_Window.Title = "Natural Launcher";
                }

                // CHECK THE HL AND NS INSTALL DIR AND WRITE IT IN THE LAUNCHER XML
                Launcher.CheckInstallDirectory();

                // set the experimental label
                if (Launcher.isExperimental)
                {
                    Experimental_label.Visibility = Visibility.Visible;
                }
                else
                {
                    Experimental_label.Visibility = Visibility.Hidden;
                }

                // WE SET DISCORD PRESENCE
                string ApplicationID = "474144509048127503";
                Discordclient = new DiscordRpcClient(ApplicationID);

                Discordclient.Initialize();

                OnlineStatusAtLaunch();

                System.Timers.Timer PresenceTimer = new System.Timers.Timer();
                PresenceTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
                PresenceTimer.Enabled  = true;
                PresenceTimer.Interval = 5000;

                // *** Get the main index.html if connected *** \\
                if (Util.CheckForInternetConnection(Launcher.MainPageURL.AbsoluteUri)) //if we are connected
                {
                    Launcher.RefreshInternetPageAsync("Main");                         // we refresh the page
                    MainWebBrowser.Source = Launcher.MainPageURL;                      // and display it from source
                }
                else // if not simply show the saved file
                {
                    MainWebBrowser.Navigate(LocalIndexURL.AbsolutePath);
                }

                // CHECK APP.VERSION NUMBER
                Check_Version();

                if (versionNumber != remoteVersionNumber && versionNumber != "0.0.0.0")
                {
                    MessageBoxResult AlertBox = System.Windows.MessageBox.Show("Update Needed !", "Update", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    StartButton.Content = "Please Update";
                    IsVerification      = false;
                }
                if (versionNumber == "0.0.0.0")
                {
                    StartButton.Content = "Verify";
                    IsVerification      = false;
                }
                if (versionNumber == remoteVersionNumber && versionNumber != "0.0.0.0")
                {
                    StartButton.Content = "Play"; // TODO The algorithm to verify btween local and remote manifest
                }
            }
        }