예제 #1
0
        private void WindowManagerEventHandler(string eventString)
        {
            switch (eventString)
            {
            case "ShowSendCommandsWindow":
                if (SendCommandsWindow == null)
                {
                    if (PediatricSensorData.DebugMode)
                    {
                        DebugLog.Enqueue("Window Manager: Creating new Send Commands window");
                    }
                    SendCommandsWindow          = new SendCommandsWindow();
                    SendCommandsWindow.Closing += SendCommandsWindowOnClosing;
                    SendCommandsWindow.Closed  += SendCommandsWindowOnClosed;
                    SendCommandsWindow.Show();
                }
                else
                {
                    if (PediatricSensorData.DebugMode)
                    {
                        DebugLog.Enqueue("Window Manager: Showing existing Send Commands window");
                    }
                    SendCommandsWindow.WindowState = WindowState.Normal;
                    SendCommandsWindow.Focus();
                }
                break;

            case "ShowPlotWindow":
                if (PlotWindow == null)
                {
                    if (PediatricSensorData.DebugMode)
                    {
                        DebugLog.Enqueue("Window Manager: Creating new Plot Window");
                    }
                    PlotWindow          = new PlotWindow();
                    PlotWindow.Closing += PlotWindowOnClosing;
                    PlotWindow.Closed  += PlotWindowOnClosed;
                    PlotWindow.Show();
                }
                else
                {
                    if (PediatricSensorData.DebugMode)
                    {
                        DebugLog.Enqueue("Window Manager: Showing existing Plot Window");
                    }
                    PlotWindow.WindowState = WindowState.Normal;
                    PlotWindow.Focus();
                }
                break;

            case "ClosePlotWindow":
                if (PlotWindow != null)
                {
                    App.Current.Dispatcher.Invoke(() => PlotWindow.Close());
                }
                break;

            default:
                break;
            }
        }
예제 #2
0
 private void SendCommandsWindowOnClosed(object sender, EventArgs e)
 {
     App.Current.Dispatcher.Invoke(() => SendCommandsWindow = null);
 }