예제 #1
0
        public MainWindow()
        {
            InitializeComponent();

            DataContext           = this;
            lst_Files.DataContext = lvm;

            // load preferences
            var rprefs = new ReestrPreferences();

            this.SaveChoice = rprefs.SaveChoice;
            if (rprefs.SaveChoice)
            {
                this.Path     = rprefs.Path;
                this.selected = rprefs.Selected;
                ReadFolder(this.Path);
            }

            var uprefs = new UserPreferences();

            this.Height      = uprefs.WindowHeight;
            this.Width       = uprefs.WindowWidth;
            this.Top         = uprefs.WindowTop;
            this.Left        = uprefs.WindowLeft;
            this.WindowState = uprefs.WindowState;
        }
예제 #2
0
        private void Window_Closing(object sender, CancelEventArgs e)
        {
            MessageBoxResult ret = MessageBoxResult.Yes;

            // файл  был изменен
            if (!string.IsNullOrEmpty(state))
            {
                ret = MessageBox.Show("Модели были изменены.\nВсе равно закрыть?", "ModelEditor", MessageBoxButton.YesNo, MessageBoxImage.Question);
            }

            if (ret == MessageBoxResult.No)
            {
                e.Cancel = true;
            }

            CancelTasks();

            var rprefs = new ReestrPreferences
            {
                Path       = this.Path,
                SaveChoice = this.SaveChoice,
                Selected   = lst_Files.SelectedIndex
            };

            rprefs.Save();

            var uprefs = new UserPreferences
            {
                WindowLeft   = this.Left,
                WindowTop    = this.Top,
                WindowWidth  = this.Width,
                WindowHeight = this.Height,
                WindowState  = this.WindowState
            };

            uprefs.Save();
        }