void Form1_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); //foreach (string file in files) Console.WriteLine(file); Console.WriteLine(files.Length); if (files.Length >= 2) { MessageBox.Show("一次只能處理一個檔案..."); reset_data(); return; } string sn = my.subname(files[0].ToString()); if (sn != "nc" && sn != "txt") { MessageBox.Show("副檔名只能是 nc 或 txt"); reset_data(); return; } CC.orin_path = files[0].ToString(); INPUT_PATH.Text = CC.orin_path; CC.data = my.b2s(my.file_get_contents(CC.orin_path)); CC.data = my.trim(CC.data.Replace("\r", "")); CC.m_data = new List <string>(); load_data(); }
private void Form1_Load(object sender, EventArgs e) { //檢查不能重複啟動 if (!ucl.checkLockSuccess()) { MessageBox.Show("肥米已執行了..."); Application.Exit(); } //載入 UCLLIU.ini ucl.loadConfig(); //載入字根檔 ucl.loadJsonData(); //如果有拚音,載入拚音功能 if (my.is_file(my.pwd() + "\\pinyi.txt")) { ucl.same_sound_data = new List <string>(my.explode("\n", my.trim(my.b2s(my.file_get_contents(my.pwd() + "\\pinyi.txt"))))); } //產生最簡根表 ucl.generator_sp_table(); word_label.Text = ""; type_label.Text = ""; KeyboardHook(this, e); //小圖加入版本 notifyIcon1.Text = "肥米輸入法:" + ucl.VERSION; //修正一下畫面 // /*this.TopLevel = true; * this.TopLevel = false; * this.TopLevel = true; * this.TopMost = true; * this.TopMost = false; * this.TopMost = true; */ //Thread.Sleep(3000); btn_UCL.PerformClick(); btn_UCL.PerformClick(); //起始不可以是 topmost ,在程式執行後,才置高,不然 //首次切換輸入法時,會失去原始的焦點(如記事本) this.TopMost = true; /*Thread.Sleep(1000); * SendKeys.SendWait("+"); * Thread.Sleep(1000); * SendKeys.SendWait("+"); * Thread.Sleep(1000); * SendKeys.SendWait("+"); * Thread.Sleep(1000); * SendKeys.SendWait("+"); * Thread.Sleep(1000); * SendKeys.SendWait("+"); * Thread.Sleep(1000); * SendKeys.SendWait("+"); * ucl.toAlphaOrNonAlpha(); */ //AllocConsole(); }