Exemple #1
0
        public SettingsWindow()
        {
            InitializeComponent();
            try
            {
                //EditorMode mode = (EditorMode)Enum.Parse(typeof(EditorMode), ConfigManager.GetConfigurationValue(KeyName.default_mode));
                //FontType font = (FontType)Enum.Parse(typeof(FontType), ConfigManager.GetConfigurationValue(KeyName.default_font));
                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;
                    }
                }
            }
            catch { }
        }
        //private Image ConvertImageToGrayScaleImage()
        //{
        //    Image image = new Image();
        //    BitmapImage bmpImage = new BitmapImage();
        //    bmpImage.BeginInit();
        //    bmpImage.UriSource = new Uri("pack://application:,,,/images/gui/redo.png");
        //    bmpImage.EndInit();
        //    if (!undoButton.IsEnabled)
        //    {
        //        FormatConvertedBitmap grayBitmap = new FormatConvertedBitmap();
        //        grayBitmap.BeginInit();
        //        grayBitmap.Source = bmpImage;
        //        grayBitmap.DestinationFormat = PixelFormats.Gray8;
        //        grayBitmap.EndInit();
        //        image.Source = grayBitmap;
        //    }
        //    return image;
        //}

        void CheckForUpdate()
        {
            if (ConfigManager.GetConfigurationValue(KeyName.checkUpdates) == "false")
            {
                return;
            }
            try
            {
                string newVersion = version;
                using (WebClient client = new WebClient())
                {
                    newVersion = client.DownloadString("http://www.mathiversity.com/matheditor/version");
                }
                string[] newParts     = newVersion.Split('.');
                string[] currentParts = version.Split('.');
                for (int i = 0; i < newParts.Count(); i++)
                {
                    if (int.Parse(newParts[i]) > int.Parse(currentParts[i]))
                    {
                        if (MessageBox.Show("A new version of Math Editor with enhanced features is available.\r\nWould you like to download the new version?",
                                            "New version available",
                                            MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                        {
                            BrowserHelper.Open("https://www.mathiversity.com/downloads");
                        }
                        break;
                    }
                    else if (int.Parse(newParts[i]) < int.Parse(currentParts[i]))
                    {
                        break;
                    }
                }
            }
            catch { } // hopeless..
        }
Exemple #3
0
 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);
     MVService.UserLoggedIn  += new EventHandler(MVService_UserLoggedIn);
     MVService.UserLoggedOut += new EventHandler(MVService_UserLoggedOut);
     ProcessLogout();
 }
Exemple #4
0
        public HistoryToolBar()
        {
            this.DataContext = this;
            InitializeComponent();
            recentListBox.ItemsSource = recentList;
            var data = ConfigManager.GetConfigurationValue(KeyName.symbols);

            if (data.Length > 0)
            {
                string [] list = data.Split(',');
                foreach (var s in list)
                {
                    recentList.Add(s);
                }
            }
            recentListBox.FontFamily = FontFactory.GetFontFamily(FontType.STIXGeneral);
        }
Exemple #5
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();
            editor.Focus();
            window = new OnlineFilesWindow(this)
            {
                Owner                 = this,
                Topmost               = true,
                ShowInTaskbar         = false,
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner
            };
        }
Exemple #6
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();
        }