private void BindControls() { this.WhenActivated(disposables => { this.Bind(ViewModel, vm => vm.CurrentText, v => v.EditorText.Text); this.BindCommand(ViewModel, vm => vm.DoneCommand, v => v.ButtonDone); EditorText.Focus(); }); }
private async Task AddDirective(Directive selectedDirective) { if (EditorText != null) { var previousCaret = EditorTextCaretIndex; string newDisplay = EditorText.Substring(0, EditorTextCaretIndex) + selectedDirective.Value + EditorText.Substring(EditorTextCaretIndex, EditorText.Length - EditorTextCaretIndex); EditorText = newDisplay; } }
public static dynamic Save(string textEditor) { try { EditorText Editor = new EditorText(); Editor.Text = WebUtility.HtmlEncode(textEditor); context.EditorText.Add(Editor); context.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public static EditorText Get() { EditorText Editor = new EditorText(); try { var data = context.EditorText.FirstOrDefault(); if (data != null) { Editor.ID = data.ID; Editor.Text = WebUtility.HtmlDecode(data.Text); } return(Editor); } catch (Exception ex) { return(Editor); } }
private void ExecuteStatement(object arg) { var statement = EditorText.Trim(); if (statement.IsNullOrEmpty()) { return; } try { QueryResult.Clear(); StatusText = "Executing"; new Thread(() => _communicator.StartExecute(statement, ResultReady)).Start(); } catch (UserException ex) { QueryResult.Show(ex.Message); } catch (Exception ex) { QueryResult.Show(ex.ToString()); } }