Exemplo n.º 1
0
        /***************************** Button Controls *****************************/

        private void close_clicked(object sender, RoutedEventArgs e)
        {
            SelfUpdate.startUpdater();

            if ((bool)launchOnClose.IsChecked)
            {
                string exeLocation = Path.Combine(_configurationManager.UserConfig.GamePath, _configurationManager.UserConfig.ExeName);
                try
                {
                    Process.Start(exeLocation, "-autologin");
                }
                catch (System.ComponentModel.Win32Exception)
                {
                    MessageBox.Show($"Unable to launch game as {_configurationManager.UserConfig.ExeName} is missing.",
                                    "Unable to Launch Game",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
            }

            if (_configurationManager.UserConfig.LaunchGame != launchOnClose.IsChecked)
            {
                _configurationManager.UserConfig.LaunchGame = (bool)launchOnClose.IsChecked;
                _configurationManager.SaveConfiguration();
            }

            Application.Current.Shutdown();
        }
        /***************************** Button Controls *****************************/

        private void close_clicked(object sender, RoutedEventArgs e)
        {
            SelfUpdate.startUpdater();

            if ((bool)launchOnClose.IsChecked)
            {
                string exeLocation = Path.Combine(Configuration.getConfigAsYAML().game_path, Configuration.getConfigAsYAML().exe_name);
                try
                {
                    Process.Start(exeLocation, "-autologin");
                }
                catch (System.ComponentModel.Win32Exception)
                {
                    MessageBox.Show($"Unable to launch game as {Configuration.getConfigAsYAML().exe_name} is missing.",
                                    "Unable to Launch Game",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
            }

            UserConfig config = Configuration.getConfigAsYAML();

            if (config.launch_game != (bool)launchOnClose.IsChecked)
            {
                config.launch_game = (bool)launchOnClose.IsChecked;
                Configuration.setConfigAsYAML(config);
            }

            System.Windows.Application.Current.Shutdown();
        }
Exemplo n.º 3
0
 public virtual dynamic GitReleaseInfo(string gitUrl)
 {
     _webClient.Headers.Add("User-Agent", "request");
     try
     {
         var releaseInfoJson = _webClient.DownloadString(gitUrl);
         return(JsonConvert.DeserializeObject(releaseInfoJson));
     }
     catch (WebException)
     {
         //TODO: Add this catch to API calls made at application startup as well
         MessageBox.Show("Github Servers returned an error; please try again in a few minutes.", "Github API Error", MessageBoxButton.OK, MessageBoxImage.Error);
         SelfUpdate.startUpdater();
         Application.Current.Shutdown();
         return(null);
     }
 }
Exemplo n.º 4
0
        //TODO: Add catch if Github API is down/rejects call
        public static dynamic GitReleaseInfo(string gitUrl)
        {
            var client = new WebClient();

            client.Headers.Add("User-Agent", "request");
            try
            {
                string release_info_json = client.DownloadString(gitUrl);
                return(JsonConvert.DeserializeObject(release_info_json));
            }
            catch (WebException)
            {
                MessageBox.Show("Github Servers returned an error; please try again in a few minutes.", "Github API Error", MessageBoxButton.OK, MessageBoxImage.Error);
                SelfUpdate.startUpdater();
                Application.Current.Shutdown();
                return(null);
            }
        }
Exemplo n.º 5
0
 private void xbutton_clicked(object sender, RoutedEventArgs e)
 {
     SelfUpdate.startUpdater();
     System.Windows.Application.Current.Shutdown();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Self Updater
 /// </summary>
 /// <param name="viewModel"></param>
 public static void UpdateSelf(OpeningViewModel viewModel)
 {
     SelfUpdate update = new SelfUpdate(viewModel);
 }