// Add Dictionary private void Btn_add_dict_Click(object sender, EventArgs e) { AddDictForm adf = new AddDictForm(this); adf.cancelButton.Click += delegate(object sender1, EventArgs e1) { adf.Close(); }; adf.addButton.Click += delegate(object sender1, EventArgs e1) { if (((AddDictForm)((Button)sender1).Parent).formCheck()) { ((AddDictForm)((Button)sender1).Parent).insertDict(); } }; adf.ShowDialog(); }
static void LoadConfigFiles(MainWindow mainWindow) { NinjaTranslateMain.currentFileKey = Config.GetValue("currentKey"); NinjaTranslateMain.rawFiles = Config.GetMultiValue("path"); NinjaTranslateMain.quickChangeKey = Config.GetValue("quickchangeKey"); NinjaTranslateMain.treesInMemory = new Dictionary <String, PatriciaTrie>(); NinjaTranslateMain.maxTreesInMemory = Int32.Parse(Config.GetValue("maxTreesInMemory")); if (NinjaTranslateMain.maxTreesInMemory < 1) { NinjaTranslateMain.maxTreesInMemory = 1; } if (currentFileKey == "") // happens when no dictionary is stated in the config file { AddDictForm adf = new AddDictForm(mainWindow); MessageBox.Show("It seems that you started NinjaTranslate for the first time. To use this program you have to download the translations data from dict.cc." + " You can do that for example on http://www1.dict.cc/translation_file_request.php?l=e . Please state the path of this file in the next dialog."); adf.addButton.Click += delegate(object sender1, EventArgs e1) { AddDictForm adForm = (AddDictForm)((Button)sender1).Parent; if (adForm.formCheck()) { adForm.stopCancelingEvent(); adForm.insertDict(); mainWindow.SaveInit(); adForm.Close(); } }; adf.FormClosing += delegate(object sender1, FormClosingEventArgs e1) { if (((AddDictForm)sender1).canceled) { Environment.Exit(0); } }; adf.ShowDialog(); NinjaTranslateMain.currentFileKey = Config.GetValue("currentKey"); } }