Ejemplo n.º 1
0
        public MainWindow()
        {
            this.DataContext = this;
            InitializeComponent();

            StatusBarHelper.Init(this);
            characterToolBar.CommandCompleted += (x, y) => { currentEC.Focus(); };
            equationToolBar.CommandCompleted  += (x, y) => { currentEC.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);
            //currentEC.ZoomChanged += new EventHandler(editor_ZoomChanged);
        }
Ejemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                var strings = Environment.GetCommandLineArgs();
                if (strings.Length > 1)
                {
                    OpenFile(strings[1]);
                }
            }
            catch { }
            var mode     = ConfigManager.GetConfigurationValue(KeyName.default_mode);
            var fontName = ConfigManager.GetConfigurationValue(KeyName.default_font);

            var modes = editorModeCombo.Items;

            foreach (ComboBoxItem item in modes)
            {
                if ((string)item.Tag == mode)
                {
                    editorModeCombo.SelectedItem = item;
                }
            }
            var fonts = equationFontCombo.Items;

            foreach (ComboBoxItem item in fonts)
            {
                if ((string)item.Tag == fontName)
                {
                    equationFontCombo.SelectedItem = item;
                }
            }
            ChangeEditorMode();
            ChangeEditorFont();
            currentEC = ((EditorControl)((ScrollViewer)((TabItem)MainTabControl.SelectedItem).Content).Content);
            currentEC.Focus();
        }