Example #1
0
        public MainWindow()
        {
            InitializeComponent();

            FontFamilyViewModel fontFamilyVM = (FontFamilyViewModel)fontFamilyComboBox.DataContext;

            fontFamilyVM.TextEditor     = richTextBox;
            fontFamilyVM.FontSizeSlider = fontSizeSlider;

            ColorPickerViewModel colorPickerVM = (ColorPickerViewModel)colorPicker.DataContext;

            colorPickerVM.TextEditor = richTextBox;

            FileDialogViewModel fileDialogVM = (FileDialogViewModel)fileDialogMenuItem.DataContext;

            fileDialogVM.TextEditor = richTextBox;
            fileDialogVM.MainWindow = this;

            App.LanguageChanged += LanguageChanged;
            CultureInfo currentLang = App.Language;

            //Refresh language menu
            LangMenu.Items.Clear();
            foreach (CultureInfo lang in App.Languages)
            {
                MenuItem item = new MenuItem();
                item.Header    = lang.DisplayName;
                item.Tag       = lang;
                item.IsChecked = lang.Equals(currentLang);
                item.Click    += LanguageChange_Click;
                LangMenu.Items.Add(item);
            }
            App.Language = currentLang;
        }
Example #2
0
        public MainWindow()
        {
            InitializeComponent();

            FontFamilyViewModel fontFamilyVM = (FontFamilyViewModel)fontFamilyComboBox.DataContext;

            fontFamilyVM.TextEditor     = richTextBox;
            fontFamilyVM.FontSizeSlider = fontSizeSlider;

            ColorPickerViewModel colorPickerVM = (ColorPickerViewModel)colorPicker.DataContext;

            colorPickerVM.TextEditor = richTextBox;

            FileDialogViewModel fileDialogVM = (FileDialogViewModel)fileDialogMenuItem.DataContext;

            fileDialogVM.TextEditor = richTextBox;
            fileDialogVM.MainWindow = this;

            //App.LanguageChanged += LanguageChanged;
            //CultureInfo currentLang = App.Language;
            ////Refresh language menu
            //LangMenu.Items.Clear();
            //foreach (CultureInfo lang in App.Languages)
            //{
            //    MenuItem item = new MenuItem();
            //    item.Header = lang.DisplayName;
            //    item.Tag = lang;
            //    item.IsChecked = lang.Equals(currentLang);
            //    item.Click += LanguageChange_Click;
            //    LangMenu.Items.Add(item);
            //}
            //App.Language = currentLang;

            DataContext = new MainWindowViewModel(this);

            //Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en");
            //Console.WriteLine(lab4.Resources.Localization.FileMenuItem);
        }