public override void InitializeOnceAtStartup() { base.InitializeOnceAtStartup(); CameraViewWindowModel.InitializeOnceAtStartup(base.Device); SettingsWindow.InitializeOnceAtStartup(this); CameraViewWindow.InitializeOnceAtStartup(CameraViewWindowModel, CameraViewUserControlModel); AppTrayIconAndMenuItems.InitializeOnceAtStartup(this); CameraViewWindowModel.SettingsCommand.PerformEventHandler += (sender, e) => { SettingsWindow.ToggleVisibility(); }; CameraViewWindowModel.ExitCommand.PerformEventHandler += (sender, e) => { if (false) { var message = string.Format(CultureInfo.InvariantCulture, Resources.CommonStrings_WouldYouExitApplication0, ApplicationCommonSettings.HostApplicationName); if (MessageBox.Show(message, Resources.CommonStrings_Confirmation, MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } } this.Dispose(); }; // do nothing CameraViewWindowModel.CanDragMoveChanged += delegate { }; CameraViewWindowModel.CanResizeChanged += delegate { OnCanResizeCameraViewWindowChanged(); }; OnCanResizeCameraViewWindowChanged(); Device.IsHidDeviceConnectedChanged += Device_IsHidDeviceConnectedChanged; // NOTE: Update is necessary here, too. if (ApplicationCommonSettings.IsInternalRelease) { UpdateDeviceFirmwareCommand.CanPerform = Device.IsHidDeviceConnected ? true : false; } CultureInfoAndDescription.ValueUpdated += delegate { SettingsWindow.ReloadDataContext(); CameraViewWindow.ReloadDataContext(); }; if (false) { CameraViewWindow.Closed += delegate { if (IsToDisposeThisWhenCameraViewWindowClosed) { CameraViewWindow = null; // TODO: MUSTDO: Application does not exit, if users click "close window" on the icon of CameraView on the task bar!! this.Dispose(); } }; } if (ApplicationCommonSettings.IsDebugging) { SettingsWindow.Show(); } IsToDisposeThisWhenCameraViewWindowClosed = true; }