1 // ================================================================================================
3 // Wikipedia翻訳支援ツール主画面クラスソース</summary>
5 // <copyright file="MainForm.cs" company="honeplusのメモ帳">
6 // Copyright (C) 2012 Honeplus. All rights reserved.</copyright>
9 // ================================================================================================
11 namespace Honememo.Wptscs
14 using System.Collections.Generic;
15 using System.ComponentModel;
18 using System.Threading;
19 using System.Windows.Forms;
20 using Honememo.Utilities;
21 using Honememo.Wptscs.Logics;
22 using Honememo.Wptscs.Models;
23 using Honememo.Wptscs.Properties;
24 using Honememo.Wptscs.Utilities;
25 using Honememo.Wptscs.Websites;
28 /// Wikipedia翻訳支援ツール主画面のクラスです。
30 public partial class MainForm : Form
35 /// 現在読み込んでいるアプリケーションの設定。
37 private Config config;
42 private Translator translator;
47 private int logLength;
54 /// コンストラクタ。初期化メソッド呼び出しのみ。
58 // Windows フォーム デザイナで生成されたコード
59 this.InitializeComponent();
64 #region フォームの各イベントのメソッド
69 /// <param name="sender">イベント発生オブジェクト。</param>
70 /// <param name="e">発生したイベント。</param>
71 private void MainForm_Load(object sender, EventArgs e)
74 Control.CheckForIllegalCrossThreadCalls = false;
76 // 表示言語選択メニュー、設定選択メニューの初期設定
77 this.InitializeDropDownButtonLanguage();
78 this.InitializeDropDownButtonConfig();
80 // 設定ファイルの読み込みと関連項目の初期設定
81 this.InitializeByConfig();
84 this.textBoxSaveDirectory.Text = Settings.Default.SaveDirectory;
88 /// フォームクローズ時の処理。処理状態を保存。
90 /// <param name="sender">イベント発生オブジェクト。</param>
91 /// <param name="e">発生したイベント。</param>
92 private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
94 // 現在の出力先フォルダ、翻訳元/先言語、
95 // また更新されていれば表示言語や設定ファイルの選択を保存
97 Settings.Default.Save();
102 #region 翻訳元/先言語グループのイベントのメソッド
105 /// 翻訳元コンボボックス変更時の処理。
107 /// <param name="sender">イベント発生オブジェクト。</param>
108 /// <param name="e">発生したイベント。</param>
109 private void ComboBoxSource_SelectedIndexChanged(object sender, EventArgs e)
112 Website site = this.config.GetWebsite(this.comboBoxSource.Text);
113 this.SetLanguageNameLabel(this.labelSource, site);
116 this.linkLabelSourceURL.Text = "http://";
119 this.linkLabelSourceURL.Text = site.Location;
124 /// リンクラベルのリンククリック時の処理。
126 /// <param name="sender">イベント発生オブジェクト。</param>
127 /// <param name="e">発生したイベント。</param>
128 private void LinkLabelSourceURL_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
131 System.Diagnostics.Process.Start(((LinkLabel)sender).Text);
135 /// 翻訳先コンボボックス変更時の処理。
137 /// <param name="sender">イベント発生オブジェクト。</param>
138 /// <param name="e">発生したイベント。</param>
139 private void ComboBoxTarget_SelectedIndexChanged(object sender, EventArgs e)
142 this.SetLanguageNameLabel(this.labelTarget, this.config.GetWebsite(this.comboBoxTarget.Text));
148 /// <param name="sender">イベント発生オブジェクト。</param>
149 /// <param name="e">発生したイベント。</param>
150 private void ButtonConfig_Click(object sender, EventArgs e)
156 using (ConfigForm form = new ConfigForm(this.config))
161 // 戻ってきたら設定ファイルを再読み込みして表示を更新
162 // ※ キャンセル時もインスタンスは更新されてしまうので
163 this.InitializeByConfig();
166 #region イベント実装支援用メソッド
169 /// 翻訳元/先言語コンボボックスの初期化処理。
171 private void InitializeComboBox()
174 this.comboBoxSource.Items.Clear();
175 this.comboBoxTarget.Items.Clear();
177 // 設定ファイルに存在する全言語を選択肢として登録する
178 foreach (Website site in this.config.Websites)
180 this.comboBoxSource.Items.Add(site.Language.Code);
181 this.comboBoxTarget.Items.Add(site.Language.Code);
185 this.comboBoxSource.SelectedItem = Settings.Default.LastSelectedSource;
186 this.comboBoxTarget.SelectedItem = Settings.Default.LastSelectedTarget;
189 // ※ 項目が存在する場合は↑で自動的に呼ばれるが、無い場合は呼ばれないため
190 this.ComboBoxSource_SelectedIndexChanged(this.comboBoxSource, new EventArgs());
191 this.ComboBoxTarget_SelectedIndexChanged(this.comboBoxTarget, new EventArgs());
195 /// ウェブサイトの言語の表示名ラベルの表示を設定する。
197 /// <param name="label">言語の表示名用ラベル。</param>
198 /// <param name="site">選択されている言語のウェブサイト。</param>
199 private void SetLanguageNameLabel(Label label, Website site)
202 label.Text = String.Empty;
208 // ウェブサイトが空でない場合、その言語の、ユーザーが使用している言語での表示名を表示
209 // (日本語環境だったら日本語を、英語環境だったら英語を)
210 Language.LanguageName name;
211 if (site.Language.Names.TryGetValue(
212 Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName,
215 label.Text = name.Name;
223 #region フォルダの選択グループのイベントのメソッド
228 /// <param name="sender">イベント発生オブジェクト。</param>
229 /// <param name="e">発生したイベント。</param>
230 private void ButtonSaveDirectory_Click(object sender, EventArgs e)
232 // フォルダ名が入力されている場合、それを初期位置に設定
233 if (!String.IsNullOrEmpty(this.textBoxSaveDirectory.Text))
235 this.folderBrowserDialogSaveDirectory.SelectedPath = this.textBoxSaveDirectory.Text;
239 if (this.folderBrowserDialogSaveDirectory.ShowDialog() == System.Windows.Forms.DialogResult.OK)
241 // フォルダが選択された場合、フォルダ名に選択されたフォルダを設定
242 this.textBoxSaveDirectory.Text = this.folderBrowserDialogSaveDirectory.SelectedPath;
247 /// 出力先テキストボックスフォーカス喪失時の処理。
249 /// <param name="sender">イベント発生オブジェクト。</param>
250 /// <param name="e">発生したイベント。</param>
251 private void TextBoxSaveDirectory_Leave(object sender, EventArgs e)
254 this.textBoxSaveDirectory.Text = this.textBoxSaveDirectory.Text.Trim();
259 #region 記事を指定して実行グループのイベントのメソッド
264 /// <param name="sender">イベント発生オブジェクト。</param>
265 /// <param name="e">発生したイベント。</param>
266 private void ButtonRun_Click(object sender, EventArgs e)
269 if (String.IsNullOrWhiteSpace(this.comboBoxSource.Text))
271 FormUtils.WarningDialog(Resources.WarningMessageNotSelectedSource);
272 this.comboBoxSource.Focus();
275 else if (String.IsNullOrWhiteSpace(this.comboBoxTarget.Text))
277 FormUtils.WarningDialog(Resources.WarningMessageNotSelectedTarget);
278 this.comboBoxTarget.Focus();
281 else if (!String.IsNullOrWhiteSpace(this.comboBoxSource.Text)
282 && this.comboBoxSource.Text == this.comboBoxTarget.Text)
284 FormUtils.WarningDialog(Resources.WarningMessageEqualsSourceAndTarget);
285 this.comboBoxTarget.Focus();
288 else if (String.IsNullOrWhiteSpace(this.textBoxSaveDirectory.Text))
290 FormUtils.WarningDialog(Resources.WarningMessageEmptySaveDirectory);
291 this.textBoxSaveDirectory.Focus();
294 else if (!Directory.Exists(this.textBoxSaveDirectory.Text))
296 FormUtils.WarningDialog(Resources.WarningMessageIgnoreSaveDirectory);
297 this.textBoxSaveDirectory.Focus();
300 else if (String.IsNullOrWhiteSpace(this.textBoxArticle.Text))
302 FormUtils.WarningDialog(Resources.WarningMessageEmptyArticle);
303 this.textBoxArticle.Focus();
308 this.LockOperation();
311 this.backgroundWorkerRun.RunWorkerAsync();
317 /// <param name="sender">イベント発生オブジェクト。</param>
318 /// <param name="e">発生したイベント。</param>
319 private void ButtonStop_Click(object sender, EventArgs e)
322 this.buttonStop.Enabled = false;
323 if (this.backgroundWorkerRun.IsBusy == true)
325 System.Diagnostics.Debug.WriteLine("MainForm.-Stop_Click > 処理中断");
326 this.backgroundWorkerRun.CancelAsync();
327 if (this.translator != null)
329 this.translator.CancellationPending = true;
335 /// 実行ボタン バックグラウンド処理(スレッド)。
337 /// <param name="sender">イベント発生オブジェクト。</param>
338 /// <param name="e">発生したイベント。</param>
339 private void BackgroundWorkerRun_DoWork(object sender, DoWorkEventArgs e)
343 // 初期化と開始メッセージ、別スレッドになるので表示言語も再度設定
344 Program.LoadSelectedCulture();
345 this.textBoxLog.Clear();
347 this.textBoxLog.AppendText(String.Format(Resources.LogMessageStart, FormUtils.ApplicationName(), DateTime.Now));
349 // 翻訳支援処理ロジックのオブジェクトを生成
350 this.translator = Translator.Create(this.config, this.comboBoxSource.Text, this.comboBoxTarget.Text);
352 // ログ・処理状態更新通知を受け取るためのイベント登録
354 this.translator.LogUpdate += new EventHandler(this.GetLogUpdate);
355 this.translator.StatusUpdate += new EventHandler(this.GetStatusUpdate);
356 this.Invoke((MethodInvoker)delegate { this.timerStatusStopwatch.Start(); });
362 this.translator.Run(this.textBoxArticle.Text.Trim());
364 catch (ApplicationException)
366 // 中止要求で停止した場合、その旨イベントに格納する
367 e.Cancel = this.backgroundWorkerRun.CancellationPending;
373 this.Invoke((MethodInvoker)delegate { this.timerStatusStopwatch.Stop(); });
376 // 実行結果から、ログと変換後テキストをファイル出力
377 this.WriteResult(success);
379 catch (WebException ex)
381 // 想定外の通信エラー(↓とまとめてもよいが、こちらはサーバーの状況などで発生しやすいので)
382 this.textBoxLog.AppendText(Environment.NewLine + String.Format(Resources.ErrorMessageConnectionFailed, ex.Message) + Environment.NewLine);
383 if (ex.Response != null)
385 // 出せるならエラーとなったURLも出力
386 this.textBoxLog.AppendText(Resources.RightArrow + " " + String.Format(Resources.LogMessageErrorURL, ex.Response.ResponseUri) + Environment.NewLine);
392 this.textBoxLog.AppendText(Environment.NewLine + String.Format(Resources.ErrorMessageDevelopmentError, ex.Message, ex.StackTrace) + Environment.NewLine);
397 this.translator = null;
402 /// 実行ボタン バックグラウンド処理(終了時)。
404 /// <param name="sender">イベント発生オブジェクト。</param>
405 /// <param name="e">発生したイベント。</param>
406 private void BackgroundWorkerRun_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
409 // ※ 微妙に時間がかかるので、ステータスバーに通知
412 this.toolStripStatusLabelStatus.Text = Resources.StatusCacheUpdating;
419 this.toolStripStatusLabelStatus.Text = String.Empty;
424 FormUtils.WarningDialog(
425 Resources.WarningMessageCacheSaveFailed,
433 #region イベント実装支援用メソッド
438 private void LockOperation()
441 this.groupBoxTransfer.Enabled = false;
442 this.groupBoxSaveDirectory.Enabled = false;
443 this.textBoxArticle.Enabled = false;
444 this.buttonRun.Enabled = false;
445 this.toolStripDropDownButtonLanguage.Enabled = false;
446 this.toolStripDropDownButtonConfig.Enabled = false;
449 this.buttonStop.Enabled = true;
455 private void Release()
458 this.buttonStop.Enabled = false;
461 this.groupBoxTransfer.Enabled = true;
462 this.groupBoxSaveDirectory.Enabled = true;
463 this.textBoxArticle.Enabled = true;
464 this.buttonRun.Enabled = true;
465 this.toolStripDropDownButtonLanguage.Enabled = true;
466 this.toolStripDropDownButtonConfig.Enabled = true;
470 /// 翻訳支援処理のログ・変換後テキストをファイル出力。
472 /// <param name="success">翻訳支援処理が成功した場合<c>true</c>。</param>
473 private void WriteResult(bool success)
475 // 若干時間がかかるのでステータスバーに通知
476 this.toolStripStatusLabelStatus.Text = Resources.StatusFileWriting;
482 this.MakeFileName(out fileName, out logName, this.textBoxArticle.Text.Trim(), this.textBoxSaveDirectory.Text);
486 // 翻訳支援処理成功時は変換後テキストを出力
489 File.WriteAllText(Path.Combine(this.textBoxSaveDirectory.Text, fileName), this.translator.Text);
490 this.textBoxLog.AppendText(String.Format(Resources.LogMessageEnd, fileName, logName));
494 this.textBoxLog.AppendText(String.Format(Resources.LogMessageFileSaveFailed, Path.Combine(this.textBoxSaveDirectory.Text, fileName), ex.Message));
495 this.textBoxLog.AppendText(String.Format(Resources.LogMessageStop, logName));
500 this.textBoxLog.AppendText(String.Format(Resources.LogMessageStop, logName));
506 File.WriteAllText(Path.Combine(this.textBoxSaveDirectory.Text, logName), this.textBoxLog.Text);
510 this.textBoxLog.AppendText(String.Format(Resources.LogMessageFileSaveFailed, Path.Combine(this.textBoxSaveDirectory.Text, logName), ex.Message));
516 this.toolStripStatusLabelStatus.Text = String.Empty;
521 /// 渡された文字列から.txtと.logの重複していないファイル名を作成。
523 /// <param name="fileName">出力結果ファイル名。</param>
524 /// <param name="logName">出力ログファイル名。</param>
525 /// <param name="text">出力する結果テキスト。</param>
526 /// <param name="dir">出力先ディレクトリ。</param>
527 /// <returns>出力成功の場合<c>true</c>。</returns>
528 private bool MakeFileName(out string fileName, out string logName, string text, string dir)
530 // 出力先フォルダに存在しないファイル名(の拡張子より前)を作成
531 // ※渡されたWikipedia等の記事名にファイル名に使えない文字が含まれている場合、_ に置き換える
532 // また、ファイル名が重複している場合、xx[0].txtのように連番を付ける
533 string fileNameBase = FormUtils.ReplaceInvalidFileNameChars(text);
534 fileName = fileNameBase + ".txt";
535 logName = fileNameBase + ".log";
536 bool success = false;
537 for (int i = 0; i < 100000; i++)
539 // ※ 100000まで試して空きが見つからないことは無いはず、もし見つからなかったら最後のを上書き
540 if (!File.Exists(Path.Combine(dir, fileName))
541 && !File.Exists(Path.Combine(dir, logName)))
547 fileName = fileNameBase + "[" + i + "]" + ".txt";
548 logName = fileNameBase + "[" + i + "]" + ".log";
556 /// 翻訳支援処理クラスのログ更新イベント用。
558 /// <param name="sender">イベント発生オブジェクト。</param>
559 /// <param name="e">発生したイベント。</param>
560 private void GetLogUpdate(object sender, EventArgs e)
562 // 前回以降に追加されたログをテキストボックスに出力
563 int length = this.translator.Log.Length;
564 if (length > this.logLength)
566 this.textBoxLog.AppendText(this.translator.Log.Substring(this.logLength, length - this.logLength));
569 this.logLength = length;
573 /// 翻訳支援処理クラスの処理状態更新イベント用。
575 /// <param name="sender">イベント発生オブジェクト。</param>
576 /// <param name="e">発生したイベント。</param>
577 private void GetStatusUpdate(object sender, EventArgs e)
580 this.toolStripStatusLabelStatus.Text = this.translator.Status;
587 #region ステータスバーのイベントのメソッド
590 /// ステータスバー処理時間更新タイマー処理。
592 /// <param name="sender">イベント発生オブジェクト。</param>
593 /// <param name="e">発生したイベント。</param>
594 private void TimerStatusStopwatch_Tick(object sender, EventArgs e)
597 this.toolStripStatusLabelStopwatch.Text = String.Format(Resources.ElapsedTime, this.translator.Stopwatch.Elapsed);
601 /// 表示言語選択メニュー日本語クリック時の処理。
603 /// <param name="sender">イベント発生オブジェクト。</param>
604 /// <param name="e">発生したイベント。</param>
605 private void ToolStripMenuItemJapanese_Click(object sender, EventArgs e)
608 this.ChangeCultureAndRestart("ja-JP");
612 /// 表示言語選択メニュー英語(US)クリック時の処理。
614 /// <param name="sender">イベント発生オブジェクト。</param>
615 /// <param name="e">発生したイベント。</param>
616 private void ToolStripMenuItemEnglishUS_Click(object sender, EventArgs e)
618 // 表示言語を英語(US)に設定し再起動する
619 this.ChangeCultureAndRestart("en-US");
623 /// 表示言語選択メニュー英語(GB)クリック時の処理。
625 /// <param name="sender">イベント発生オブジェクト。</param>
626 /// <param name="e">発生したイベント。</param>
627 private void ToolStripMenuItemEnglishGB_Click(object sender, EventArgs e)
629 // 表示言語を英語(GB)に設定し再起動する
630 this.ChangeCultureAndRestart("en-GB");
634 /// 表示言語選択メニュー自動クリック時の処理。
636 /// <param name="sender">イベント発生オブジェクト。</param>
637 /// <param name="e">発生したイベント。</param>
638 private void ToolStripMenuItemAuto_Click(object sender, EventArgs e)
641 this.ChangeCultureAndRestart(String.Empty);
645 /// 設定選択メニュークリック時の処理。
647 /// <param name="sender">イベント発生オブジェクト。</param>
648 /// <param name="e">発生したイベント。</param>
649 private void ToolStripMenuItemConfig_Click(object sender, EventArgs e)
651 // メニュー項目を一旦全て未選択状態に更新
652 foreach (ToolStripMenuItem i in this.toolStripDropDownButtonConfig.DropDownItems)
658 // メニュー項目名から設定ファイル名を作成、再読み込みする
659 ToolStripMenuItem item = (ToolStripMenuItem)sender;
660 Settings.Default.LastSelectedConfiguration = item.Text;
662 this.InitializeByConfig();
666 /// 設定選択メニュー追加クリック時の処理。
668 /// <param name="sender">イベント発生オブジェクト。</param>
669 /// <param name="e">発生したイベント。</param>
670 private void ToolStripMenuItemNew_Click(object sender, EventArgs e)
672 // 重複チェック用の登録済みの設定一覧を用意
673 IList<string> configNames = new List<string>();
674 foreach (ToolStripMenuItem item in this.toolStripDropDownButtonConfig.DropDownItems)
676 if (item != this.toolStripMenuItemNew)
678 configNames.Add(item.Text);
682 // 設定追加用ダイアログで言語コードを入力
683 using (AddConfigDialog form = new AddConfigDialog(configNames))
685 if (form.ShowDialog() == DialogResult.OK)
687 // 設定選択メニューに新しい設定を追加。
688 // 設定ファイルが作成されているため、それを読み込みなおす。
689 this.ToolStripMenuItemConfig_Click(
690 this.AddToolStripDropDownButtonConfigItem(form.ConfigName),
696 #region イベント実装支援用メソッド
699 /// 表示言語選択メニューの初期化処理。
701 private void InitializeDropDownButtonLanguage()
704 ToolStripMenuItem item;
705 switch (Settings.Default.LastSelectedLanguage)
708 item = this.toolStripMenuItemEnglishUS;
711 item = this.toolStripMenuItemEnglishGB;
714 item = this.toolStripMenuItemJapanese;
717 item = this.toolStripMenuItemAuto;
721 // 選択中の項目をチェック状態&押下不能とする
723 item.Enabled = false;
724 if (item != this.toolStripMenuItemAuto)
726 // 自動以外の場合、ステータスバーの表示も更新
727 this.toolStripDropDownButtonLanguage.Text = item.Text;
732 /// 設定ファイル選択メニューの初期化処理。
734 private void InitializeDropDownButtonConfig()
736 // exeまたはユーザーフォルダにある設定ファイルをメニュー項目としてリストアップ
737 foreach (string file in FormUtils.GetFilesAtUserAppData(
738 "*" + Settings.Default.ConfigurationExtension,
739 Settings.Default.ConfigurationCompatible))
743 // 関係ないXMLファイルを除外するため、読み込めるフォーマットかをチェック
745 Config.GetInstance(file);
747 // 問題なければファイル名を見出しにメニューに追加
748 this.AddToolStripDropDownButtonConfigItem(Path.GetFileNameWithoutExtension(file));
752 System.Diagnostics.Debug.WriteLine(
753 "MainForm.InitializeDropDownButtonConfig : " + ex.Message);
759 /// 設定選択メニューに新しい設定を追加する。
761 /// <param name="name">設定名。</param>
762 /// <returns>追加したメニュー。</returns>
763 /// <remarks>追加メニューがあるのでその後ろに登録する。</remarks>
764 private ToolStripMenuItem AddToolStripDropDownButtonConfigItem(string name)
767 ToolStripMenuItem item = new ToolStripMenuItem();
769 item.Click += new EventHandler(this.ToolStripMenuItemConfig_Click);
770 this.toolStripDropDownButtonConfig.DropDownItems.Insert(
771 this.toolStripDropDownButtonConfig.DropDownItems.Count - 1,
777 /// アプリケーションの現在の表示言語を変更、再起動する。
779 /// <param name="name">変更先カルチャ名。</param>
780 /// <remarks>このメソッドを呼び出すとアプリケーションが一旦終了します。</remarks>
781 private void ChangeCultureAndRestart(string name)
783 // 現在の画面表示と表示言語設定を保存した後、アプリケーションを再起動
785 Settings.Default.LastSelectedLanguage = name;
786 Settings.Default.Save();
787 Application.Restart();
801 /// 読み込みに失敗した場合、空の設定を登録し、操作の大半をロックする
802 /// (設定変更メニューから正しい設定に変更されることを期待)。
804 private void InitializeByConfig()
808 if (this.config == null)
810 // 読み込みに失敗した場合、空の設定を作成(設定値には適当な値を設定)
811 // 設定選択メニューの表示を更新し、画面をほぼ操作不可に変更
812 this.config = new Config();
813 this.groupBoxTransfer.Enabled = false;
814 this.groupBoxSaveDirectory.Enabled = false;
815 this.groupBoxRun.Enabled = false;
816 this.toolStripDropDownButtonConfig.Text = Resources.DropDownConfigLoadConfigFailed;
820 // 設定選択メニューの表示を更新し、画面を操作可能な状態に戻す
821 this.groupBoxTransfer.Enabled = true;
822 this.groupBoxSaveDirectory.Enabled = true;
823 this.groupBoxRun.Enabled = true;
824 this.toolStripDropDownButtonConfig.Text = Path.GetFileNameWithoutExtension(this.config.File);
825 foreach (ToolStripMenuItem item in this.toolStripDropDownButtonConfig.DropDownItems)
827 // 読み込んだ設定を選択中(チェック状態&押下不能)に更新
828 if (item != this.toolStripMenuItemNew
829 && item.Text == this.toolStripDropDownButtonConfig.Text)
832 item.Enabled = false;
837 // コンボボックスを読み込んだ設定で初期化
838 this.InitializeComboBox();
844 private void LoadConfig()
847 // ※ 微妙に時間がかかるので、ステータスバーに通知
848 string file = Settings.Default.LastSelectedConfiguration + Settings.Default.ConfigurationExtension;
851 this.toolStripStatusLabelStatus.Text = Resources.StatusConfigReading;
854 this.config = Config.GetInstance(file);
858 this.toolStripStatusLabelStatus.Text = String.Empty;
861 catch (FileNotFoundException ex)
863 // 設定ファイルが見つからない場合、エラーメッセージを表示
864 System.Diagnostics.Debug.WriteLine(
865 "MainForm.LoadConfig > 設定ファイル読み込み失敗 : " + ex.Message);
866 FormUtils.ErrorDialog(Resources.ErrorMessageConfigNotFound, file);
870 // その他の例外(権限が無いとかファイルが壊れているとか)
871 System.Diagnostics.Debug.WriteLine(
872 "MainForm.LoadConfig > 設定ファイル読み込み時エラー : " + ex.ToString());
873 FormUtils.ErrorDialog(Resources.ErrorMessageConfigLordFailed, ex.Message);
878 /// 現在の出力先フォルダ、翻訳元/先言語をアプリケーション設定に反映。
880 /// <remarks>表示言語や設定ファイルの選択については必要な場合のみ別途実施。</remarks>
881 private void SetSettings()
883 Settings.Default.SaveDirectory = this.textBoxSaveDirectory.Text;
884 Settings.Default.LastSelectedSource = this.comboBoxSource.Text;
885 Settings.Default.LastSelectedTarget = this.comboBoxTarget.Text;