///<summary></summary> public static void Update(DictCustom dictCustom){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){ Meth.GetVoid(MethodBase.GetCurrentMethod(),dictCustom); return; } Crud.DictCustomCrud.Update(dictCustom); }
///<summary></summary> public static long Insert(DictCustom dictCustom){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){ dictCustom.DictCustomNum=Meth.GetLong(MethodBase.GetCurrentMethod(),dictCustom); return dictCustom.DictCustomNum; } return Crud.DictCustomCrud.Insert(dictCustom); }
///<summary></summary> public static long Insert(DictCustom dictCustom) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { dictCustom.DictCustomNum = Meth.GetLong(MethodBase.GetCurrentMethod(), dictCustom); return(dictCustom.DictCustomNum); } return(Crud.DictCustomCrud.Insert(dictCustom)); }
///<summary></summary> public static void Update(DictCustom dictCustom) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), dictCustom); return; } Crud.DictCustomCrud.Update(dictCustom); }
private void butAdd_Click(object sender,EventArgs e) { if(textCustom.Text=="") { MsgBox.Show(this,"Please enter a custom word first."); return; } string newWord=Regex.Replace(textCustom.Text,"[\\s]|[\\p{P}\\p{S}-['-]]","");//don't allow words with spaces or punctuation except ' and - in them for(int i=0;i<DictCustoms.Listt.Count;i++) {//Make sure it's not already in the custom list if(DictCustoms.Listt[i].WordText==newWord) { MsgBox.Show(this,"The word "+newWord+" is already in the custom word list."); textCustom.Clear(); return; } } DictCustom word=new DictCustom(); word.WordText=newWord; DictCustoms.Insert(word); DataValid.SetInvalid(InvalidType.DictCustoms); textCustom.Clear(); FillGrid(); }
private void menuItem_Click(object sender,System.EventArgs e) { if(ReadOnly && contextMenu.MenuItems.IndexOf((MenuItem)sender)!=13) { MsgBox.Show(this,"This feature is currently disabled due to this text box being read only."); return; } switch(contextMenu.MenuItems.IndexOf((MenuItem)sender)) { case 0: case 1: case 2: case 3: case 4: if(!this.spellCheckIsEnabled || !PrefC.GetBool(PrefName.SpellCheckIsEnabled)) {//if spell check disabled, break. Should never happen since the suggested words won't show if spell check disabled break; } int originalCaret=this.SelectionStart; this.Text=this.Text.Remove(ReplWord.StartIndex,ReplWord.Value.Length); this.Text=this.Text.Insert(ReplWord.StartIndex,contextMenu.MenuItems[contextMenu.MenuItems.IndexOf((MenuItem)sender)].Text); if(this.Text.Length<=originalCaret) { this.SelectionStart=this.Text.Length; } else { this.SelectionStart=originalCaret; } timer1.Start(); break; //case 5 is separator case 6://Add to dict if(!this.spellCheckIsEnabled || !PrefC.GetBool(PrefName.SpellCheckIsEnabled)) {//if spell check disabled, break. Should never happen since Add to Dict won't show if spell check disabled break; } string newWord=ReplWord.Value; //guaranteed to not already exist in custom dictionary, or it wouldn't be underlined. DictCustom word=new DictCustom(); word.WordText=newWord; DictCustoms.Insert(word); DataValid.SetInvalid(InvalidType.DictCustoms); ListIncorrect.Remove(ReplWord.Value); ListCorrect.Add(ReplWord.Value); timer1.Start(); break; case 7://Disable spell check if(!MsgBox.Show(this,MsgBoxButtons.OKCancel,"This will disable spell checking. To re-enable, go to Setup | Spell Check and check the \"Spell Check Enabled\" box.")) { break; } Prefs.UpdateBool(PrefName.SpellCheckIsEnabled,false); DataValid.SetInvalid(InvalidType.Prefs); ClearWavyLines(); break; //case 8 is separator case 9: InsertDate(); break; case 10://Insert Quick Note ShowFullDialog(); break; //case 11 is separator case 12://cut Clipboard.SetDataObject(SelectedText); int caretPos=SelectionStart; Text=Text.Remove(SelectionStart,SelectionLength); SelectionStart=caretPos; SelectionLength=0; break; case 13://copy Clipboard.SetDataObject(SelectedText); break; case 14://paste try { if(!Clipboard.ContainsText()) { MsgBox.Show(this,"There is no text on the clipboard."); break; } int caret=SelectionStart; IDataObject iData=Clipboard.GetDataObject(); if(SelectionLength>0) { Text=Text.Remove(SelectionStart,SelectionLength); SelectionLength=0; } string strPaste=(string)iData.GetData(DataFormats.Text); Text=Text.Insert(caret,strPaste); //MaxLength is not enforced by the RichTextBox. It allows us to set the Text value to a longer length, so we have to handle it manually. if(Text.Length>MaxLength) { Text=Text.Substring(0,MaxLength); } SelectionStart=caret+strPaste.Length; } catch(Exception ex) { MessageBox.Show(Lan.g(this,"Failed to paste text from clipboard")+": "+ex.Message); } break; } }