Ejemplo n.º 1
0
        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();
            });
        }
Ejemplo n.º 2
0
 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;
     }
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        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());
            }
        }