public MainWindow() { bool createdNew = true; mutex = new Mutex(true, "Gees", out createdNew); if (!createdNew) { System.Windows.MessageBox.Show("App is already running.\nCheck your system tray.", "Gees", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); return; } this.DataContext = viewModel; InitializeComponent(); //SYSTEM TRAY notifyIcon.Icon = Properties.Resources.icon; notifyIcon.Visible = true; notifyIcon.MouseClick += notifyIcon_MouseClick; //POSITION var desktopWorkingArea = System.Windows.SystemParameters.WorkArea; this.Left = desktopWorkingArea.Right - this.Width - 10; this.Top = desktopWorkingArea.Bottom - this.Height - 10; //UPDATER backgroundWorkerUpdate.DoWork += backgroundWorkerUpdate_DoWork; backgroundWorkerUpdate.RunWorkerAsync(); //CONNECTIONS timerConnection.Interval = new TimeSpan(0, 0, 0, 0, 100); timerConnection.Tick += timerConnection_Tick; backgroundConnector.DoWork += backgroundConnector_DoWork; timerConnection.Start(); //SIMCONREADER timerRead.Interval = new TimeSpan(0, 0, 0, 0, SAMPLE_RATE); timerRead.Tick += timerRead_Tick; timerWait.Interval = new TimeSpan(0, 0, 0, 0, WAIT_AFTER_LANDING); timerWait.Tick += timerWait_Tick; fsConnect.FsDataReceived += HandleReceivedFsData; definition.Add(new SimProperty("TITLE", null, SIMCONNECT_DATATYPE.STRING256)); definition.Add(new SimProperty("SIM ON GROUND", "Bool", SIMCONNECT_DATATYPE.INT32)); definition.Add(new SimProperty("AIRCRAFT WIND X", "Knots", SIMCONNECT_DATATYPE.FLOAT64)); definition.Add(new SimProperty("AIRCRAFT WIND Z", "Knots", SIMCONNECT_DATATYPE.FLOAT64)); definition.Add(new SimProperty("AIRSPEED INDICATED", "Knots", SIMCONNECT_DATATYPE.FLOAT64)); definition.Add(new SimProperty("GROUND VELOCITY", "Knots", SIMCONNECT_DATATYPE.FLOAT64)); definition.Add(new SimProperty("VELOCITY BODY X", "Feet per second", SIMCONNECT_DATATYPE.FLOAT64)); definition.Add(new SimProperty("VELOCITY BODY Z", "Feet per second", SIMCONNECT_DATATYPE.FLOAT64)); definition.Add(new SimProperty("G FORCE", "GForce", SIMCONNECT_DATATYPE.FLOAT64)); definition.Add(new SimProperty("PLANE TOUCHDOWN NORMAL VELOCITY", "Feet per second", SIMCONNECT_DATATYPE.FLOAT64)); //SHOW LRM winLRM = new LRMDisplay(viewModel); winLRM.Show(); }