private void Window_Closing(object sender, CancelEventArgs e)
        {
            var userPrefs = new UserPreferences
            {
                WindowHeight = Height,
                WindowWidth  = Width,
                WindowTop    = Top,
                WindowLeft   = Left,
                WindowState  = WindowState
            };

            Settings.Default.IDStaff = null;

            userPrefs.Save();
        }
        public MainWindow()
        {
            InitializeComponent();
            sp = new SmartCardOperation();

            //MessageBox.Show(Properties.Settings.Default.IDStaff);
            //MessageBox.Show(Application.Current.Windows.Count.ToString());

            var userPrefs = new UserPreferences();

            Height      = userPrefs.WindowHeight;
            Width       = userPrefs.WindowWidth;
            Top         = userPrefs.WindowTop;
            Left        = userPrefs.WindowLeft;
            WindowState = userPrefs.WindowState;
        }