/// <summary> /// Create a new instance of this class /// </summary> /// <param name="updateBranch">The update branch to use</param> /// <param name="parentWindow">The parent window which was calling the factory</param> /// <param name="showIfLocalIsNewer">Show if local version is newer</param> public UpdateClientFactory(UpdateBranchEnum updateBranch, Window parentWindow, bool showIfLocalIsNewer) { ISettingFactory factory = new WpfPropertySettingManagerFactory(); manager = factory.GetSettingsManager(); this.updateBranch = updateBranch; this.parentWindow = parentWindow; this.showIfLocalIsNewer = showIfLocalIsNewer; }
/// <summary> /// This method will check for updates if needed /// </summary> private void CheckForUpdateIfNeeded(Window parentWindow) { if (settingManager?.GetValue <bool>("UpdateOnStartup") == true) { UpdateBranchEnum updateBranch = UpdateBranchEnum.Release; string updateChannel = settingManager.GetValue <string>("UpdateChannel"); if (!Enum.TryParse(updateChannel, out updateBranch)) { return; } ICommand updateApplication = new UpdateApplicationCommand(settingManager, parentWindow); updateApplication.Execute(new UpdateChannelContainer(updateBranch)); } }
/// <summary> /// The update channel container /// </summary> /// <param name="updateBranch">The update branch to use</param> public UpdateChannelContainer(UpdateBranchEnum updateBranch) { UpdateBranch = updateBranch; DisplayName = Properties.Resources.ResourceManager.GetString(updateBranch.ToString()); DisplayName = DisplayName ?? updateBranch.ToString(); }
/// <summary> /// Create a new instance of this class /// </summary> /// <param name="updateBranch">The update branch to use</param> /// <param name="parentWindow">The parent window which was calling the factory</param> public UpdateClientFactory(UpdateBranchEnum updateBranch, Window parentWindow) : this(updateBranch, parentWindow, false) { }