Пример #1
0
        /// <summary>
        /// Main window loaded event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void MainWindowLoaded(object sender, RoutedEventArgs e)
        {
            if (sender != null)
                LaunchPipe();

            if (App.StartMinimized)
            {
                Hide();
                WindowState = WindowState.Minimized;
                ShowInTaskbar = false;
                double height = SystemParameters.WorkArea.Height;
                double width = SystemParameters.WorkArea.Width;
                Top = (height - Height) / 2;
                Left = (width - Width) / 2;
            }

            // Create task manager form to get current task localized description
            FormTaskManager taskManager = new FormTaskManager();
            taskManager.btnOK_Click(null, null);

            if (!App.StartMinimized)
                this.WindowState = WindowState.Normal;
        }
Пример #2
0
        /// <summary>
        /// Fires when a new language is selected and applies it
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void Languages_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Languages.SelectedIndex == 0)
            {
                LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("en");
                UpdateUILocalization();
                CfgFile.Set("Lang", "en");
            }
            if (Languages.SelectedIndex == 1)
            {
                LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("de");
                UpdateUILocalization();
                CfgFile.Set("Lang", "de");
            }
            if (Languages.SelectedIndex == 2)
            {
                LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("es");
                UpdateUILocalization();
                CfgFile.Set("Lang", "es");
            }
            if (Languages.SelectedIndex == 3)
            {
                LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("pt");
                UpdateUILocalization();
                CfgFile.Set("Lang", "pt");
            }
            if (Languages.SelectedIndex == 4)
            {
                LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("it");
                UpdateUILocalization();
                CfgFile.Set("Lang", "it");
            }
            if (Languages.SelectedIndex == 5)
            {
                LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("fr");
                UpdateUILocalization();
                CfgFile.Set("Lang", "fr");
            }

            OneClickAppsViewModel oneClickAppsViewModel = (OneClickAppsViewModel)Application.Current.MainWindow.DataContext;
            foreach (OneClickAppViewModel item in oneClickAppsViewModel.OneClickApps)
            {
                Type currentAppInstanceType = item.Instance.GetType();
                if (currentAppInstanceType == typeof(RegistryCleanerApp))
                {
                    item.Title = WPFLocalizeExtensionHelpers.GetUIString("RegistryCleaner");
                    item.Description = WPFLocalizeExtensionHelpers.GetUIString("RegistryCleanerOneClickDesc");
                }
                if (currentAppInstanceType == typeof(TempCleanerApp))
                {
                    item.Title = WPFLocalizeExtensionHelpers.GetUIString("TemporaryFilesCleaner");
                    item.Description = WPFLocalizeExtensionHelpers.GetUIString("TemporaryFilesCleanerDesc");
                }
                if (currentAppInstanceType == typeof(StartupManagerApp))
                {
                    item.Title = WPFLocalizeExtensionHelpers.GetUIString("StartupManager");
                    item.Description = WPFLocalizeExtensionHelpers.GetUIString("StartupManagerOneClickDesc");
                }

                if (item.StatusText.IndexOf("\\") != -1)
                {
                    item.StatusText = item.StatusText;
                }
                else
                {
                    switch (item.StatusTextKey)
                    {
                        case "Recoverable":
                            {
                                item.StatusText = item.StatusText.Split(' ')[0] + " " + WPFLocalizeExtensionHelpers.GetUIString("Recoverable");
                                break;
                            }
                        case "ProblemsFound":
                            {
                                item.StatusText = item.StatusText.Split(' ')[0] + " " + WPFLocalizeExtensionHelpers.GetUIString("ProblemsFound");
                                break;
                            }
                        case "Recovered":
                            {
                                item.StatusText = item.StatusText.Split(' ')[0] + " " + WPFLocalizeExtensionHelpers.GetUIString("Recovered");
                                break;
                            }
                        case "ProblemsFixed":
                            {
                                item.StatusText = item.StatusText.Split(' ')[0] + " " + WPFLocalizeExtensionHelpers.GetUIString("ProblemsFixed");
                                break;
                            }
                        case "Analyzing":
                            {
                                item.StatusText = WPFLocalizeExtensionHelpers.GetUIString("Analyzing");
                                break;
                            }
                        case "NoProblemsFound":
                            {
                                item.StatusText = WPFLocalizeExtensionHelpers.GetUIString("NoProblemsFound");
                                break;
                            }
                        case "IssuesFound":
                            {
                                item.StatusText = WPFLocalizeExtensionHelpers.GetUIString("IssuesFound");
                                break;
                            }
                        case "":
                            {
                                item.StatusText = "";
                                break;
                            }
                        default:
                            {
                                item.StatusText = item.Description;
                                break;
                            }
                    }
                }
            }

            switch (oneClickAppsViewModel.StatusTitleKey)
            {
                case "NowScanning":
                    {
                        oneClickAppsViewModel.StatusTitle = WPFLocalizeExtensionHelpers.GetUIString("NowScanning");
                        break;
                    }
                case "NowFixing":
                    {
                        oneClickAppsViewModel.StatusTitle = WPFLocalizeExtensionHelpers.GetUIString("NowFixing");
                        break;
                    }
                case "ScanComplete":
                    {
                        oneClickAppsViewModel.StatusTitle = WPFLocalizeExtensionHelpers.GetUIString("ScanComplete");
                        break;
                    }
                case "IssuesFound":
                    {
                        oneClickAppsViewModel.StatusTitle = WPFLocalizeExtensionHelpers.GetUIString("IssuesFound");
                        oneClickAppsViewModel.StatusTextKey = "";
                        break;
                    }
                case "RepairComplete":
                    {
                        oneClickAppsViewModel.StatusTitle = WPFLocalizeExtensionHelpers.GetUIString("RepairComplete");
                        break;
                    }
                case "Cancelling":
                    {
                        oneClickAppsViewModel.StatusTitle = WPFLocalizeExtensionHelpers.GetUIString("Cancelling");
                        break;
                    }
                default:
                    {
                        oneClickAppsViewModel.StatusTitle = string.Empty;
                        break;
                    }
            }

            switch (oneClickAppsViewModel.StatusTextKey)
            {
                case "NoProblemsFound":
                    {
                        oneClickAppsViewModel.StatusText = WPFLocalizeExtensionHelpers.GetUIString("NoProblemsFound");
                        break;
                    }
                case "IssuesFound":
                    {
                        oneClickAppsViewModel.StatusText = WPFLocalizeExtensionHelpers.GetUIString("IssuesFound");
                        break;
                    }
                default:
                    {
                        oneClickAppsViewModel.StatusText = "";
                        break;
                    }
            }

            // Create task manager form to get current task localized description
            FormTaskManager taskManager = new FormTaskManager();
            taskManager.btnOK_Click(null, null);
        }