Example #1
0
        /// <summary>
        /// Initializes a new instance of the MainWindow class.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            Closing += (s, e) => ViewModelLocator.Cleanup();

            _instance = this;

            // Loading user preferences
            var userPrefs = UserPreferences.Instance;
            this.Width = userPrefs.WindowWidth;
            this.Height = userPrefs.WindowHeight;
            this.Top = userPrefs.WindowTop;
            this.Left = userPrefs.WindowLeft;
            this.WindowState = userPrefs.WindowState;
            this.EditText1.FontSize = userPrefs.FontSize;
            this.EditText1.FontFamily = new FontFamily(userPrefs.FontFamily);
            this.EditText1.SelectionBrush = Brushes.DodgerBlue;
            this.StatusBar1.Visibility = userPrefs.ShowStatusbar ? Visibility.Visible : Visibility.Collapsed;
            this.MenuItemStatusBarVisible.IsChecked = userPrefs.ShowStatusbar;

            _initializeMessenger();

            //
            AddHandler(Keyboard.KeyUpEvent, (KeyEventHandler)HandleKeyUpEvent);
        }
Example #2
0
        public Findwindow(MainWindow mainwin)
        {
            _main = mainwin;
            _editText = _main.EditText1;

            InitializeComponent();

            // for window odality operation
            ownerHandle = (new System.Windows.Interop.WindowInteropHelper(mainwin)).Handle;
            handle = (new System.Windows.Interop.WindowInteropHelper(this)).Handle;
            EnableWindow(handle, true);
            SetForegroundWindow(handle);

            // initial setting
            TextToFind.Focus();
            DirectionDown.IsChecked = true;
        }