Пример #1
0
        public MainWindow()
        {
            CultureInfo culture = CultureInfo.CreateSpecificCulture("en");

            CultureInfo.DefaultThreadCurrentCulture   = culture;
            CultureInfo.DefaultThreadCurrentUICulture = culture;
            InitializeComponent();
            if (!Directory.Exists(Utility.GetApplicationFolder()))
            {
                Directory.CreateDirectory(Utility.GetApplicationFolder());
            }
            saveScriptTo.Text = Utility.GetDefaultScriptSaveLoc();
            RestoreSettings();
            Task.Run(() => UpdateChecker.CheckForNewVersion(true));
        }
Пример #2
0
 private async void checkForUpdates_button_Click(object sender, RoutedEventArgs e)
 {
     await UpdateChecker.CheckForNewVersion(false, true);
 }
 public async Task CheckAndDownloadNewVersion(bool displayDialogue) {
     UpdateChecker updater = new UpdateChecker();
     VersionInfo info;
     info = await updater.CheckForNewVersion();
     if (info.isNew) {
         // Create update information to display.
         string updateResult = "Version " + info.version + " was found!\n\n";
         updateResult += info.updateInfo;
         GUIConfirm confirm = new GUIConfirm();
         confirm.infoLabel.Text = GlobalVariables.PROGRAM_TITLE + " Updater";
         confirm.textBox.Text = updateResult;
         confirm.infoLabel2.Text = "Do you wish to update?";
         confirm.ShowDialog(this);
         if (confirm.confirmed)
             await updater.DownloadFile(true);
     } else {
         if (displayDialogue)
             MessageBox.Show("The latest version is installed.");
     }
 }