public QuadDataProcessing(MainWindow mainWindow, QuadControlWindow quadControlWindow)
        {
            this.mainWindow = mainWindow;
            this.quadControlWindow = quadControlWindow;

            for (int i = 0; i < 3; ++i)
            {
                smooth[i] = new MovingAverageDataSmoothing(45);
                calibrateData[i] = new List<double>();
            }

            StillData = new int[] { DEFAULT_STILL_X, DEFAULT_STILL_Y, DEFAULT_STILL_Z };
            Speed = 0.03f;
            timeCounter = 0;

            startQuadcopter = false;
        }
        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 btnQuadControl_Click(object sender, RoutedEventArgs e)
        {
            if (Application.Current.Windows.OfType<MouseControlWindow>().Count() != 0)
                return;

            if (Application.Current.Windows.OfType<QuadControlWindow>().Count() == 0)
                quadControlWindow = new QuadControlWindow(this);

            quadControlWindow.Show();
            quadControlWindow.Activate();
        }