public EgsHostAppBaseComponents() : base() { _IsToStartTutorialWhenHostApplicationStart = true; CameraViewWindowModel = new CameraViewWindowModel(); CameraViewWindow = new CameraViewWindow(); SettingsWindow = new SettingsWindow(); AppTrayIconAndMenuItems = new AppTrayIconAndMenuItemsComponent(); StartTutorialCommand = new SimpleDelegateCommand(); CheckForEgsHostAppCoreUpdateCommand = new SimpleDelegateCommand(); UpdateDeviceFirmwareCommand = new SimpleDelegateCommand(); CheckForEgsHostAppCoreUpdateCommand.PerformEventHandler += delegate { CheckForApplicationUpdate(); }; UpdateDeviceFirmwareCommand.PerformEventHandler += delegate { if (ApplicationCommonSettings.IsInternalRelease) { try { StartDeviceFirmwareUpdate(); } catch (EgsHostApplicationIsClosingException) { return; } } else { MessageBox.Show("This function is used in internal release."); } }; CheckForEgsHostAppCoreUpdateCommand.CanPerform = true; UpdateDeviceFirmwareCommand.CanPerform = false; DeviceFirmwareUpdateCondition = DeviceFirmwareUpdateConditions.UpdateIfOldForEndUsers; if (ApplicationCommonSettings.IsInternalRelease) { DeviceFirmwareUpdateCondition = DeviceFirmwareUpdateConditions.DoNotUpdateToTestOldFirmwares; } if (false) { DeviceFirmwareUpdateCondition = DeviceFirmwareUpdateConditions.AlwaysUpdateForDebugging; } }
protected override void ResetSettings() { base.ResetSettings(); CameraViewWindowModel.Reset(); }
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; }