public async Task ConfirmInstallOrUpdatePlugin() { if (Load.IsInstalling) { return; } await MinerPluginsManager.DownloadAndInstall(Plugin.PluginUUID, Progress); CommonInstallOnPropertyChanged(); }
public async Task InstallOrUpdatePlugin() { if (Load.IsInstalling) { return; } if (Plugin.Installed && !Plugin.HasNewerVersion) { return; } //if (Plugin.HasNewerVersion) return; await MinerPluginsManager.DownloadAndInstall(Plugin.PluginUUID, Progress, CancellationToken.None); CommonInstallOnPropertyChanged(); }
public async Task InstallRemovePlugin() { if (Load.IsInstalling) { return; } if (Plugin.Installed) { MinerPluginsManager.RemovePlugin(Plugin.PluginUUID); } else { await MinerPluginsManager.DownloadAndInstall(Plugin.PluginUUID, Progress); } OnPropertyChanged(nameof(InstallString)); }
private async Task InstallOrUpdateAsync(PluginControlPair pluginInfoControlsPair, string pluginUUID) { var pluginInfoItem = pluginInfoControlsPair.Item; var pluginInfoDetails = pluginInfoControlsPair.Details; // update var cancelInstall = new CancellationTokenSource(); var pluginPackageInfo = MinerPluginsManager.Plugins[pluginUUID]; try { AddActiveTask(pluginUUID); pluginInfoItem.OnButtonCancel = (s, e) => cancelInstall.Cancel(); pluginInfoItem.SwapInstallRemoveButtonWithCancelButton(true); pluginInfoItem.ProgressBarVisible = true; pluginInfoItem.StatusVisible = true; //pluginInfoItem.ButtonUpdateEnabled = false; pluginInfoDetails.OnButtonCancel = (s, e) => cancelInstall.Cancel(); pluginInfoDetails.SwapInstallRemoveButtonWithCancelButton(true); pluginInfoDetails.ProgressBarVisible = true; pluginInfoDetails.StatusVisible = true; pluginInfoItem.StatusText = "Pending Install"; pluginInfoDetails.StatusText = "Pending Install"; var downloadAndInstallUpdate = new Progress <Tuple <ProgressState, int> >(statePerc => { var state = statePerc.Item1; var progress = statePerc.Item2; var statusText = ""; switch (state) { case ProgressState.DownloadingMiner: statusText = $"Downloading Miner: {progress} %"; break; case ProgressState.DownloadingPlugin: statusText = $"Downloading Plugin: {progress} %"; break; case ProgressState.ExtractingMiner: statusText = $"Extracting Miner: {progress} %"; break; case ProgressState.ExtractingPlugin: statusText = $"Extracting Plugin: {progress} %"; break; } // SafeInvoke is not needed inside a Progress //FormHelpers.SafeInvoke(pluginInfoItem, () => { pluginInfoItem.StatusText = statusText; pluginInfoItem.ProgressBarValue = progress; //}); //FormHelpers.SafeInvoke(pluginInfoDetails, () => { pluginInfoDetails.StatusText = statusText; pluginInfoDetails.ProgressBarValue = progress; //}); }); await MinerPluginsManager.DownloadAndInstall(pluginPackageInfo, downloadAndInstallUpdate, cancelInstall.Token); } catch (Exception e) { } finally { pluginInfoItem.ProgressBarVisible = false; pluginInfoDetails.ProgressBarVisible = false; pluginInfoItem.SwapInstallRemoveButtonWithCancelButton(false); pluginInfoDetails.SwapInstallRemoveButtonWithCancelButton(false); setPluginInfoItem(pluginInfoItem, pluginPackageInfo); setPluginInfoDetails(pluginInfoDetails, pluginPackageInfo); RemoveActiveTask(pluginUUID); } }
private async Task InstallOrUpdateAsync(PluginControlPair pluginInfoControlsPair, string pluginUUID) { await MinerPluginsManager.DownloadAndInstall(pluginUUID, pluginInfoControlsPair.Progress); }