/// <summary> /// Sets the viewmodel and starts the download of the latest release. /// </summary> /// <param name="appViewModel"></param> public SelfUpdate(OpeningViewModel appViewModel) { viewModel = appViewModel; viewModel.UpdateProgressVisibility = Visibility.Visible; viewModel.UpdateLinkVisibility = Visibility.Hidden; Task.Run(() => downloadLatestRelease()); }
/// <summary> /// Sets the viewmodel and starts the download of the latest release. /// </summary> private SelfUpdate() { viewModel = OpeningViewModel.GetInstance; viewModel.UpdateProgressVisibility = Visibility.Visible; viewModel.UpdateLinkVisibility = Visibility.Hidden; Task.Run(() => downloadLatestRelease()); }
/// <summary> /// Displays the latest status of the plugins on the opening screen (disabled, enabled, version, installed). /// </summary> /// <param name="viewModel">An instance of the <typeparamref>OpeningViewModel</typeparamref> class serving as the DataContext for the application UI.</param> public static void DisplayAddonStatus(OpeningViewModel viewModel) { UserConfig config_obj = getConfigAsYAML(); foreach (AddonInfo addon in viewModel.AddonList) { addon.addon_name = AddonYamlReader.getAddonInInfo(addon.folder_name).addon_name; if (config_obj.installed.ContainsKey(addon.folder_name) && config_obj.version.ContainsKey(addon.folder_name)) { if (addon.folder_name == "arcdps") { addon.addon_name += " (installed)"; } else { addon.addon_name += " (" + config_obj.version[addon.folder_name] + " installed)"; } } if (config_obj.disabled.ContainsKey(addon.folder_name) && config_obj.disabled[addon.folder_name] == true) { addon.addon_name += " (disabled)"; } } }
/// <summary> /// <c>ChangeAddonConfig</c> writes the default add-ons section of the configuration file found at <c>config_file_path</c> using /// values found in <paramref name="viewModel"/>, which can be set by the user. /// </summary> /// <param name="viewModel">An instance of the <typeparamref>OpeningViewModel</typeparamref> class serving as the DataContext for the application UI.</param> public static void ChangeAddonConfig(OpeningViewModel viewModel) { UserConfig config_obj = getConfigAsYAML(); foreach (AddonInfo addon in viewModel.AddonList) { if (addon.IsSelected) { if (config_obj.default_configuration.ContainsKey(addon.folder_name)) { config_obj.default_configuration[addon.folder_name] = true; } else { config_obj.default_configuration.Add(addon.folder_name, true); } } else { if (config_obj.default_configuration.ContainsKey(addon.folder_name)) { config_obj.default_configuration[addon.folder_name] = false; } } } setConfigAsYAML(config_obj); }
/// <summary> /// Enables the currently selected addons. /// <seealso cref="OpeningViewModel.EnableSelected"/> /// </summary> /// <param name="viewModel">The DataContext for the application UI.</param> public static void EnableSelected(OpeningViewModel viewModel) { string enablemsg = "This will enable any of the selected add-ons that are disabled. Do you wish to continue?"; if (MessageBox.Show(enablemsg, "Enable", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes) { foreach (AddonInfo addon in viewModel.AddonList.Where(add => add.IsSelected == true)) { GenericUpdater.enable(addon); } } Configuration.DisplayAddonStatus(viewModel); }
/// <summary> /// Deletes the currently selected addons. /// <seealso cref="OpeningViewModel.DeleteSelected"/> /// </summary> /// <param name="viewModel">The DataContext for the application UI.</param> public static void DeleteSelected(OpeningViewModel viewModel) { string deletemsg = "This will delete any add-ons that are selected and all data associated with them! Are you sure you wish to continue?"; if (MessageBox.Show(deletemsg, "Warning!", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { foreach (AddonInfo addon in viewModel.AddonList.Where(add => add.IsSelected == true)) { GenericUpdater.delete(addon); } } Configuration.DisplayAddonStatus(viewModel); }
/// <summary> /// This constructor initializes various default properties across the class and then /// applies any updated values to them using <c>ApplyDefaultConfig</c>. /// </summary> private OpeningViewModel() { onlyInstance = this; AddonList = ApprovedList.GenerateAddonList(); DescriptionText = "Select an add-on to see more information about it."; DeveloperVisibility = Visibility.Hidden; UpdateLinkVisibility = Visibility.Hidden; UpdateProgressVisibility = Visibility.Hidden; GamePath = Configuration.getConfigAsYAML().game_path; }
/// <summary> /// This constructor deals with creating or expanding the configuration file, setting the DataContext, and checking for application updates. /// </summary> public AddOnSelector() { theViewModel = new OpeningViewModel(); DataContext = theViewModel; Configuration.CheckSelfUpdates(theViewModel); Configuration.DetermineSystemType(); Configuration.DisplayAddonStatus(theViewModel); InitializeComponent(); //update notification if (File.Exists(UpdateNotificationFile)) { Process.Start(releases_url); File.Delete(UpdateNotificationFile); } }
/// <summary> /// Checks if there is a new version of the application available. /// </summary> /// <param name="viewModel">An instance of the <typeparamref>OpeningViewModel</typeparamref> class serving as the DataContext for the application UI.</param> public static void CheckSelfUpdates(OpeningViewModel viewModel) { string thisVersion = getConfigAsYAML().application_version; string latestVersion; dynamic release_info = UpdateHelpers.GitReleaseInfo(applicationRepoUrl); latestVersion = release_info.tag_name; if (latestVersion != thisVersion) { viewModel.UpdateAvailable = latestVersion + " available!"; viewModel.UpdateLinkVisibility = Visibility.Visible; } }
/// <summary> /// This constructor deals with creating or expanding the configuration file, setting the DataContext, and checking for application updates. /// </summary> public OpeningView() { _viewModel = OpeningViewModel.GetInstance; DataContext = _viewModel; _configurationManager = new ConfigurationManager(); _pluginManagement = new PluginManagement(_configurationManager); _pluginManagement.DisplayAddonStatus(); var configuration = new Configuration(_configurationManager, new UpdateHelper(new WebClientWrapper()), new FileSystemManager()); InitializeComponent(); SetUpdateButtonVisibility(configuration); //update notification if (File.Exists(UpdateNotificationFile)) { Process.Start(releases_url); File.Delete(UpdateNotificationFile); } }
/// <summary> /// Self Updater /// </summary> /// <param name="viewModel"></param> public static void UpdateSelf(OpeningViewModel viewModel) { SelfUpdate update = new SelfUpdate(viewModel); }