private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { this.Receiver.Exit(); this.Bebop2.Disconnect(); this.Patrol.Stop(); OYOKeysHook.Unset(); this._mutex.Close(); this.Recorder.Release(); this.saveConfig("config.json"); this.LeapController.FrameReady -= this.mainView.mainConnectionView.LeapController_FrameReady; this.LeapController.FrameReady -= this.defaultView.sideExpandedBar.leapmotionTab.LeapController_FrameReady; this.LeapController.FrameReady -= this.LeapController_FrameReady; this._wstream.Close(); }
private void MainForm_Load(object sender, EventArgs e) { this.Receiver.OnConnected += this.defaultView.Receiver_OnConnectionChanged; this.Receiver.OnConnected += this.defaultView.sideExpandedBar.visualizeTab.Receiver_OnConnectionChanged; this.Receiver.OnConnected += this.mainView.mainConnectionView.Receiver_OnConnectionChanged; this.Receiver.OnConnected += this.defaultView.sideExpandedBar.droneTab.Receiver_OnConnectionChanged; this.Receiver.OnDisconnected += this.Receiver_OnDisconnected; this.Receiver.OnDisconnected += this.defaultView.Receiver_OnConnectionChanged; this.Receiver.OnDisconnected += this.defaultView.sideExpandedBar.visualizeTab.Receiver_OnConnectionChanged; this.Receiver.OnDisconnected += this.defaultView.sideExpandedBar.detectFireTab.Receiver_OnDisconnected; this.Receiver.OnDisconnected += this.mainView.mainConnectionView.Receiver_OnConnectionChanged; this.Receiver.OnDisconnected += this.defaultView.sideExpandedBar.droneTab.Receiver_OnConnectionChanged; this.Receiver.OnUpdate += this.Receiver_OnUpdate; this.Receiver.OnError += this.Receiver_OnError; this.Detector.OnEnabledChanged += this.defaultView.sideExpandedBar.detectFireTab.Detector_OnNotificationChanged; this.Detector.OnNotificationChanged += this.defaultView.sideExpandedBar.detectFireTab.Detector_OnNotificationChanged; this.Detector.OnDetectionStateChanged += this.defaultView.sideExpandedBar.detectFireTab.Detector_OnDetectionStateChanged; this.Recorder.OnIncreasedTime += this.defaultView.sideExpandedBar.droneTab.Recorder_OnIncreasedTime; this.Overlayer.ReceiveAddress += this.defaultView.Overlayer_OnReceiveAddressEvent; this.Overlayer.ReceiveAddress += this.mainView.mainConnectionView.Overlayer_OnReceiveAddressEvent; this.Bebop2.OnConnected += this.mainView.mainConnectionView.Bebop_OnConnectionChanged; this.Bebop2.OnConnected += this.defaultView.sideExpandedBar.droneTab.Bebop_OnConnectionChanged; this.Bebop2.OnDisconnected += this.mainView.mainConnectionView.Bebop_OnConnectionChanged; this.Bebop2.OnDisconnected += this.defaultView.sideExpandedBar.droneTab.Bebop_OnConnectionChanged; this.Bebop2.OnStreaming += this.Bebop2_OnStreaming; this.Bebop2.OnRequestPcmd += this.Bebop2_OnRequestPcmd; this.Bebop2.OnSpeedChanged += this.defaultView.Bebop2_OnSpeedChanged; this.Bebop2.OnAltitudeChanged += this.defaultView.Bebop2_OnAltitudeChanged; this.Bebop2.OnPositionChanged += this.Bebop_OnPositionChanged; this.Bebop2.OnRotationChanged += this.Bebop2_OnRotationChanged; this.Bebop2.OnError += this.Bebop_OnError; this.Bebop2.OnBatteryChanged += this.defaultView.Bebop2_OnBatteryChanged; this.Bebop2.OnWifiChanged += this.defaultView.Bebop2_OnWifiChanged; this.Bebop2.OnPositionChanged += this.mainView.mainConnectionView.Bebop2_OnPositionChanged; this.Bebop2.OnPositionChanged += this.defaultView.sideExpandedBar.autoFlyingTab.Bebop2_OnPositionChanged; this.LeapController.Connect += this.mainView.mainConnectionView.LeapController_Device; this.LeapController.Connect += this.defaultView.sideExpandedBar.leapmotionTab.LeapController_Device; this.LeapController.Disconnect += this.mainView.mainConnectionView.LeapController_DeviceLost; this.LeapController.Disconnect += this.defaultView.sideExpandedBar.leapmotionTab.LeapController_Disconnect; this.LeapController.FrameReady += this.LeapController_FrameReady; this.LeapController.FrameReady += this.mainView.mainConnectionView.LeapController_FrameReady; this.LeapController.FrameReady += this.defaultView.sideExpandedBar.leapmotionTab.LeapController_FrameReady; this.OnFrameUpdated += this.defaultView.OnFrameUpdated; this.OnFrameUpdated += this.defaultView.sideExpandedBar.detectFireTab.OnFrameUpdated; this.OnScreenStateChanged += this.mainView.OnScreenStateChanged; this.OnScreenStateChanged += this.mainView.mainConnectionView.OnScreenStateChanged; this.Patrol.Reader.OnChanged += this.PatrolReader_OnChanged; this.Patrol.Reader.OnExit += this.PatrolReader_OnExit; this.AutoFlight.OnStart += this.defaultView.sideExpandedBar.autoFlyingTab.AutoFlight_OnStart; this.AutoFlight.OnPause += this.defaultView.sideExpandedBar.autoFlyingTab.AutoFlight_OnPause; this.AutoFlight.OnPause += this.AutoFlight_OnStop; this.AutoFlight.OnStop += this.defaultView.sideExpandedBar.autoFlyingTab.AutoFlight_OnStop; this.AutoFlight.OnStop += this.AutoFlight_OnStop; this.AutoFlight.OnLookNextDestination += this.defaultView.sideExpandedBar.autoFlyingTab.AutoFlight_OnLookNextDestination; this.AutoFlight.OnComplete += this.defaultView.sideExpandedBar.autoFlyingTab.AutoFlight_OnComplete; this.AutoFlight.OnComplete += this.AutoFlight_OnStop; OYOKeysHook.OnKeyboardHook += this.OnKeyboardHook; OYOKeysHook.Set(); this.OnScreenStateChanged.Invoke(this.Size, false); this.loadConfig("config.json"); this._stopwatch.Start(); this._detectedWatcher.Start(); this._wstream = new StreamWriter("alt.txt", false); }