public void RevertRemove(AutoStartEntry autoStart) { Task.Run(() => { Logger.Info("Should remove {@autoStart}", autoStart); try { AppStatus.IncrementRunningActionCount(); if (!MessageService.ShowConfirm("Confirm add", $"Are you sure you want to add \"{autoStart.Value}\" as auto start?")) { return; } if (AutoStartService.IsAdminRequiredForChanges(autoStart)) { StartSubProcessAsAdmin(autoStart, RevertRemoveParameterName); autoStart.ConfirmStatus = ConfirmStatus.Reverted; } else { AutoStartService.AddAutoStart(autoStart); } MessageService.ShowSuccess("Auto start added", $"\"{autoStart.Value}\" has been added to auto starts."); } catch (Exception e) { var message = "Failed to revert remove"; var err = new Exception(message, e); Logger.Error(err); MessageService.ShowError(message, e); } finally { AppStatus.DecrementRunningActionCount(); } }); }
public void Disable(AutoStartEntry autoStart) { Task.Run(() => { Logger.Info("Should disable {@autoStart}", autoStart); try { AppStatus.IncrementRunningActionCount(); if (!MessageService.ShowConfirm("Confirm disable", $"Are you sure you want to disable auto start \"{autoStart.Value}\"?")) { return; } if (AutoStartService.IsAdminRequiredForChanges(autoStart)) { StartSubProcessAsAdmin(autoStart, DisableParameterName); autoStart.ConfirmStatus = ConfirmStatus.Disabled; } else { AutoStartService.DisableAutoStart(autoStart); } MessageService.ShowSuccess("Auto start disabled", $"\"{autoStart.Value}\" has been disabled."); } catch (Exception e) { var message = "Failed to disable"; var err = new Exception(message, e); Logger.Error(err); MessageService.ShowError(message, e); } finally { AppStatus.DecrementRunningActionCount(); } }); }
public Task ToggleOwnAutoStart() { return(Task.Run(() => { try { AppStatus.IncrementRunningActionCount(); AutoStartService.ToggleOwnAutoStart(); } catch (Exception e) { var message = "Failed to change own auto start"; var err = new Exception(message, e); Logger.Error(err); MessageService.ShowError(message, e); } finally { AppStatus.DecrementRunningActionCount(); } })); }
public void ConfirmRemove(AutoStartEntry autoStart) { Task.Run(() => { try { AppStatus.IncrementRunningActionCount(); Logger.Trace("ConfirmRemove called"); AutoStartService.ConfirmRemove(autoStart); } catch (Exception e) { var message = $"Failed to confirm remove of {autoStart}"; var err = new Exception(message, e); Logger.Error(err); MessageService.ShowError(message, e); } finally { AppStatus.DecrementRunningActionCount(); } }); }
public void ConfirmAdd(Guid id) { Task.Run(() => { try { AppStatus.IncrementRunningActionCount(); Logger.Trace("ConfirmAdd called"); AutoStartService.ConfirmAdd(id); } catch (Exception e) { var message = $"Failed to confirm add of {id}"; var err = new Exception(message, e); Logger.Error(err); MessageService.ShowError(message, e); } finally { AppStatus.DecrementRunningActionCount(); } }); }