public static void HandleError(ThemeError e) { if (taskbarHandle != IntPtr.Zero) { TaskbarProgress.SetState(taskbarHandle, TaskbarProgress.TaskbarStates.Error); } if (ThemeManager.downloadMode || ThemeManager.importMode) { MessageDialog.ShowWarning(string.Format(_("Failed to import '{0}' theme:\n{1}"), e.themeId, e.errorMsg), _("Error")); } else { DialogResult result = MessageDialog.ShowQuestion(string.Format(_("Failed to load '{0}' theme:\n{1}\n" + "\nDo you want to disable this theme to prevent the error from happening again?"), e.themeId, e.errorMsg), _("Error"), true); ThemeManager.DisableTheme(e.themeId, result == DialogResult.Yes); } if (taskbarHandle != IntPtr.Zero) { TaskbarProgress.SetState(taskbarHandle, TaskbarProgress.TaskbarStates.Normal); } }
public static void HandleError(ThemeError e) { if (taskbarHandle != IntPtr.Zero) { TaskbarProgress.SetState(taskbarHandle, TaskbarProgress.TaskbarStates.Error); } if (!ThemeManager.importMode) { DialogResult result = MessageBox.Show(string.Format(_("Failed to load '{0}' " + "theme:\n{1}\n\nDo you want to disable this theme to prevent the error from " + "happening again?"), e.themeId, e.errorMsg), _("Error"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning); ThemeManager.DisableTheme(e.themeId, result == DialogResult.Yes); } else { MessageBox.Show(string.Format(_("Failed to import '{0}' theme:\n{1}"), e.themeId, e.errorMsg), _("Error"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (taskbarHandle != IntPtr.Zero) { TaskbarProgress.SetState(taskbarHandle, TaskbarProgress.TaskbarStates.Normal); } }
private static ThemeResult RollbackInstall(ThemeError error) { Task.Run(() => { try { System.Threading.Thread.Sleep(100); // Wait for folder to free up Directory.Delete(Path.Combine("themes", error.themeId), true); } catch { /* Do nothing */ } }); return(new ThemeResult(error)); }
public ThemeResult(ThemeError left) { this.left = left; this.isLeft = true; }