Пример #1
0
 protected override void OnWindowStatePropertyChanged(Xceed.Wpf.Toolkit.WindowState oldValue, Xceed.Wpf.Toolkit.WindowState newValue)
 {
     base.OnWindowStatePropertyChanged(oldValue, newValue);
     if (newValue == Xceed.Wpf.Toolkit.WindowState.Open)
     {
         Focus(FindName("FocusBox"));
     }
 }
Пример #2
0
        protected override void OnWindowStatePropertyChanged(Xceed.Wpf.Toolkit.WindowState oldValue, Xceed.Wpf.Toolkit.WindowState newValue)
        {
            base.OnWindowStatePropertyChanged(oldValue, newValue);

            updateButtons(false);
            lblTime.Text            = TimeSpan.Zero.ToString();
            chkStartTimer.IsChecked = UserContext.Current.Settings.GuiState.StartTimerAfterOpeningWindow;
            if (newValue == Xceed.Wpf.Toolkit.WindowState.Open)
            {
                DialogResult = null;
                if (UserContext.Current.Settings.GuiState.StartTimerAfterOpeningWindow)
                {
                    startTimer();
                }
            }
        }
Пример #3
0
        // Blocking wait implementation in the UI without freezing it: http://stackoverflow.com/questions/33002966/wpf-dispatcherframe-magic-how-and-why-this-works
        protected void wait()
        {
            DispatcherFrame f = new DispatcherFrame(); //At application shutdown, all frames are requested to exit.

            ThreadPool.QueueUserWorkItem(State =>
            {
                Xceed.Wpf.Toolkit.WindowState s = Xceed.Wpf.Toolkit.WindowState.Open;
                while (s == Xceed.Wpf.Toolkit.WindowState.Open)
                {
                    Dispatcher.Invoke(new Action(() =>
                    {
                        s = WindowState;
                    }));
                }
                f.Continue = false;
            });
            Dispatcher.PushFrame(f);
        }