public MainWindow()
 {
     this.DataContext = this;
     InitializeComponent();
     StatusBarHelper.Init(this);
     characterToolBar.CommandCompleted += (x, y) => { editor.Focus(); };
     equationToolBar.CommandCompleted  += (x, y) => { editor.Focus(); };
     SetTitle();
     AddHandler(UIElement.MouseDownEvent, new MouseButtonEventHandler(MainWindow_MouseDown), true);
     Task.Factory.StartNew(CheckForUpdate);
     //if (ConfigManager.GetConfigurationValue(KeyName.firstTime) == "true" || ConfigManager.GetConfigurationValue(KeyName.version) != version)
     //{
     //    string successMessage = "";
     //    if (ConfigManager.SetConfigurationValue(KeyName.firstTime, "false") && ConfigManager.SetConfigurationValue(KeyName.version, version))
     //    {
     //        successMessage = "\r\n\r\nThis message will not be shown again.";
     //    }
     //    MessageBox.Show("Thanks for using Math Editor. Math Editor is under constant development and we regularly release better versions of this product." + Environment.NewLine + Environment.NewLine +
     //                    "Please help us by sending your suggestions, feature requests or bug reports using our facebook page or our website (see help)." + Environment.NewLine + Environment.NewLine +
     //                    successMessage, "Important message");
     //}
     UndoManager.CanUndo               += (a, b) => { undoButton.IsEnabled = b.ActionPossible; };
     UndoManager.CanRedo               += (a, b) => { redoButton.IsEnabled = b.ActionPossible; };
     EquationBase.SelectionAvailable   += new EventHandler <EventArgs>(editor_SelectionAvailable);
     EquationBase.SelectionUnavailable += new EventHandler <EventArgs>(editor_SelectionUnavailable);
     underbarToggle.IsChecked           = true;
     TextEquation.InputPropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(TextEquation_InputPropertyChanged);
     editor.ZoomChanged += new EventHandler(editor_ZoomChanged);
 }
        private void EditorControl_MouseMove(object sender, MouseEventArgs e)
        {
            Point mousePosition = e.GetPosition(this);

            StatusBarHelper.ShowCoordinates((int)mousePosition.X + ", " + (int)mousePosition.Y);
            if (isDragging)
            {
                if (Math.Abs(lastMouseLocation.X - mousePosition.X) > 2 /*SystemParameters.MinimumHorizontalDragDistance*/ ||
                    Math.Abs(lastMouseLocation.Y - mousePosition.Y) > 2 /*SystemParameters.MinimumVerticalDragDistance*/)
                {
                    equationRoot.HandleMouseDrag(mousePosition);
                    lastMouseLocation = mousePosition;
                    InvalidateVisual();
                }
            }
        }
 private void EditorControl_MouseLeave(object sender, MouseEventArgs e)
 {
     StatusBarHelper.ShowCoordinates("");
 }