// save file to disk private void saveFileDlg_FileOk(object sender, CancelEventArgs e) { if (!Zipper.ByteArrayToFile(saveFileDlg.FileName, this.zippedPackage)) { FormCommonUtils.MyMessageBox(EasyResXResources.SaveFileDlgCaption, EasyResXResources.SaveFileDlgMessage); } }
// executed in main thread private void CheckBeforeStart() { if (this.label1.Text.Length < 2) { throw new Exception(EasyResXResources.LoadProjectExceptionMessage); } FormCommonUtils.SetControlText(string.Empty, textBox1); }
// operation ended private void Form1_OnProcessingEnded(object sender, ProcessingEndedEventArgs e) { FormCommonUtils.ControlEnabled(this, true); toolStripStatusLabel.Text = EasyResXResources.ReadyMessage; if (e.OperationMode == ResXOperationModes.CreatePackage) { OpenSaveDialog(e.SelectedCulture); } }
// Load back for merging private void button5_Click(object sender, EventArgs e) { if (this.OpenMergeDialog()) { string message = EasyResXResources.MergePackageResultFail; if (Zipper.ExtractTranslatedZip(this.openFileDialog1.FileName, this.label1.Text, true)) { message = EasyResXResources.MergePackageResultOk; } FormCommonUtils.AppendToTextBox(message, this.textBox1); } }
// save file dialog setup private void OpenSaveDialog(string selectedCulture) { saveFileDlg.FileName = string.Format(EasyResXResources.PackageFormat, ResXOperator.GetCultureFromCombo(selectedCulture).ToLower()); saveFileDlg.InitialDirectory = Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments); saveFileDlg.DefaultExt = Zipper.ZipDefaultExtension; saveFileDlg.Filter = Zipper.ZipFilter; // throws exception in case of wrong format var dlr = saveFileDlg.ShowDialog(); if (dlr == DialogResult.OK) { FormCommonUtils.AppendToTextBox(EasyResXResources.CreatePackageOk, textBox1); } }
// executed in all threads private void StartProcessing() { CheckBeforeStart(); toolStripStatusLabel.Text = EasyResXResources.ProcessingMessage; FormCommonUtils.ControlEnabled(this, false); }
// print status private void PrintStatus(string text) { FormCommonUtils.AppendToTextBox(text + "\r\n", this.textBox1); }
private void tabPage3_Enter(object sender, EventArgs e) { FormCommonUtils.ClearTextBox(textBox1); }