private void SaveSettings() { var userInteractedTabs = _hasTabLoadedDict.Where(kvp => kvp.Value); foreach (var userInteractedTab in userInteractedTabs) { switch (userInteractedTab.Key) { case Constants.Explorer: UpdateRegistryFromExplorer(); break; case Constants.System: UpdateRegistryFromSystem(); break; case Constants.Display: UpdateRegistryFromDisplay(); break; case Constants.Places: UpdateRegistryFromPlaces(); break; case Constants.RightClick: UpdateRegistryFromRightClick(); break; case Constants.Features: UpdateRegistryFromFeatures(); break; case Constants.Logon: UpdateRegistryFromLogon(); break; case Constants.Restrictions: UpdateRegistryFromRestrictions(); break; case Constants.Maintenance: UpdateSettingsFromMaintenance(); break; } } InfoBox restartInfoBox = new InfoBox(GetResourceString("RestartBoxText"), GetResourceString("RestartBoxOkBtnTxt"), GetResourceString("RestartBoxCancelTxt"), GetResourceString("RestartBoxHeading"), InfoBox.DialogType.Question); if (restartInfoBox.ShowDialog() == true) { ProcessWrapper.ExecuteProcess("shutdown.exe", "/r"); Environment.Exit(0); } }
private void OnUpdateCheckBackgroundWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { Dictionary<string, object> retDict = e.Result as Dictionary<string, object>; if (retDict == null) return; TweakerUpdate tweakerUpdate = retDict["result"] as TweakerUpdate; if (tweakerUpdate == null) { bool failSilently = (bool) retDict["failSilently"]; if (!failSilently) { _message.Success(GetResourceString("AlrdyLatest")); } return; } Version applicationVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; string msg = GetResourceString("NewVersionAvailable") + " " + tweakerUpdate.Version + " " + GetResourceString("IsAvailableForDw") + " " + "(" + GetResourceString("CurrentVersion") + " " + applicationVersion +")."; InfoBox infoBox = new InfoBox(msg, GetResourceString("Download"), GetResourceString("UpdateAvailable"), InfoBox.DialogType.Information); if (infoBox.ShowDialog() == true) { Process.Start(tweakerUpdate.Url); } }
private void OnLanguageMenuItemClick(object sender, RoutedEventArgs e) { MenuItem languageMenuItem = sender as MenuItem; if (languageMenuItem == null) return; string cultureName = languageMenuItem.Tag.ToString(); if (cultureName == ConfigHandler.ToLanguageString(ConfigHandler.GetCurrentLanguage())) { // Selected language is same as current language, hence do nothing languageMenuItem.IsChecked = true; return; } ConfigHandler.SetCulture(cultureName); string msg = GetResourceString("RestartForLangChange"); InfoBox infoBox = new InfoBox(msg, GetResourceString("CloseNLaunch"), GetResourceString("Success"), InfoBox.DialogType.Information); infoBox.HideCancelButton(); if (infoBox.ShowDialog() == true) { Environment.Exit(0); } }
private void OnShowHelpToConfigAutoplayMouseDown(object sender, MouseButtonEventArgs e) { // Unable to figure out how to put new-lines in XAML, so doing the ugly way String msg; ConfigHandler.Language language = ConfigHandler.GetCurrentLanguage(); switch (language) { case ConfigHandler.Language.German: msg = "Klicken Sie auf den \"Configure Autoplay über die Gruppenrichtlinien -Editor\" klicken." + "\nJetzt, in der linken Seitenleiste navigieren Sie zu:" + "\nBenutzerkonfiguration-> Administrative Vorlagen-> Windows-Komponenten-> Autoplay-Richtlinien." + "\n\nNun überprüfen Sie die verfügbaren Optionen in der rechten Hand." + "\n\nBitte beachten Sie, dass Gruppenrichtlinien nicht in Windows 7 Home Premium / Basic / Starter Edition und " + "Windows Vista Home Basic Edition verfügbar."; break; case ConfigHandler.Language.Russian: msg = "Нажмите на эту кнопку \"Настроить автозапуск через редакторе групповой политики\"." + "\nТеперь, в левой боковой панели перейдите к:" + "\nКонфигурация пользователя-> Административные шаблоны-> Компоненты Windows-> Политика Autoplay." + "\n\nТеперь проверьте опции, доступные в правой части клавиатуры." + "\n\nПожалуйста, обратите внимание, что групповая политика не доступна в Windows 7 Home Premium / Basic /" + " Starter Edition и в Windows Vista Home Basic Edition."; break; default: msg = "Click on this \"Configure Autoplay via Group Policy Editor\" button." + "\nNow, in the left sidebar navigate to:" + "\nUser Configuration->Administrative Templates->Windows Components->Autoplay Policies" + "\n\nNow check out the options available in the right hand area." + "\n\nPlease note that Group Policy is NOT available in Windows 7 Home Premium/Basic/Starter Edition(s) and" + " in Windows Vista Home Basic Edition(s)."; break; } InfoBox infoBox = new InfoBox(msg, GetResourceString("Ok"), GetResourceString("Help"), InfoBox.DialogType.Information); infoBox.HideCancelButton(); infoBox.ShowDialog(); }
private void AddToContextMenu() { if (_windowsOs < WindowsVer.Windows.Vista) return; string shrtCtName = txtShrtCtName.Text.Trim(); if (shrtCtName.Length == 0) { _message.Error(GetResourceString("MissingShortcutName")); return; } if (shrtCtName == "cmd") { _message.Error(GetResourceString("CmdNotAvailable")); } string shrtCtPath = txtShrtCtPath.Text.Trim(); if (shrtCtPath.Length == 0) { _message.Error(GetResourceString("ValidFilePath")); return; } bool result = RightClickAddDeleteTask.Add(shrtCtName, shrtCtPath); if (!result) { string msg = GetResourceString("UnableToIndentify") + " \"" + shrtCtPath + "\"" + " " + GetResourceString("AsValidFilePath") + "." + Environment.NewLine + " " + GetResourceString("ProceedAndCreateShortcut") + Environment.NewLine + " " + GetResourceString("AddedToPath"); InfoBox infoBox = new InfoBox(msg, GetResourceString("CreateAnyways"), GetResourceString("WarningMsgTitle"), InfoBox.DialogType.Warning); if (infoBox.ShowDialog() == true) { RightClickAddDeleteTask.AddToRegistry(shrtCtName, shrtCtPath); result = true; } } if (!result) { _message.Error(GetResourceString("ValidFilePath")); } else { _message.Success(GetResourceString("SuccessfullyAdded") + " " + shrtCtName + " " + GetResourceString("ToRightClick")); ClearAddToContextMenuInput(); } }