示例#1
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            MEAPSDbEntities  context = new MEAPSDbEntities();
            TabCtrl          t       = context.TabCtrls.First();
            MessageBoxResult result  = MessageBox.Show("Save position?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                t.selectedIndex = tabCtrlMain.SelectedIndex.ToString();
            }
            else
            {
                t.selectedIndex = "0";
            }
            context.SaveChanges();
            Application.Current.Shutdown();
        }
示例#2
0
        public MainWindow()
        {
            InitializeComponent();
            RefreshDataGrids();
            MEAPSDbEntities context = new MEAPSDbEntities();
            TabCtrl         t       = context.TabCtrls.FirstOrDefault();

            if (t == null)
            {
                t = new TabCtrl();
                t.selectedIndex = "0";
                context.TabCtrls.Add(t);
                context.SaveChanges();
            }
            btnLaunchViewer.Visibility = Visibility.Hidden;
            tabCtrlMain.SelectedIndex  = Int32.Parse(t.selectedIndex);
        }