private async void button_Click(object sender, EventArgs e) { if (button.Text == BUTTON_CHECK_FOR_UPDATES) { CheckForUpdates(); } if (button.Text == BUTTON_UPDATE_NOW) { DialogResult result = MessageBox.Show( $"There is an update available. Your current version is {currentVersion}, the latest version is {checkForUpdatesResult.LastVersion}. Would you like to update to the latest version?", "Update Available", MessageBoxButtons.YesNo ); if (result == DialogResult.Yes) { UpdateStarted?.Invoke(this, EventArgs.Empty); label.Text = LABEL_UPDATING; button.Hide(); progressBar.Show(); // Prepare the latest update await updateManager.PrepareUpdateAsync(checkForUpdatesResult.LastVersion, progress); // Launch updater and exit updateManager.LaunchUpdater(checkForUpdatesResult.LastVersion); Application.Exit(); } } }
protected virtual void ProcessUpdate() { SetLastError(string.Empty); UpdateStarted?.Invoke(this, EventArgs.Empty); DirectoryScanStarted?.Invoke(this, EventArgs.Empty); LocalFileMap.Clear(); BuildLocalFileMap(RootDir); DirectoryScanEnded?.Invoke(this, EventArgs.Empty); if (!GetRemoteFileList()) { FailThread(); return; } if (FilesToDownload.Count > 0) { SyncFiles(); } else { FileSyncNotNeeded?.Invoke(this, EventArgs.Empty); } lock (GUILocker) { Worker = null; InProgress = false; } UpdateComplete?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Raised when file is modifiled. /// </summary> private void OnFileChanged() { // notify listeners UpdateStarted?.Invoke(); // load file IDataContainer changed = (IDataContainer)XmlHelper.DeserializeFromFile(_container.FilePath, _container.GetType()); // update properties if (changed != null) { if (CanAddItems) { _container.Merge(changed); } if (CanRemoveItems) { _container.InplaceIntersect(changed); } _container.Refresh(changed); } // notify listeners UpdateFinished?.Invoke(); }
private IEnumerator Download() { UpdateStarted?.Invoke(); var links = new Dictionary <string, string> { { "units", "/api/units" }, { "unit_groups", "/api/unit_groups" }, { "archetypes", "/api/archetypes" }, { "rewards", "/api/rewards" }, { "loot", "/api/loot" }, { "items", "/api/items" }, { "item_sets", "/api/item_sets" }, { "item_types", "/api/item_types" }, { "item_categories", "/api/item_categories" }, { "item_rarities", "/api/item_rarities" }, { "behaviours", "/api/behaviours" }, { "skills", "/api/skills" }, { "skins", "/api/skins" }, { "missiles", "/api/missiles" }, { "effects", "/api/effects" }, { "scenes", "/api/scenes" }, { "scenarios", "/api/scenarios" }, { "properties", "/api/properties" }, { "attributes", "/api/attributes" }, { "environments", "/api/environments" }, { "currencies", "/api/currencies" }, { "ai", "/api/ai" }, { "talents", "/api/talents" }, { "relics", "/api/relics" }, { "talent_categories", "/api/talent_categories" }, { "recipes", "/api/recipes" }, { "validators", "/api/validators" }, { "achievements", "/api/achievements" }, { "backgrounds", "/api/backgrounds" }, { "item_modifiers", "/api/item_modifiers" }, { "skill_categories", "/api/skill_categories" }, { "skill_sets", "/api/skill_sets" }, { "masteries", "/api/masteries" }, { "dialogues", "/api/dialogues" }, { "phrases", "/api/phrases" }, { "food", "/api/food" }, { "i18n", "/api/i18n" }, }; yield return(StartCoroutine(Download(links, "data"))); links = new Dictionary <string, string> { { "ru-RU", "/api/i18n/ru" }, { "en-US", "/api/i18n/en" }, }; yield return(StartCoroutine(Download(links, "i18n"))); UpdateCompleted?.Invoke(); }
private void StartUpdate() { if (_updating) { return; } _updating = true; _currentFileIndex = -1; UpdateStarted?.Invoke(_filesToDownload.Count); ProcessUpdate(); }
public async Task PerformUpdate() { if (CheckForUpdatesResult.CanUpdate) { UpdateStarted?.Invoke(this); // Prepare the latest update await updateManager.PrepareUpdateAsync(CheckForUpdatesResult.LastVersion, Progress); // Launch updater and exit updateManager.LaunchUpdater(CheckForUpdatesResult.LastVersion); infoForm?.Close(); Program.mainForm.FormClosing -= Program.mainForm.MainForm_FormClosing; Utils.SaveURLs(Program.mainForm.Model.Boards, Program.mainForm.Model.Threads); Application.Exit(); } }
private void OnUpdateStarted() { UpdateStarted?.Invoke(this, null); }