public MainWindow()
        {
            Globals.graphManager = new GraphManager(this);
            viewModel = new MainWindowModel(Globals.graphManager.axes, Globals.graphManager.series);
            DataContext = viewModel;

            InitializeComponent();

            this.Title = PROGRAM_TITLE;

            txtMinY.Text = GraphManager.DEFAULT_MIN_Y.ToString();
            txtMaxY.Text = GraphManager.DEFAULT_MAX_Y.ToString();
            checkDynamicYScaling.IsChecked = false;

            txtRangeX.Text = GraphManager.DEFAULT_RANGE_X.ToString();

            btnConnect.Click += btnConnect_Click;
            btnClearLog.Click += btnClearLog_Click;
            btnDefaultConfig.Click += btnDefaultConfig_Click;
            btnSetRangeY.Click += btnSetRangeY_Click;
            btnSetRangeX.Click += btnSetRangeX_Click;

            this.Closed += MainWindow_Closed;

            checkShowDataInDebug.Checked += checkShowDataInLog_Checked;
            checkShowDataInDebug.Unchecked += checkShowDataInLog_Checked;

            checkShowGraph.Checked += checkShowGraph_Checked;
            checkShowGraph.Unchecked += checkShowGraph_Checked;

            checkDynamicYScaling.Checked += checkDynamicYScaling_Checked;
            checkDynamicYScaling.Unchecked += checkDynamicYScaling_Checked;

            checkX.Tag = 0;
            checkY.Tag = 1;
            checkZ.Tag = 2;
            checkX.Checked += checkSensorData_Checked;
            checkX.Unchecked += checkSensorData_Checked;
            checkY.Checked += checkSensorData_Checked;
            checkY.Unchecked += checkSensorData_Checked;
            checkZ.Checked += checkSensorData_Checked;
            checkZ.Unchecked += checkSensorData_Checked;

            Globals.phoneListener = new PhoneListener(this);

            mouseControlWindow = null;
            quadControlWindow = null;

            LoadConfiguration();
        }
        private void btnMouseControl_Click(object sender, RoutedEventArgs e)
        {
            if (Application.Current.Windows.OfType<QuadControlWindow>().Count() != 0)
                return;

            if (Application.Current.Windows.OfType<MouseControlWindow>().Count() == 0)
                mouseControlWindow = new MouseControlWindow();

            mouseControlWindow.Show();
            mouseControlWindow.Activate();
        }