Exemple #1
0
        public void Test03_TranslateRandomKeyTest()
        {
            LoadTranslationsIfNotLoaded();

            //English should have the complete list
            int    total       = Translations.GetLanguageDictionaries(Languages.English).Count;
            Random rand        = new Random();
            int    randomEntry = rand.Next(0, total - 1);

            //get the key based on int index
            string key = Translations.GetLanguageDictionaries(Languages.English).Keys.ElementAt(randomEntry);

            //do it 100 times or so to ensure randomness
            for (int i = 0; i < 99; i++)
            {
                //loop to ensure we get keys and the entry isn't TODO
                while (!ValidEntryExistsInAll(key))
                {
                    randomEntry = rand.Next(0, total - 1);
                    key         = Translations.GetLanguageDictionaries(Languages.English).Keys.ElementAt(randomEntry);
                }

                //make sure the random key returned a valid value
                foreach (Languages lang in Translations.SupportedLanguages)
                {
                    Translations.SetLanguage(lang);
                    string result = Translations.GetTranslatedString(key);
                    Assert.IsFalse(string.IsNullOrWhiteSpace(result));
                }
            }
        }
Exemple #2
0
        private void RelhaxWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 1)
            {
                Logging.Debug("[VersionInfo]: Windows 7 detected, enabling TLS 1.1 and 1.2");
                System.Net.ServicePointManager.SecurityProtocol =
                    SecurityProtocolType.Ssl3 |
                    SecurityProtocolType.Tls |
                    SecurityProtocolType.Tls11 |
                    SecurityProtocolType.Tls12;
            }

            //update the text box with the latest version
            ApplicationUpdateNotes.Text = Translations.GetTranslatedString("loadingApplicationUpdateNotes");
            ViewUpdateNotesOnGoogleTranslate.TheHyperlink.Click += TheHyperlink_Click;
            using (WebClient client = new WebClient())
            {
                Uri temp = new Uri((ModpackSettings.ApplicationDistroVersion == ApplicationVersions.Stable) ?
                                   Settings.ApplicationNotesStableUrl : Settings.ApplicationNotesBetaUrl);
                client.DownloadStringCompleted += (senderr, args) =>
                {
                    if (args.Error != null)
                    {
                        Logging.Exception("Failed to get update notes");
                        Logging.Exception(args.Error.ToString());
                        ApplicationUpdateNotes.Text = Translations.GetTranslatedString("failedToGetUpdateNotes");
                    }
                    else
                    {
                        ApplicationUpdateNotes.Text = args.Result;
                    }
                };
                client.DownloadStringAsync(temp);
            }
        }
Exemple #3
0
        private void ChangeInstall_Click(object sender, RoutedEventArgs e)
        {
            Logging.Info(LogOptions.ClassName, "Selecting WoT install");
            //show a standard WoT selection window from manual find WoT.exe
            OpenFileDialog manualWoTFind = new OpenFileDialog()
            {
                AddExtension    = true,
                CheckFileExists = true,
                CheckPathExists = true,
                Filter          = "WorldOfTanks.exe|WorldOfTanks.exe",
                Title           = Translations.GetTranslatedString("selectWOTExecutable"),
                Multiselect     = false,
                ValidateNames   = true
            };

            if ((bool)manualWoTFind.ShowDialog())
            {
                Settings.WoTDirectory = Path.GetDirectoryName(manualWoTFind.FileName);
                Settings.WoTDirectory = Settings.WoTDirectory.Replace(Settings.WoT32bitFolderWithSlash, string.Empty).Replace(Settings.WoT64bitFolderWithSlash, string.Empty);
                Logging.Info(LogOptions.ClassName, "Selected WoT install -> {0}", Settings.WoTDirectory);
            }
            else
            {
                Logging.Info(LogOptions.ClassName, "User canceled selection");
            }

            //check to make sure a selected tanks installation is selected
            ToggleInstallLocationNeededButtons();
        }
 private void RelhaxWindow_Loaded(object sender, RoutedEventArgs e)
 {
     ScalingConfirmationRevertTime.Text = string.Format(Translations.GetTranslatedString(ScalingConfirmationRevertTime.Name), TimeToRevert);
     Timer.Interval = TimeSpan.FromMilliseconds(1000);
     Timer.Tick    += Timer_Tick;
     Timer.Start();
 }
Exemple #5
0
        private void GcDownloadStep1SelectClientButton_Click(object sender, RoutedEventArgs e)
        {
            //if client selected, get params
            OpenFileDialog manualWoTFind = new OpenFileDialog()
            {
                AddExtension    = true,
                CheckFileExists = true,
                CheckPathExists = true,
                //https://stackoverflow.com/a/2069090/3128017
                //Office Files|*.doc;*.xls;*.ppt
                Filter        = string.Format("WG Client Update Document|{0}", GameInfoXml),
                Multiselect   = false,
                ValidateNames = true,
                Title         = Translations.GetTranslatedString("GcDownloadSelectWgClient")
            };

            if ((bool)manualWoTFind.ShowDialog())
            {
                if ((bool)GcDownloadStep1GameCenterCheckbox.IsChecked)
                {
                    GcDownloadStep1GameCenterCheckbox.Click    -= GcDownloadStep1GameCenterCheckbox_Click;
                    GcDownloadStep1GameCenterCheckbox.IsChecked = false;
                    GcDownloadStep1GameCenterCheckbox.Click    += GcDownloadStep1GameCenterCheckbox_Click;
                }
                GcDownloadStep1ResetParams(true, true);
                SelectedClient = Path.GetDirectoryName(manualWoTFind.FileName);
                //replace the 'win32' or 'win64' directory with nothing (so removing it)
                SelectedClient = SelectedClient.Replace(Settings.WoT32bitFolderWithSlash, string.Empty).Replace(Settings.WoT64bitFolderWithSlash, string.Empty);
                Logging.Info("GameCenterDownloader: Selected install -> {0}", SelectedClient);
                GcDownloadStep1SetupArray();
                GcDownloadStep1GetParams();
            }
        }
Exemple #6
0
 private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     GcDownloadStep4DownloadingSizes.Text = string.Format("{0} {1} {2}", FileUtils.SizeSuffix((ulong)e.BytesReceived, 1, true, false),
                                                          Translations.GetTranslatedString("of"), FileUtils.SizeSuffix((ulong)e.TotalBytesToReceive, 1, true, false));
     GcDownloadStep4SingleFileProgress.Maximum = e.TotalBytesToReceive;
     GcDownloadStep4SingleFileProgress.Value   = e.BytesReceived;
 }
        private void RelhaxWindow_Loaded(object sender, RoutedEventArgs e)
        {
            CommonUtils.CheckAndEnableTLS();

            //update the text box with the latest version
            ApplicationUpdateNotes.Text = Translations.GetTranslatedString("loadingApplicationUpdateNotes");
            ViewUpdateNotesOnGoogleTranslate.TheHyperlink.Click += TheHyperlink_Click;
            using (WebClient client = new WebClient())
            {
                Uri temp = new Uri((ModpackSettings.ApplicationDistroVersion == ApplicationVersions.Stable) ?
                                   ApplicationConstants.ApplicationNotesStableUrl : ApplicationConstants.ApplicationNotesBetaUrl);
                client.DownloadStringCompleted += (senderr, args) =>
                {
                    if (args.Error != null)
                    {
                        Logging.Exception("Failed to get update notes");
                        Logging.Exception(args.Error.ToString());
                        ApplicationUpdateNotes.Text = Translations.GetTranslatedString("failedToLoadUpdateNotes");
                    }
                    else
                    {
                        ApplicationUpdateNotes.Text = args.Result;
                    }
                };
                client.DownloadStringAsync(temp);
            }
        }
Exemple #8
0
 private void BackgroundForm_Load(object sender, EventArgs e)
 {
     //apply translations for menu
     MenuItemAppClose.Text     = Translations.GetTranslatedString(MenuItemAppClose.Name);
     MenuItemRestore.Text      = Translations.GetTranslatedString(MenuItemRestore.Name);
     MenuItemCheckUpdates.Text = Translations.GetTranslatedString(MenuItemCheckUpdates.Name);
 }
Exemple #9
0
        public Library(TakenBookPresenter takenBookPresenter, ILibraryData libraryData, UserPresenter userPresenter,
                       IExceptionLogger exceptionLogger)
        {
            _takenBookPresenter = takenBookPresenter;
            _libraryData        = libraryData;
            _userPresenter      = userPresenter;
            _exceptionLogger    = exceptionLogger;

            InitializeComponent();


            try
            {
                var userTakenBooks = _takenBookPresenter.FindUserTakenBooks();

                foreach (var book in userTakenBooks)
                {
                    bookListBox.Items.Add(book.Author + book.Title + Translations.GetTranslatedString("returnOn") +
                                          book.HasToBeReturned);
                }
            }
            catch (Exception)
            {
                return;
            }
        }
        private void PictureUploadButton_Click(object sender, EventArgs e)
        {
            //var imageLocation = "";
            try
            {
                var dialog = new OpenFileDialog
                {
                    Filter = StaticStrings.PictureFilter
                };

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    var scannerPresenter = new ScannerPresenter();

                    var imageLocation = dialog.FileName;
                    barcodePictureBox.ImageLocation = imageLocation;
                    ScannedBookInfo.Visible         = false;
                    Info.Visible = false;
                    _result      = scannerPresenter.DecodedBarcode(imageLocation);


                    _book = scannerPresenter.ScannedBook(_result.Text);
                    ScannedBookInfo.Text    = _book.Author + " " + _book.Title;
                    ScannedBookInfo.Visible = true;
                    Info.Visible            = true;
                }
            }
            catch (Exception)
            {
                MessageBox.Show(Translations.GetTranslatedString("tryAgain"), Translations.GetTranslatedString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                _result = null;
            }
        }
        private void ClientSelectionsManualFind_Click(object sender, RoutedEventArgs e)
        {
            //show a standard WoT selection window from manual find WoT.exe
            OpenFileDialog manualWoTFind = new OpenFileDialog()
            {
                AddExtension    = true,
                CheckFileExists = true,
                CheckPathExists = true,
                Filter          = "WorldOfTanks.exe|WorldOfTanks.exe",
                Title           = Translations.GetTranslatedString("selectWOTExecutable"),
                Multiselect     = false,
                ValidateNames   = true
            };

            if ((bool)manualWoTFind.ShowDialog())
            {
                SelectedPath = manualWoTFind.FileName;
                SelectedPath = SelectedPath.Replace(ApplicationConstants.WoT32bitFolderWithSlash, string.Empty).Replace(ApplicationConstants.WoT64bitFolderWithSlash, string.Empty);
                Logging.Info(LogOptions.ClassName, "Selected WoT install manually: {0}", SelectedPath);
                DialogResult = true;
                Close();
            }
            else
            {
                Logging.Info(LogOptions.ClassName, "User canceled manual selection");
            }
        }
        private async void RelhaxWindow_Loaded(object sender, RoutedEventArgs e)
        {
            //write that we're currently loading
            string loadingString = Translations.GetTranslatedString("loading");

            DatabaseUpdateText.Text = ApplicationUpdateText.Text = loadingString;
            ViewNewsOnGoogleTranslate.TheHyperlink.Click += TheHyperlink_Click;

            //get the strings
            using (PatientWebClient client = new PatientWebClient())
            {
                try
                {
                    DatabaseUpdateText.Text = await client.DownloadStringTaskAsync(ApplicationConstants.DatabaseNotesUrl);

                    ApplicationUpdateText.Text = await client.DownloadStringTaskAsync(ApplicationConstants.ApplicationNotesBetaUrl);
                }
                catch (Exception ex)
                {
                    Logging.Error("Failed to get news information");
                    Logging.Exception(ex.ToString());

                    if (DatabaseUpdateText.Text.Equals(loadingString))
                    {
                        DatabaseUpdateText.Text = Translations.GetTranslatedString("failedToGetNews");
                    }

                    ApplicationUpdateText.Text = Translations.GetTranslatedString("failedToGetNews");
                }
            }
        }
Exemple #13
0
 private void UseBetaApplication_CheckedChanged(object sender, EventArgs e)
 {
     Settings.BetaApplication = UseBetaApplicationCB.Checked;
     if (Settings.BetaApplication && !WindowLoading)
     {
         MessageBox.Show(Translations.GetTranslatedString("noChangeUntilRestart"));
     }
 }
 private void timer1_Tick(object sender, EventArgs e)
 {
     RevertingTimeoutText.Text = string.Format(Translations.GetTranslatedString(RevertingTimeoutText.Name), scalingTimeout--);
     if (scalingTimeout < 0)
     {
         timer1.Stop();
         DialogResult = DialogResult.No;
     }
 }
 private void InstallationCompleteOpenXVMButton_Click(object sender, RoutedEventArgs e)
 {
     if (!Utils.StartProcess(string.Format("https://www.modxvm.com/{0}/", Translations.GetTranslatedString("xvmUrlLocalisation"))))
     {
         MessageBox.Show(Translations.GetTranslatedString("CouldNotStartProcess"));
     }
     DialogResult = true;
     Close();
 }
 private void Timer_Tick(object sender, EventArgs e)
 {
     ScalingConfirmationRevertTime.Text = string.Format(Translations.GetTranslatedString(ScalingConfirmationRevertTime.Name), --TimeToRevert);
     if (TimeToRevert <= 0)
     {
         Timer.Stop();
         DialogResult = false;
         Close();
     }
 }
Exemple #17
0
 private void RMIcon_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button != MouseButtons.Right)
     {
         return;
     }
     //bring up the right click menu
     MenuItemAppClose.Text     = Translations.GetTranslatedString(MenuItemAppClose.Name);
     MenuItemRestore.Text      = Translations.GetTranslatedString(MenuItemRestore.Name);
     MenuItemCheckUpdates.Text = Translations.GetTranslatedString(MenuItemCheckUpdates.Name);
 }
 private void InstallationCompleteStartWoTButton_Click(object sender, RoutedEventArgs e)
 {
     if (!Utils.StartProcess(new ProcessStartInfo()
     {
         WorkingDirectory = Settings.WoTDirectory,
         FileName = Path.Combine(Settings.WoTDirectory, "WorldOfTanks.exe")
     }))
     {
         MessageBox.Show(Translations.GetTranslatedString("CouldNotStartProcess"));
     }
     DialogResult = true;
     Close();
 }
Exemple #19
0
        /// <summary>
        /// Refresh the window to display new preview elements
        /// </summary>
        public void Refresh(bool init)
        {
            //check that all components have the package parent reference set
            foreach (Media media in Medias)
            {
                bool anyMediaErrors = false;
                if (media.SelectablePackageParent == null)
                {
                    Logging.Error("A media component does not have its SelectablePackageParent set");
                    Logging.Error(media.ToString());
                    anyMediaErrors = true;
                }
                if (anyMediaErrors)
                {
                    MessageBox.Show(Translations.GetTranslatedString("previewEncounteredError"));
                    Close();
                    return;
                }
            }
            CurrentDisplaySP = InvokedPackage;

            if (Medias.Count > 0)
            {
                DisplayMedia(Medias[0], true);
            }
            else
            {
                DisplayMedia(null, true);
            }

            //start the focus timer to bring focus to this window
            if (init && ModpackSettings.ModSelectionView == SelectionView.Legacy)
            {
                OMCViewLegacyFocusTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(10), DispatcherPriority.Normal, Timer_Tick, this.Dispatcher)
                {
                    IsEnabled = true
                };
            }
            else if (OMCViewLegacyFocusTimer == null)
            {
                OMCViewLegacyFocusTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(10), DispatcherPriority.Normal, Timer_Tick, this.Dispatcher)
                {
                    IsEnabled = true
                };
            }
            else
            {
                OMCViewLegacyFocusTimer.Start();
            }
        }
Exemple #20
0
        private async void RelhaxWindow_Loaded(object sender, RoutedEventArgs e)
        {
            //write that we're currently loading
            DatabaseUpdateText.Text = ApplicationUpdateText.Text = Translations.GetTranslatedString("loading");
            ViewNewsOnGoogleTranslate.TheHyperlink.Click += TheHyperlink_Click;

            //get the strings
            using (PatientWebClient client = new PatientWebClient())
            {
                DatabaseUpdateText.Text = await client.DownloadStringTaskAsync(Settings.DatabaseNotesUrl);

                ApplicationUpdateText.Text = await client.DownloadStringTaskAsync(Settings.ApplicationNotesBetaUrl);
            }
        }
Exemple #21
0
 private async void ClearDownloadCacheDatabase_Click(object sender, RoutedEventArgs e)
 {
     Logging.Info(LogOptions.ClassName, "Deleting database cache file");
     DiagnosticsStatusTextBox.Text = Translations.GetTranslatedString("clearingDownloadCacheDatabase");
     try
     {
         await FileUtils.DirectoryDeleteAsync(Settings.RelhaxDownloadsFolderPath, false, false, 3, 100, "*.xml");
     }
     catch (IOException ioex)
     {
         DiagnosticsStatusTextBox.Text = string.Format("{0}{1}{2}", Translations.GetTranslatedString("failedToClearDownloadCacheDatabase"), Environment.NewLine, Settings.RelhaxDownloadsFolderPath);
         Logging.Exception(ioex.ToString());
     }
     DiagnosticsStatusTextBox.Text = Translations.GetTranslatedString("cleaningDownloadCacheDatabaseComplete");
     Logging.Info(LogOptions.ClassName, "Deleted database cache file");
 }
        private void InstallationCompleteStartGameCenterButton_Click(object sender, RoutedEventArgs e)
        {
            string actualLocation = Utils.AutoFindWgcDirectory();

            if (string.IsNullOrEmpty(actualLocation) || !Utils.StartProcess(actualLocation))
            {
                Logging.Error("could not start wgc process using command line '{0}'", actualLocation);
                MessageBox.Show(Translations.GetTranslatedString("CouldNotStartProcess"));
            }
            else
            {
                Logging.Debug("wgc successfully started!");
            }
            DialogResult = true;
            Close();
        }
Exemple #23
0
 private void ToggleInstallLocationNeededButtons()
 {
     if (string.IsNullOrWhiteSpace(Settings.WoTDirectory))
     {
         CollectLogInfoButton.IsEnabled     = false;
         DownloadWGPatchFilesText.IsEnabled = false;
         SelectedInstallation.Text          = string.Format("{0}\n{1}",
                                                            Translations.GetTranslatedString("SelectedInstallation"), Translations.GetTranslatedString("SelectedInstallationNone"));
     }
     else
     {
         CollectLogInfoButton.IsEnabled     = true;
         DownloadWGPatchFilesText.IsEnabled = false;
         SelectedInstallation.Text          = string.Format("{0}\n{1}", Translations.GetTranslatedString("SelectedInstallation"), Settings.WoTDirectory);
     }
 }
Exemple #24
0
        private void RelhaxWindow_Loaded(object sender, RoutedEventArgs e)
        {
            //translate title
            Title = Translations.GetTranslatedString(nameof(Credits));

            StringBuilder creditsBuilder = new StringBuilder();

            //project lead and database managers
            creditsBuilder.AppendFormat("{0}: Willster419{1}{1}", Translations.GetTranslatedString("creditsProjectLeader"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}:{1}", Translations.GetTranslatedString("creditsDatabaseManagers"), Environment.NewLine);
            creditsBuilder.AppendLine(string.Join(", ", new string[] { "elektrosmoker", "Dirty20067", "123GAUSS", "TheIllusion" }));
            creditsBuilder.AppendLine();

            //Translators
            creditsBuilder.AppendFormat("{0}:{1}", Translations.GetTranslatedString("creditsTranslators"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguageEnglish, string.Join(", ", new string[] { "Rkk1945", "Willster419" }), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguageGerman, string.Join(", ", new string[] { "Grumpelumpf", "Dirty20067", "123GAUSS", "elektrosmoker" }), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguageFrench, string.Join(", ", new string[] { "Merkk", "Toshiro" }), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguageSpanish, "LordFelix", Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguagePolish, string.Join(", ", new string[] { "Neoros", "Nullmaruzero" }), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", Translations.LanguageRussian, "DrWeb7_1", Environment.NewLine);
            creditsBuilder.AppendLine();

            //Open source
            creditsBuilder.AppendFormat("{0}:{1}", Translations.GetTranslatedString("creditsusingOpenSourceProjs"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", "Json.NET", "https://www.newtonsoft.com/json", Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", "DotNetZip", "https://github.com/haf/DotNetZip.Semverd", Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", "TeximpNet", "https://bitbucket.org/Starnick/teximpnet", Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", "NAudio", "https://github.com/naudio/NAudio", Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", "WindowsApiCodePack", "https://github.com/contre/Windows-API-Code-Pack-1.1", Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}{2}", "SpriteSheetPacker", "https://github.com/amakaseev/sprite-sheet-packer", Environment.NewLine);
            creditsBuilder.AppendLine();

            //Special thanks
            creditsBuilder.AppendFormat("{0}:{1}", Translations.GetTranslatedString("creditsSpecialThanks"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}.{2}", "Grumpelumpf", Translations.GetTranslatedString("creditsGrumpelumpf"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}.{2}", "Rkk1945", Translations.GetTranslatedString("creditsRkk1945"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}.{2}", "Relic Gaming Community", Translations.GetTranslatedString("creditsRgc"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}.{2}", Translations.GetTranslatedString("creditsBetaTestersName"), Translations.GetTranslatedString("creditsBetaTesters"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}.{2}", "Silvers", Translations.GetTranslatedString("creditsSilvers"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}.{2}", "Xantier", Translations.GetTranslatedString("creditsXantier"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}.{2}", "Javier Arevalo / Markus Ewald", Translations.GetTranslatedString("creditsSpritePacker"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}: {1}.{2}", "Wargaming", Translations.GetTranslatedString("creditsWargaming"), Environment.NewLine);
            creditsBuilder.AppendFormat("{0}!{1}", Translations.GetTranslatedString("creditsUsersLikeU"), Environment.NewLine);

            CreditsTextBox.Text = creditsBuilder.ToString();
        }
        private void StartRecognitionTimer_Tick(object sender, EventArgs e)
        {
            var display         = _capture.QueryFrame().ToImage <Bgr, byte>();
            var currentNickname = _faceRecognition.Recognize(display);

            if (currentNickname != null)
            {
                loginButton.Text          = Translations.GetTranslatedString("logInButton") + currentNickname;
                nameLabel.Text            = currentNickname;
                StaticDataSource.CurrUser = currentNickname;
                cameraBox.Image           = display;
            }
            else
            {
                nameLabel.Text = Translations.GetTranslatedString("unknown");
            }
        }
Exemple #26
0
 private void ExportSelectWoTVersion_Load(object sender, EventArgs e)
 {
     //load translations
     Name = Translations.GetTranslatedString("ExportModeCB");
     ExportWindowDesctiption.Text = Translations.GetTranslatedString(ExportWindowDesctiption.Name);
     CancelButtonn.Text           = Translations.GetTranslatedString("cancel");
     SelectButton.Text            = Translations.GetTranslatedString("select");
     //load panel with stuff
     foreach (ExportModeRadioButton rb in SupportedWoTVersions)
     {
         int newYLocation = WoTVersionsHolder.Controls.Count * (rb.Size.Height);
         rb.Location = new Point(3, newYLocation);
         WoTVersionsHolder.Controls.Add(rb);
     }
     //check the latest version
     SupportedWoTVersions[SupportedWoTVersions.Count - 1].Checked = true;
 }
        private void InstallationCompleteStartWoTButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(WoTDirectory))
            {
                throw new BadMemeException("B r u h");
            }

            if (!CommonUtils.StartProcess(new ProcessStartInfo()
            {
                WorkingDirectory = WoTDirectory,
                FileName = Path.Combine(WoTDirectory, "WorldOfTanks.exe")
            }))
            {
                MessageBox.Show(Translations.GetTranslatedString("CouldNotStartProcess"));
            }
            DialogResult = true;
            Close();
        }
Exemple #28
0
        private async void ClearGameCacheButton_Click(object sender, RoutedEventArgs e)
        {
            Logging.Info(LogOptions.ClassName, "Cleaning AppData cache");
            DiagnosticsStatusTextBox.Text = Translations.GetTranslatedString("cleanGameCacheProgress");

            bool clearCache = await Task.Run(() => CommonUtils.ClearCache());

            if (clearCache)
            {
                Logging.Info(LogOptions.ClassName, "Cleaning AppData cache success");
                DiagnosticsStatusTextBox.Text = Translations.GetTranslatedString("cleanGameCacheSuccess");
            }
            else
            {
                Logging.Info(LogOptions.ClassName, "Cleaning AppData cache fail");
                DiagnosticsStatusTextBox.Text = Translations.GetTranslatedString("cleanGameCacheFail");
            }
        }
 private void ReturnBookButton_Click(object sender, EventArgs e)
 {
     if (_result != null)
     {
         var book = _libraryData.bookRepository.CheckForTakenBook(_result.Text);
         if (book != null)
         {
             _mTakenBookPresenter.RemoveTakenBook(book);
             MessageBox.Show(Translations.GetTranslatedString("returnSucessfully"));
         }
         else
         {
             MessageBox.Show(Translations.GetTranslatedString("cannotReturn"));
         }
     }
     else
     {
         MessageBox.Show(Translations.GetTranslatedString("addPicture"));
     }
 }
 private void RemoveSelectedButton_Click(object sender, RoutedEventArgs e)
 {
     for (int i = 0; i < FilesToAddList.SelectedItems.Count; i++)
     {
         if (FilesToAddalways.Contains(FilesToAddList.SelectedItems[i]))
         {
             string filename = FilesToAddList.SelectedItems[i] as string;
             if (string.IsNullOrEmpty(filename))
             {
                 filename = "null";
             }
             MessageBox.Show(string.Format("{0}: {1}", Translations.GetTranslatedString("cantRemoveDefaultFile"), Path.GetFileName(filename)));
         }
         else
         {
             FilesToAddList.Items.Remove(FilesToAddList.SelectedItems[i]);
             i--;
         }
     }
 }