public IFCConvertViewModel(IDialogCoordinator iDialogCoordinator) { // Commands SourceLocationAccessCommand = new SimpleDelegateCommand(AccessSourceLocation, () => true); DestinationLocationAccessCommand = new SimpleDelegateCommand(AccessDestinationLocation, () => true); ConvertCommand = new SimpleDelegateCommand(ConvertFiles, () => true); RadioButtonCommand = new SimpleDelegateCommand(RadioButtonClick, () => true); // Services ioService = new IOService(); iFCConversionService = new IFCConversionService(); IDialogCoordinator = iDialogCoordinator; settingsService = new SettingsService(); // Assignments DestinationType = DestinationLocationType.Local; IsDestinationFilePickerVisible = true; IsAWSDetailsControlVisible = false; // Subscribe to event handlers in the service layer iFCConversionService.ProcessingException += IFCProcessingException; iFCConversionService.TotalFiles += IFCTotalFiles; iFCConversionService.RemainingFiles += IFCRemainingFiles; iFCConversionService.RemainingModels += IFCRemainingModels; }
public TabViewModel(ITabViewModelManager tabViewModelManager, IValidatorViewModelFactory validatorViewModelFactory) { _tabViewModelManager = tabViewModelManager; CloseTabCommand = new SimpleDelegateCommand(CloseTab); _name = $"New Tab {_tabViewModelManager.Count + 1}"; Content = validatorViewModelFactory.CreateValidatorViewModel(tabViewModelManager); }
public ConfigureAwaitSamplePage() { Title = "ConfigureAwait"; Page = typeof(ConfigureAwaitPage); LoadImagesCommand = new SimpleDelegateCommand(LoadImages); Cats = new ObservableCollection <Cat>(); }
public TabViewModelManager(ITabViewModelFactory tabViewModelFactory) { _tabViewModelFactory = tabViewModelFactory; _tabs = new ObservableCollection <ITabViewModel>(); Tabs = new ReadOnlyObservableCollection <ITabViewModel>(_tabs); CreateNewTab(); CreateNewTabCommand = new SimpleDelegateCommand(CreateNewTab); }
static MyCommands() { AddEppCommand = new SimpleDelegateCommand(p => { var menuItem = p as MenuItem; //Console.WriteLine(e.OriginalSource.ToString()); //Console.WriteLine(e.Source.ToString()); Console.WriteLine("EP"); }); }
public MainViewModel(string connectionString, string hubName) { ConnectionString = connectionString; HubName = hubName; HistoryItems = new ObservableCollection <Models.HistoryItem>(); Registrations = new ObservableCollection <RegistrationViewModel>(); RegistrationTags = new ObservableCollection <string>(); GetRegistrationsCommand = new SimpleDelegateCommand(GetRegistrationsAsync); SendNotificationCommand = new SimpleDelegateCommand(SendNotificationAsync); DeleteRegistrationsCommand = new SimpleDelegateCommand(DeleteRegistrationsAsync); LoadHistory(); }
public WhenAllSamplePage() { Title = "WhenAll - Running multiple tasks at once"; Page = typeof(WhenAllPage); GetHotelRatesCommand = new SimpleDelegateCommand(GetHotelRates); HotelRates = new ObservableCollection <HotelRate>(); _pricelineClient = new PricelineClient(); _kayakClient = new KayakClient(); _travelocityClient = new TravelocityClient(); _hotwireClient = new HotwireClient(); _expediaClient = new ExpediaClient(); }
public EgsDeviceFirmwareUpdateModel(EgsDevice device, Version deviceFirmwareVersion) { Trace.Assert(device != null); Trace.Assert(deviceFirmwareVersion != null); Device = device; FirmwareVersionInDevice = deviceFirmwareVersion; RatioOfSendingImageFileInUpdatingByOneFile = 80; FileSelectionCommand = new SimpleDelegateCommand(); FileSelectionCommand.CanPerform = true; FileSelectionCommand.PerformEventHandler += delegate { SelectFiles(); }; StartOrCancelCommand = new SimpleDelegateCommand(); StartOrCancelCommand.CanPerform = true; StartOrCancelCommand.PerformEventHandler += delegate { if (IsBusy) { CancelAsync(); } else { StartAsync(); } }; ProgressReport = new BackgroundWorker() { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; ProgressReport.DoWork += delegate { LastResult = DoWorkInternal(); }; ProgressReport.RunWorkerCompleted += delegate { IsBusy = false; }; IsBusy = false; IsCanceled = false; LastResult = new EgsDeviceFirmwareUpdateResult(true, false, false, ""); FirmwareImageFilePathList = new List <string>(); IsToShowWarningMessages = false; }
public MainViewModel(IWindowService windowService, PlayerManager playerManager, ViewManager viewManager) { _windowService = windowService; _viewManager = viewManager; Execute.InitializeWithDispatcher(); ExitApplication = new SimpleDelegateCommand(ExitApplicationAction); ShowSettings = new SimpleDelegateCommand(ShowSettingsAction); SetWindowPosition(); playerManager.RegisterPlayers("players"); viewManager.RegisterViews("views"); RegisterEvents(); SetViewMode(Properties.Settings.Default.ViewMode); }
public CameraViewWindowModel() { _WindowState = WindowState.Normal; SetWindowStateToMinimizedDelayTimer = new System.Windows.Threading.DispatcherTimer(); SetWindowStateToMinimizedDelayTimer.Interval = TimeSpan.FromMilliseconds(3000); SetWindowStateToMinimizedDelayTimer.Tick += (sender, e) => { if (IsMouseHovered) { // restart SetWindowStateToMinimizedDelayTimer.Stop(); SetWindowStateToMinimizedDelayTimer.Start(); } else { IsNormalOrElseMinimized = false; } }; IsDragging = false; IsMouseHovered = false; WindowStateHostApplicationsControlMethod = new CameraViewWindowStateHostApplicationsControlMethodOptions(); WindowStateUsersControlMethod = new CameraViewWindowStateUsersControlMethodOptions(); MinimizeCommand = new SimpleDelegateCommand(); SettingsCommand = new SimpleDelegateCommand(); ExitCommand = new SimpleDelegateCommand(); _CanDragMove = ApplicationCommonSettings.IsDebugging; _CanResize = ApplicationCommonSettings.IsDebugging; _Topmost = !(ApplicationCommonSettings.IsDebugging); _CanShowMenu = true; WindowStateHostApplicationsControlMethod.Value = CameraViewWindowStateHostApplicationsControlMethods.UseUsersControlMethods; WindowStateUsersControlMethod.Value = CameraViewWindowStateUsersControlMethods.ManualOnOff; WindowStateHostApplicationsControlMethod.ValueUpdated += delegate { StartCheckingIsShowingCameraViewWindow(); }; WindowStateUsersControlMethod.ValueUpdated += delegate { StartCheckingIsShowingCameraViewWindow(); }; MinimizeCommand.PerformEventHandler += delegate { ToggleWindowStateControlMethodOnAutoOrOff(); }; }
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; } }
public ValidatorViewModel(ITabViewModelManager tabViewModelManager, IRecentFilesManager recentFiles, IPmmlValidator pmmlValidator, IOpenFileDialogService openFileDialogService, IGetFileNameService getFileNameService) { _tabViewModelManager = tabViewModelManager; _pmmlValidator = pmmlValidator; _openFileDialogService = openFileDialogService; _getFileNameService = getFileNameService; _recentFiles = recentFiles; BrowseFileCommand = new SimpleDelegateCommand(BrowseFile); ValidateCommand = new SimpleDelegateCommand(ValidateFile, CanValidate); _errorMessages = new ObservableCollection <IErrorMessage>(); ErrorMessages = new ReadOnlyObservableCollection <IErrorMessage>(_errorMessages); _outputWindowMessages = new ObservableCollection <string>(); OutputWindowMessages = new ReadOnlyObservableCollection <string>(_outputWindowMessages); }
public TextfileProcessingViewModel(IDialogCoordinator iDialogCoordinator) { // Commands SourceLocationAccessCommand = new SimpleDelegateCommand(AccessSourceLocation, () => true); DestinationLocationAccessCommand = new SimpleDelegateCommand(AccessDestinationLocation, () => true); ProcessCommand = new SimpleDelegateCommand(ProcessFiles, () => true); RadioButtonCommand = new SimpleDelegateCommand(RadioButtonClick, () => true); // Services ioService = new IOService(); textfileProcessingService = new TextfileProcessingService(); settingsService = new SettingsService(); IDialogCoordinator = iDialogCoordinator; // Assignments DestinationType = DestinationLocationType.Local; IsDestinationFilePickerVisible = true; // Subscribe to event handlers in the service layer textfileProcessingService.ProcessingException += TextfileProcessingException; textfileProcessingService.TotalFiles += TotalTextFiles; textfileProcessingService.RemainingFiles += RemainingFilesTextFiles; }
public EgsHostOnUserControl() { Device = EgsDevice.GetDefaultEgsDevice(); CultureInfoAndDescription = new CultureInfoAndDescriptionOptions(); MouseCursorPositionUpdatedByGestureCursorMethod = new MouseCursorPositionUpdatedByGestureCursorMethodOptions(); CursorDrawingTimingMethod = new CursorDrawingTimingMethodOptions(); CameraViewBordersAndPointersAreDrawnBy = new CameraViewBordersAndPointersAreDrawnByOptions(); CameraViewUserControlModel = new CameraViewUserControlModel(); OnePersonBothHandsViewModel = new OnePersonBothHandsViewModel(); CursorViews = new List <CursorForm>(); DrawingCursorsMinimumIntervalInMilliseconds = 8; drawingCursorsStopwatch = Stopwatch.StartNew(); PrecisionLogger = new TimerPrecisionLogger(); //CultureInfoAndDescription.SelectSingleItemByPredicate(e => e.CultureInfoString == ApplicationCommonSettings.DefaultCultureInfoName); MouseCursorPositionUpdatedByGestureCursorMethod.Value = MouseCursorPositionUpdatedByGestureCursorMethods.None; CursorDrawingTimingMethod.Value = CursorDrawingTimingMethods.ByHidReportUpdatedEvent; CameraViewBordersAndPointersAreDrawnBy.Value = CameraViewBordersAndPointersAreDrawnByKind.HostApplication; WaitTimeTillMouseCursorHideOnMouseMode = TimeSpan.FromSeconds(10); ResetSettingsCommand = new SimpleDelegateCommand(); SaveSettingsToFlashCommand = new SimpleDelegateCommand(); ResetDeviceCommand = new SimpleDelegateCommand(); SendManySettingsPacketsCommand = new SimpleDelegateCommand(); ResetSettingsCommand.CanPerform = true; SaveSettingsToFlashCommand.CanPerform = false; ResetDeviceCommand.CanPerform = false; SendManySettingsPacketsCommand.CanPerform = false; ResetSettingsCommand.PerformEventHandler += delegate { if (MessageBox.Show(Resources.CommonStrings_ResetSettingsConfirmation, Resources.CommonStrings_Confirmation, MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } Reset(); }; SaveSettingsToFlashCommand.PerformEventHandler += delegate { if (MessageBox.Show(Resources.CommonStrings_SaveSettingsToFlashConfirmation, Resources.CommonStrings_Confirmation, MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } Device.SaveSettingsToFlash(); }; ResetDeviceCommand.PerformEventHandler += delegate { if (MessageBox.Show(Resources.CommonStrings_ResetDeviceConfirmation, Resources.CommonStrings_Confirmation, MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } Device.ResetDevice(); }; SendManySettingsPacketsCommand.PerformEventHandler += delegate { SendManySettingsPacketsAsync(); }; Device.IsHidDeviceConnectedChanged += Device_IsHidDeviceConnectedChanged; // NOTE: The next 2 lines are necessary. SaveSettingsToFlashCommand.CanPerform = Device.IsHidDeviceConnected; ResetDeviceCommand.CanPerform = Device.IsHidDeviceConnected; SendManySettingsPacketsCommand.CanPerform = Device.IsHidDeviceConnected; CursorDrawingTimingMethod.ValueUpdated += delegate { OnCursorDrawingTimingMethod_SelectedItemChanged(); }; CameraViewBordersAndPointersAreDrawnBy.ValueUpdated += CameraViewBordersAndPointersAreDrawnBy_SelectedItemChanged; CultureInfoAndDescription.ValueUpdated += delegate { BindableResources.Current.ChangeCulture(CultureInfoAndDescription.Value); }; // TODO: MUSTDO: When users cancel DFU, exceptions occur in Timer thread basically, // and the app cannot deal with them. // So it is necessary to attach them to event handlers. // The design of EgsDevicesManager is not completed. So I don't think this is good way. EgsDevice.DefaultEgsDevicesManager.Disposing += delegate { if (false && ApplicationCommonSettings.IsDebuggingInternal) { Debugger.Break(); } this.Dispose(); }; }
public RecentFileViewModel(string location, IRecentFilesManager recentFilesManager) { _recentFilesManager = recentFilesManager; LoadRecentFileCommand = new SimpleDelegateCommand(LoadRecentFile); _location = location; }
public ButtonModelBase() { Command = new SimpleDelegateCommand(); Command.PerformEventHandler += (sender, e) => { OnCommandRaised(EventArgs.Empty); }; }