void OnPortalClosing(object sender, CancelEventArgs e) { CameraDevice device = ((CameraPortal)sender).SelectedDevice; if (device != null) { try { ShowDevice(device); } catch (Exception ex) { Logger.Error(this, "Unable to open camera window", ex); } } }
void IRunnableModule.Start() { try { CameraDevice device = JSON.Read <CameraDevice>(context.Settings.Get <string>(this, "lastdevice")); if (device != null) { ShowDevice(device); } } catch (Exception e) { } context.GetModuleByKey <IMainWindow>(ModuleKeys.MainWindow).AddMenuItem("Display.Camera", (sender, args) => { CameraPortal portal = new CameraPortal(); portal.Closing += OnPortalClosing; portal.ShowDialog(); }); }
private void OnCameraClosed(object sender, EventArgs e) { context.Settings.Set(this, "lastdevice", null); current = null; currentprocess = null; }