private void Start() { var languageKey = Application.systemLanguage == SystemLanguage.ChineseTraditional ? "zh-tw" : "en"; WordDic.Init(languageKey, lines.text); sampleText.MutliText("test1"); }
public void OnDropDownChange(int value) { var languageKey = value == 0 ? "zh-tw" : "en"; WordDic.Init(languageKey, lines.text); sampleText.MutliText("test1"); }
/// <summary> /// /// </summary> /// <returns></returns> public TanitsuTorokuDeleteServiceOutBo execute() { TanitsuTorokuDeleteServiceOutBo outBo = new TanitsuTorokuDeleteServiceOutBo(); for (int i = 0; i < this.inBo.tanitsuDataGridView.Rows.Count; i++) { if (this.inBo.tanitsuDataGridView.Rows[i].Cells[0].Value == null) { continue; } if (this.inBo.tanitsuDataGridView.Rows[i].Cells[0].Value.Equals(true)) { using (var context = new MyContext()) { long condtion = Convert.ToInt64(this.inBo.tanitsuDataGridView.Rows[i].Cells["word_id"].Value.ToString()); var toRemoveWord = new WordDic { word_id = condtion }; context.WordDic.Attach(toRemoveWord); context.WordDic.Remove(toRemoveWord); context.SaveChanges(); } } } MessageBox.Show("辞書テーブルから削除されました。"); return(outBo); }
public static void load() { DataContractJsonSerializer dataContract = new DataContractJsonSerializer(typeof(WordDic)); using (FileStream fs = new FileStream(@"WordDic.db", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)){ wordDic = dataContract.ReadObject(fs) as WordDic; } Console.WriteLine("load"); }
static void Main(string[] args) { if (File.Exists(@"WordDic.db")) { load(); } else { wordDic = new WordDic(); wordDic.addDic("word", "mean"); wordDic.addDic("F1", "add word"); wordDic.addDic("R", "shuffle"); save(); } wordDic.shuffle(); Application.Run(new MainFrame()); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void shounin_Click(object sender, EventArgs e) { if (!this.shouninPreCheck(this.shinseiDataGridView1)) { return; } List <WordDic> shinseiWordDicList = new List <WordDic>(); for (int i = 0; i < shinseiDataGridView1.Rows.Count; i++) { if (shinseiDataGridView1.Rows[i].Cells[0].Value == null || (bool)shinseiDataGridView1.Rows[i].Cells[0].Value == false) { continue; } using (var context = new MyContext()) { long condtion = Convert.ToInt64(this.shinseiDataGridView1.Rows[i].Cells["shinsei_id"].Value.ToString()); var w = context.WordShinsei.Single(x => x.shinsei_id == condtion); w.cre_date = System.DateTime.Now.ToString(); w.status = 1; WordDic word = new WordDic(); word.ronri_name1 = Convert.ToString(this.shinseiDataGridView1.Rows[i].Cells["ronri_name1"].Value); word.ronri_name2 = Convert.ToString(this.shinseiDataGridView1.Rows[i].Cells["ronri_name2"].Value); word.butsuri_name = Convert.ToString(this.shinseiDataGridView1.Rows[i].Cells["butsuri_name"].Value); word.user_id = BaseForm.UserInfo.userId; word.cre_date = System.DateTime.Now.ToString(); context.WordDic.Add(word); context.SaveChanges(); shinseiWordDicList.Add(word); } } MessageBox.Show(MessageConst.CONF_002); if (!this.mailSend(shinseiWordDicList, (int)ShinseiKbn.承認)) { return; } this.Shinsei_Load(sender, e); }
/// <summary> /// /// </summary> /// <returns></returns> internal IkkatsuTorokuIkkatsuRegistServiceOutBo execute() { IkkatsuTorokuIkkatsuRegistServiceOutBo outBo = new IkkatsuTorokuIkkatsuRegistServiceOutBo(); for (int i = 0; i < this.inBo.ikkatsuDataGridView.Rows.Count; i++) { if (this.inBo.ikkatsuDataGridView.Rows[i].Cells[0].Value == null) { continue; } if (this.inBo.ikkatsuDataGridView.Rows[i].Cells[0].Value.Equals(true)) { using (var context = new MyContext()) { long condtion = Convert.ToInt64(this.inBo.ikkatsuDataGridView.Rows[i].Cells["word_id"].Value.ToString()); var upWord = context.WordDic .Where(x => x.word_id == condtion); String butsuriName = Convert.ToString(this.inBo.ikkatsuDataGridView.Rows[i].Cells["butsuri_name"].Value); butsuriName = butsuriName.ToPascalCase(); if (upWord.Count() == 1) { var w = context.WordDic.Single(x => x.word_id == condtion); w.ronri_name1 = Convert.ToString(this.inBo.ikkatsuDataGridView.Rows[i].Cells["ronri_name1"].Value); w.butsuri_name = butsuriName; w.cre_date = System.DateTime.Now.ToString(); context.SaveChanges(); continue; } WordDic word = new WordDic(); word.ronri_name1 = Convert.ToString(this.inBo.ikkatsuDataGridView.Rows[i].Cells["ronri_name1"].Value); word.butsuri_name = butsuriName; word.cre_date = System.DateTime.Now.ToString(); context.WordDic.Add(word); context.SaveChanges(); } } } return(outBo); }
/// <summary> /// /// </summary> /// <returns></returns> public TanitsuTorokuRegistServiceOutBo execute() { TanitsuTorokuRegistServiceOutBo outBo = new TanitsuTorokuRegistServiceOutBo(); for (int i = 0; i < this.inBo.tanitsuDataGridView.Rows.Count; i++) { if (this.inBo.tanitsuDataGridView.Rows[i].Cells[0].Value == null || (bool)this.inBo.tanitsuDataGridView.Rows[i].Cells[0].Value == false) { continue; } using (var context = new MyContext()) { long condtion = Convert.ToInt64(this.inBo.tanitsuDataGridView.Rows[i].Cells["word_id"].Value.ToString()); var upWord = context.WordDic .Where(x => x.word_id == condtion); if (upWord.Count() == 1) { var w = context.WordDic.Single(x => x.word_id == condtion); w.ronri_name1 = Convert.ToString(this.inBo.tanitsuDataGridView.Rows[i].Cells["ronri_name1"].Value); w.butsuri_name = Convert.ToString(this.inBo.tanitsuDataGridView.Rows[i].Cells["butsuri_name"].Value); w.data_type = Convert.ToString(this.inBo.tanitsuDataGridView.Rows[i].Cells["data_type"].Value); w.cre_date = System.DateTime.Now.ToString(); w.user_id = BaseForm.UserInfo.userId; context.SaveChanges(); continue; } WordDic word = new WordDic(); word.ronri_name1 = Convert.ToString(this.inBo.tanitsuDataGridView.Rows[i].Cells["ronri_name1"].Value); word.butsuri_name = Convert.ToString(this.inBo.tanitsuDataGridView.Rows[i].Cells["butsuri_name"].Value); word.data_type = Convert.ToString(this.inBo.tanitsuDataGridView.Rows[i].Cells["data_type"].Value); word.cre_date = System.DateTime.Now.ToString(); word.user_id = BaseForm.UserInfo.userId; context.WordDic.Add(word); context.SaveChanges(); } } return(outBo); }
public void InsertWordDic(WordDic entity) { context.WordDic.Add(entity); context.SaveChanges(); }
public static void MutliText(this TMPro.TextMeshProUGUI text, string key) { text.text = WordDic.Get(key); }
public static void MutliText(this UnityEngine.UI.Text text, string key) { text.text = WordDic.Get(key); }
/// <summary> /// /// </summary> /// <returns></returns> public IkkatsuTorokuReadFileServiceOutBo execute() { IkkatsuTorokuReadFileServiceOutBo outBo = new IkkatsuTorokuReadFileServiceOutBo(); Microsoft.Office.Interop.Excel.Application oExcelApp = null; // Excelオブジェクト Microsoft.Office.Interop.Excel.Workbook oExcelWBook = null; // Excel Workbookオブジェクト try { oExcelApp = new Microsoft.Office.Interop.Excel.Application(); oExcelApp.DisplayAlerts = false; // Excelの確認ダイアログ表示有無 oExcelApp.Visible = false; // Excel表示有無 // Excelファイルをオープンする(第一パラメタ以外は省略可) oExcelWBook = (Microsoft.Office.Interop.Excel.Workbook)(oExcelApp.Workbooks.Open( this.inBo.Filename, // Filename Type.Missing, // UpdateLinks Type.Missing, // ReadOnly Type.Missing, // Format Type.Missing, // Password Type.Missing, // WriteResPassword Type.Missing, // IgnoreReadOnlyRecommended Type.Missing, // Origin Type.Missing, // Delimiter Type.Missing, // Editable Type.Missing, // Notify Type.Missing, // Converter Type.Missing, // AddToMru Type.Missing, // Local Type.Missing // CorruptLoad )); Microsoft.Office.Interop.Excel._Worksheet oWSheet = (Microsoft.Office.Interop.Excel._Worksheet)oExcelWBook.ActiveSheet; int ronri_name1 = 1; int butsuri_name = 2; int db_data_type = 3; int rowId = 2; using (var context = new MyContext()) { while (!String.IsNullOrEmpty(oWSheet.Cells[rowId, ronri_name1].Value)) { string ronriName = oWSheet.Cells[rowId, ronri_name1].Value; string butsuriName = oWSheet.Cells[rowId, butsuri_name].Value; string dbDataType = oWSheet.Cells[rowId, db_data_type].Value; if (!String.IsNullOrEmpty(ronriName) && !String.IsNullOrEmpty(butsuriName)) { var upWord = context.WordDic.Where(x => x.ronri_name1 == ronriName); if (upWord.Count() == 1) { rowId++; continue; } WordDic word = new WordDic(); word.ronri_name1 = Convert.ToString(ronriName); word.butsuri_name = Convert.ToString(butsuriName).ToCamelCase(); word.data_type = this.getDataType(dbDataType); word.cre_date = System.DateTime.Now.ToString(); word.user_id = BaseForm.UserInfo.userId; context.WordDic.Add(word); if (this.inBo.registeredPairsIkkatsu) { word = new WordDic(); word.butsuri_name = Convert.ToString(ronriName); word.ronri_name1 = Convert.ToString(butsuriName); word.data_type = this.getDataType(dbDataType); word.cre_date = System.DateTime.Now.ToString(); word.user_id = BaseForm.UserInfo.userId; context.WordDic.Add(word); } context.SaveChanges(); } rowId++; } } } catch (System.IO.FileNotFoundException) { MessageBox.Show( "Excelファイルの操作に失敗しました。\n", System.Windows.Forms.Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { oExcelWBook.Close(Type.Missing, Type.Missing, Type.Missing); oExcelApp.Quit(); File.SetAttributes(this.inBo.Filename, FileAttributes.Normal); } MessageBox.Show("正常に読み込みました。"); return(outBo); }