/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class. /// </summary> public MainWindowViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, ILanguageService languageService) : base() { _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _languageService = languageService; AvailableLanguages = new ObservableCollection<Language>(); AvailableLanguages.Add(new Language("English", "en-US")); AvailableLanguages.Add(new Language("Chinese (simplified)", "zh-HANS")); AvailableLanguages.Add(new Language("Dutch", "nl")); AvailableLanguages.Add(new Language("French", "fr")); AvailableLanguages.Add(new Language("German", "de")); AvailableLanguages.Add(new Language("Spanish", "es")); AvailableLanguages.Add(new Language("Turkish", "tr")); var currentLanguage = (from language in AvailableLanguages where Thread.CurrentThread.CurrentUICulture.Name.StartsWith(language.Code) select language).FirstOrDefault(); SelectedLanguage = currentLanguage ?? AvailableLanguages[0]; DataWindow = new Command(OnDataWindowExecute); PleaseWaitWindow = new Command(OnPleaseWaitWindowExecute); MultipleChoiceWindow = new Command(OnMultipleChoiceWindowExecute); MultiLineInput = new Command(OnMultiLineInputExecute); }
public RibbonViewModel(IRegexService regexService, ICommandManager commandManager, INavigationService navigationService, IConfigurationService configurationService, IUIVisualizerService uiVisualizerService, IWorkspaceManager workspaceManager, IPleaseWaitService pleaseWaitService, IFilterService filterService) { Argument.IsNotNull(() => regexService); Argument.IsNotNull(() => commandManager); Argument.IsNotNull(() => navigationService); Argument.IsNotNull(() => configurationService); Argument.IsNotNull(() => uiVisualizerService); Argument.IsNotNull(() => workspaceManager); Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => filterService); _regexService = regexService; Filter = filterService.Filter; _navigationService = navigationService; _configurationService = configurationService; _uiVisualizerService = uiVisualizerService; _workspaceManager = workspaceManager; _pleaseWaitService = pleaseWaitService; _filterService = filterService; SaveWorkspace = new Command(OnSaveWorkspaceExecute, OnSaveWorkspaceCanExecute); CreateWorkspace = new Command(OnCreateWorkspaceExecute); ShowSettings = new Command(OnShowSettingsExecute); ShowKeyboardMappings = new Command(OnShowKeyboardMappingsExecute); Exit = new Command(OnExitExecute); commandManager.RegisterCommand(Commands.Settings.General, ShowSettings, this); commandManager.RegisterCommand(Commands.File.Exit, Exit, this); Title = AssemblyHelper.GetEntryAssembly().Title(); }
public MainWindowViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService, IDependencyResolver dependencyResolver) { _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; _dependencyResolver = dependencyResolver; }
public AddEditItemViewModel(AddEditItemModel model, IPleaseWaitService pleaseWaitService, IMessageService messageService) { AddEditItem = model; _pleaseWaitService = pleaseWaitService; _messageService = messageService; }
/// <summary> /// Initializes a new instance of the <see cref="MainPageViewModel"/> class. /// </summary> public MainPageViewModel(IPleaseWaitService pleaseWaitService, INavigationService navigationService) { _pleaseWaitService = pleaseWaitService; _navigationService = navigationService; ShowNestedUserControls = new Command(OnShowNestedUserControlsLogicInViewBaseExecute); ShowPleaseWaitWindowViaServiceLocator = new Command(OnShowPleaseWaitWindowViaServiceLocatorExecute); }
public MainWindowViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService, IDependencyResolver dependencyResolver) { this._uiVisualizerService = uiVisualizerService; this._pleaseWaitService = pleaseWaitService; this._messageService = messageService; this._dependencyResolver = dependencyResolver; this.FormsCollection = new FastObservableCollection<Form>(); }
public ContactUsViewModel(ContactUsModel model, IPleaseWaitService pleaseWaitService, IMessageService messageService) { ContactUs = model; _pleaseWaitService = pleaseWaitService; _messageService = messageService; SendCommand = new Command(SendMessage); }
public MainWindowViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService, IOpenFileService openFileService) { _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; _openFileService = openFileService; AddMagnet = new Command(OnAddMagnetExecuteAsync); EditMagnet = new Command(OnEditMagnetExecuteAsync, OnEditMagnetCanExecute); RemoveMagnet = new Command(OnRemoveMagnetExecuteAsync, OnRemoveMagnetCanExecute); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class. /// </summary> public MainWindowViewModel(IPleaseWaitService pleaseWaitService, IUIVisualizerService uiVisualizerService, IMessageService messageService) : base() { _pleaseWaitService = pleaseWaitService; _uiVisualizerService = uiVisualizerService; _messageService = messageService; FirstCommand = new Command(OnFirstCommandExecute); SecondCommand = new Command(OnSecondCommandExecute); ShowWindow = new Command(OnShowWindowExecute); }
public AddAccountViewModel(AddAccountModel model, IPleaseWaitService pleaseWaitService, IMessageService messageService) { AddAccount = model; _messageService = messageService; _pleaseWaitService = pleaseWaitService; CreateAccountCommand = new Command(CreateAccount); }
public DatabaseAccountCleanupViewModel(DatabaseAccountCleanupModel model, IPleaseWaitService pleaseWaitService, IMessageService messageService) { _pleaseWaitService = pleaseWaitService; _messageService = messageService; DatabaseAccountCleanup = model; DeleteCommand = new Command(Delete); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel" /> class. /// </summary> /// <param name="pleaseWaitService">The please wait service.</param> /// <param name="splashScreenService"></param> public MainWindowViewModel(IPleaseWaitService pleaseWaitService, ISplashScreenService splashScreenService) { _pleaseWaitService = pleaseWaitService; _splashScreenService = splashScreenService; IndeterminateCommand = new Command(IndeterminateCommandExecute); ShowProgressCommand = new Command(ShowProgressCommandExecute); ShowProgressWithSplashScreenCommand = new Command(ShowProgressWithSplashScreenCommandExecute); ShowProgressWithSplashScreenDetailedCommand = new Command(ShowProgressWithSplashScreenDetailedCommandExecute); ShowProgressInRegionCommand = new Command(ShowProgressInRegionCommandExecute); ShowProgressWithSplashScreenMoreDetailedCommand = new Command(ShowProgressWithSplashScreenMoreDetailedCommandExecute); }
public EditAccountViewModel(EditAccountModel model, IPleaseWaitService pleaseWaitService, IMessageService messageService) { EditAccount = model; _messageService = messageService; _pleaseWaitService = pleaseWaitService; SaveAccountCommand = new Command(SaveAccount); DeleteAccountCommand = new Command(DeleteAccount); }
public IPManagementViewModel(IPManagementModel model, IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { IPManagement = model; _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; BanIPCommand = new Command(BanIP); UnbanIPCommand = new Command(UnbanIP); }
public AccountManagementViewModel(AccountsManagementModel model, IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { Accounts = model; _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; BanAccountCommand = new Command(BanAccount); UnbanAccountCommand = new Command(UnbanAccount); }
public MainWindowViewModel(ISettings settings, ICrawlerService crawlerService, IPleaseWaitService pleaseWaitService) : base() { Argument.IsNotNull(() => settings); Argument.IsNotNull(() => crawlerService); Argument.IsNotNull(() => pleaseWaitService); _crawlerService = crawlerService; _pleaseWaitService = pleaseWaitService; Settings = settings; AvailableEntries = new ObservableCollection<IEntry>(); }
public PackageCommandService(IPleaseWaitService pleaseWaitService, IRepositoryService repositoryService, IPackageQueryService packageQueryService, IPackageOperationService packageOperationService, IPackageOperationContextService packageOperationContextService) { Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => packageQueryService); Argument.IsNotNull(() => packageOperationService); Argument.IsNotNull(() => packageOperationContextService); _pleaseWaitService = pleaseWaitService; _packageQueryService = packageQueryService; _packageOperationService = packageOperationService; _packageOperationContextService = packageOperationContextService; _localRepository = repositoryService.LocalRepository; }
public MainViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; BooksCollection = new ObservableCollection<Book> { new Book {Title = "Автостопом по галактике", Author = "Дуглас Адамс"}, new Book {Title = "Сто лет одиночества", Author = "Габриель Гарсиа Маркес"}, new Book {Title = "Маленький принц", Author = "Антуан де Сент-Экзюпери"}, new Book {Title = "1984", Author = "Джордж Оруэлл"}, new Book {Title = "Над пропастью во ржи", Author = "Джером Дэвид Сэлинджер"}, }; }
public FindItemViewModel(FindItemModel model, IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { FindItem = model; _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; SearchCommand = new Command(Search); NextPageCommand = new Command(NextPage); PreviousPageCommand = new Command(PreviousPage); OkCommand = new Command(Ok); }
public BackupDatabaseViewModel(BackupDatabaseModel model, IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { BackupDatabase = model; _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; _busy = false; BackupNowCommand = new Command(BackupNow); SaveCommand = new Command(SaveAndClose); }
/// <summary> /// Initializes a new instance of the <see cref="SplashScreenService" /> class. /// </summary> /// <param name="dispatcherService">The dispatcher service.</param> /// <param name="viewModelFactory">The view model factory.</param> /// <param name="uiVisualizerService">The UI visualizer service.</param> /// <param name="pleaseWaitService">The please wait serivce</param> /// <param name="exceptionService">The exception service.</param> /// <exception cref="ArgumentNullException">The <paramref name="dispatcherService" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="viewModelFactory" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="uiVisualizerService" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="pleaseWaitService" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="exceptionService" /> is <c>null</c>.</exception> public SplashScreenService(IDispatcherService dispatcherService, IViewModelFactory viewModelFactory, IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IExceptionService exceptionService) { Argument.IsNotNull(() => dispatcherService); Argument.IsNotNull(() => viewModelFactory); Argument.IsNotNull(() => uiVisualizerService); Argument.IsNotNull(() => exceptionService); _dispatcherService = dispatcherService; _viewModelFactory = viewModelFactory; _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _exceptionService = exceptionService; CloseViewModelOnTerminated = true; }
public SetupWizardViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; Next = new Command <CancelRoutedEventArgs>(NextButtonPressed); Previous = new Command <CancelRoutedEventArgs>(PreviousButtonPressed); Finish = new Command <CancelRoutedEventArgs>(FinishButtonPressed); AuthDB = new Command(SelectAuthDB); CharDB = new Command(SelectCharDB); WorldDB = new Command(SelectWorldDB); DownloadApplyTDBCommand = new Command(DownloadApplyTDB); }
/// <summary> /// Initializes a new instance of the <see cref="ModuleManagerViewModel" /> class. /// </summary> /// <exception cref="System.ArgumentNullException">The <paramref name="moduleCatalog"/> is <c>null</c>.</exception> /// <exception cref="System.ArgumentNullException">The <paramref name="moduleManager"/> is <c>null</c>.</exception> /// <exception cref="System.ArgumentNullException">The <paramref name="pleaseWaitService"/> is <c>null</c>.</exception> public ModuleManagerViewModel(IModuleCatalog moduleCatalog, IModuleManager moduleManager, IPleaseWaitService pleaseWaitService) { Argument.IsNotNull(() => moduleManager); Argument.IsNotNull(() => moduleCatalog); Argument.IsNotNull(() => pleaseWaitService); _moduleManager = moduleManager; _pleaseWaitService = pleaseWaitService; var modules = moduleCatalog.Modules; var moduleTemplates = modules.Select(moduleInfo => new ModuleTemplate(moduleInfo)).OrderBy(template => template.ModuleName); Modules = new ObservableCollection<ModuleTemplate>(moduleTemplates); LoadModuleCommand = new Command<ModuleTemplate>(LoadModuleCommandExecute, LoadModuleCommandCanExecute); }
public PackageCommandService(IPleaseWaitService pleaseWaitService, IRepositoryService repositoryService, IPackageQueryService packageQueryService, IPackageOperationService packageOperationService, IPackageOperationContextService packageOperationContextService, IApiPackageRegistry apiPackageRegistry) { Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => packageQueryService); Argument.IsNotNull(() => packageOperationService); Argument.IsNotNull(() => packageOperationContextService); Argument.IsNotNull(() => apiPackageRegistry); _pleaseWaitService = pleaseWaitService; _packageQueryService = packageQueryService; _packageOperationService = packageOperationService; _packageOperationContextService = packageOperationContextService; _apiPackageRegistry = apiPackageRegistry; _localRepository = repositoryService.LocalRepository; }
/// <summary> /// Initializes a new instance of the <see cref="MainViewModel"/> class. /// </summary> public MainViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService) { _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; ShowWindowLogicInViewBase = new Command(OnShowWindowLogicInViewBaseExecute); ShowWindowLogicInBehavior = new Command(OnShowWindowLogicInBehaviorExecute); ShowNestedUserControlsLogicInViewBase = new Command(OnShowNestedUserControlsLogicInViewBaseExecute); ShowNestedUserControlsLogicInBehavior = new Command(OnShowNestedUserControlsLogicInBehaviorExecute); ShowPleaseWaitWindowViaServiceLocator = new Command(OnShowPleaseWaitWindowViaServiceLocatorExecute); ShowWindowWithBehaviors = new Command(OnShowWindowWithBehaviorsExecute); ShowThrottling = new Command(OnShowThrottlingExecute); }
/// <summary>Initializes a new instance of the <see cref="CollectionDataGridViewModel" /> class.</summary> /// <param name="query">Optional collection query</param> /// <param name="db">Database instance.</param> /// <param name="pleaseWaitService">The please wait service.</param> /// <param name="commandManager">The command manager.</param> public CollectionDataGridViewModel( CollectionQuery query, IDatabaseAsync db, IPleaseWaitService pleaseWaitService, ICommandManager commandManager) : base(false) { Argument.IsNotNull(() => db); Argument.IsNotNull(() => pleaseWaitService); _db = db; _pleaseWaitService = pleaseWaitService; Query = query; DataPager = new DatabaseDataPager <Card>(FilterCollection, 100, db); // Search command SearchCommand = new Command(() => IsDataGridSearchVisible = !IsDataGridSearchVisible); commandManager.RegisterCommand(Commands.General.Search, SearchCommand, this); }
public EntryViewModel(IEntry entry, IPleaseWaitService pleaseWaitService, ICrawlerService crawlerService, IProcessService processService, ISettings settings) { Argument.IsNotNull(() => entry); Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => crawlerService); Argument.IsNotNull(() => processService); Argument.IsNotNull(() => settings); Entry = entry; _pleaseWaitService = pleaseWaitService; _crawlerService = crawlerService; _processService = processService; _settings = settings; OpenInBrowser = new Command(OnOpenInBrowserExecute, OnOpenInBrowserCanExecute); }
public ApplicationOpenProjectCommandContainer( ICommandManager commandManager, IFileService fileService, IProjectManager projectManager, IOpenFileService openFileService, IPleaseWaitService pleaseWaitService, INotificationService notificationService, ILoggerService loggerService) : base(AppCommands.Application.OpenProject, commandManager, projectManager, notificationService, loggerService) { Argument.IsNotNull(() => openFileService); Argument.IsNotNull(() => fileService); Argument.IsNotNull(() => pleaseWaitService); _pleaseWaitService = pleaseWaitService; _openFileService = openFileService; _fileService = fileService; }
protected ProjectCommandContainerBase(string commandName, ICommandManager commandManager, IProjectManager projectManager, INotificationService notificationService, ILoggerService loggerService) : base(commandName, commandManager) { Argument.IsNotNull(() => projectManager); Argument.IsNotNull(() => loggerService); Argument.IsNotNull(() => notificationService); _commandManager = commandManager; _projectManager = projectManager; _logger = loggerService; _notificationService = notificationService; _pleaseWaitService = ServiceLocator.Default.ResolveType <IPleaseWaitService>(); }
public SetupWizardViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; Next = new Command<CancelRoutedEventArgs>(NextButtonPressed); Previous = new Command<CancelRoutedEventArgs>(PreviousButtonPressed); Finish = new Command<CancelRoutedEventArgs>(FinishButtonPressed); AuthDB = new Command(SelectAuthDB); CharDB = new Command(SelectCharDB); WorldDB = new Command(SelectWorldDB); DownloadApplyTDBCommand = new Command(DownloadApplyTDB); }
/// <summary> /// Shows the please wait window using the specific <paramref name="service"/>. /// </summary> /// <param name="service">The service.</param> /// <param name="status">The status.</param> private void ShowPleaseWaitWindow(IPleaseWaitService service, string status) { string determinateFormatString = "Updating item {0} of {1} (" + status + ")"; const int CounterMax = 25; int counter = 0; bool isIndeterminate = IsPleaseWaitIndeterminate; var dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100); dispatcherTimer.Tick += (sender, e) => { bool exit = false; counter++; if (counter >= CounterMax + 1) { exit = true; } else if (!isIndeterminate) { service.UpdateStatus(counter, CounterMax, determinateFormatString); } if (exit) { dispatcherTimer.Stop(); service.Hide(); } }; if (isIndeterminate) { service.Show(status); } else { service.UpdateStatus(1, CounterMax, determinateFormatString); } dispatcherTimer.Start(); }
public MainWindowViewModel(IPleaseWaitService pleaseWaitService, IUIVisualizerService uiVisualizerService, IMessageService messageService, IViewModelFactory viewModelFactory) { Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => uiVisualizerService); Argument.IsNotNull(() => messageService); Argument.IsNotNull(() => viewModelFactory); _pleaseWaitService = pleaseWaitService; _uiVisualizerService = uiVisualizerService; _messageService = messageService; _viewModelFactory = viewModelFactory; FirstCommand = new Command(OnFirstCommandExecute); SecondCommand = new Command(OnSecondCommandExecute); ShowWindow = new Command(OnShowWindowExecute); Title = "Analytics example"; }
/// <summary> /// Hides the please wait service temporarily by storing the show counter and restoring it afterwards. /// </summary> /// <returns>IDisposable.</returns> public static IDisposable HideTemporarily(this IPleaseWaitService pleaseWaitService) { Argument.IsNotNull("pleaseWaitService", pleaseWaitService); var showCounter = pleaseWaitService.ShowCounter; return(new DisposableToken <IPleaseWaitService>(pleaseWaitService, x => x.Instance.Hide(), x => { for (var i = 0; i < showCounter; i++) { if (x.Instance.ShowCounter < showCounter) { x.Instance.Push(); } } })); }
public MainViewModel(IOpenFileService openFileService, ISaveFileService saveFileService, IFileService fileService, IPleaseWaitService pleaseWaitService, IProjectManager projectManager, IOnProjectOperationService projectOperationService, IPackagesUIService packagesUIService) { Argument.IsNotNull(() => openFileService); Argument.IsNotNull(() => saveFileService); Argument.IsNotNull(() => fileService); Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => projectManager); Argument.IsNotNull(() => projectOperationService); Argument.IsNotNull(() => packagesUIService); _openFileService = openFileService; _saveFileService = saveFileService; _fileService = fileService; _pleaseWaitService = pleaseWaitService; _projectManager = projectManager; _projectOperationService = projectOperationService; _packagesUIService = packagesUIService; }
/// <summary> /// Initializes a new instance of the <see cref="ShellViewModel"/> class. /// </summary> public ShellViewModel(ILogAnalyzerService logAnalyzerService, IFileWatcherService fileWatcherService, IDispatcherService dispatcherService, IOpenFileService openFileService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { _logAnalyzerService = logAnalyzerService; _fileWatcherService = fileWatcherService; _dispatcherService = dispatcherService; _openFileService = openFileService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; ParseCommand = new Command(OnParseCommandExecute, OnParseCommandCanExecute); LoadFile = new Command<string>(OnLoadFileExecute); OpenFileCommand = new Command(OnOpenFileCommandExecute); ExitCommand = new Command(OnExitCommandExecute); Document = new TextDocument(); Filter = new LogFilter { EnableDebug = true, EnableError = true, EnableInfo = true, EnableWarning = true }; Filter.PropertyChanged += OnFilterPropertyChanged; Document.Changed += DocumentChanged; _logEntries = new FastObservableCollection<LogEntry>(); using (var reader = new XmlTextReader("Resources\\HighlightingDefinition.xshd")) { HighlightingDefinition = HighlightingLoader.Load(reader, HighlightingManager.Instance); } HighlightingManager.Instance.RegisterHighlighting("CatelHighlighting", new[] { ".cool" }, HighlightingDefinition); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class. /// </summary> public MainWindowViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService) { _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; ShowWindowLogicInViewBase = new Command(OnShowWindowLogicInViewBaseExecute); ShowWindowLogicInBehavior = new Command(OnShowWindowLogicInBehaviorExecute); ShowNestedUserControlsLogicInViewBase = new Command(OnShowNestedUserControlsLogicInViewBaseExecute); ShowNestedUserControlsLogicInBehavior = new Command(OnShowNestedUserControlsLogicInBehaviorExecute); ShowPleaseWaitWindowViaServiceLocator = new Command(OnShowPleaseWaitWindowViaServiceLocatorExecute); ShowPleaseWaitWindowViaMEF = new Command(OnShowPleaseWaitWindowViaMEFExecute); ShowPleaseWaitWindowViaUnity = new Command(OnShowPleaseWaitWindowViaUnityExecute); ShowWindowWithBehaviors = new Command(OnShowWindowWithBehaviorsExecute); ShowThrottling = new Command(OnShowThrottlingExecute); // The external containers such as Unity and MEF are registered in App.xaml IoCHelper.MefContainer.SatisfyImportsOnce(this); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class. /// </summary> public MainWindowViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService) { _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; ShowWindowLogicInViewBase = new Command(OnShowWindowLogicInViewBaseExecute); ShowWindowLogicInBehavior = new Command(OnShowWindowLogicInBehaviorExecute); ShowNestedUserControlsLogicInViewBase = new Command(OnShowNestedUserControlsLogicInViewBaseExecute); ShowNestedUserControlsLogicInBehavior = new Command(OnShowNestedUserControlsLogicInBehaviorExecute); ShowPleaseWaitWindowViaServiceLocator = new Command(OnShowPleaseWaitWindowViaServiceLocatorExecute); ShowPleaseWaitWindowViaMEF = new Command(OnShowPleaseWaitWindowViaMEFExecute); ShowPleaseWaitWindowViaUnity = new Command(OnShowPleaseWaitWindowViaUnityExecute); ShowWindowWithBehaviors = new Command(OnShowWindowWithBehaviorsExecute); ShowThrottling = new Command(OnShowThrottlingExecute); // The external containers such as Unity and MEF are registered in App.xaml IoCHelper.MefContainer.SatisfyImportsOnce(this); }
public TypesViewModel(IOpenFileService openFileService, IPleaseWaitService pleaseWaitService, IUIServiceHost uiServiceHost, IReflectionService reflectionService, ICommandManager commandManager) { Argument.IsNotNull(() => openFileService); Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => uiServiceHost); Argument.IsNotNull(() => reflectionService); Argument.IsNotNull(() => commandManager); _openFileService = openFileService; _pleaseWaitService = pleaseWaitService; _uiServiceHost = uiServiceHost; _reflectionService = reflectionService; Assemblies = new List<AssemblyEntry>(); FileOpen = new Command(OnFileOpenExecute); ClearFilter = new Command(OnClearFilterExecute); commandManager.RegisterCommand("File.Open", FileOpen, this); }
public ApplicationService(DataPersisterService dataPersisterService, IDispatcherService dispatcherService, ICustomStatusService statusService, IPleaseWaitService pleaseWaitService, IAdvancedMessageService messageService, GlobalService globalService, GlobalFrontendService globalFrontendService) { Argument.IsNotNull(() => statusService); Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => messageService); _pleaseWaitService = pleaseWaitService; _statusService = statusService; _messageService = messageService; _dispatcherService = dispatcherService; _dataPersisterService = dataPersisterService; _globalService = globalService; _globalFrontendService = globalFrontendService; _applicationOperationStatus = new ApplicationOperationStatus(); _updateWorkerPoolStatsTimer = new Timer(500); _updateDatabaseSizeTimer = new Timer(2000); }
public ChildViewModel(IMessageService messageService, IPleaseWaitService pleaseWaitService) { if (messageService == null) { throw new ArgumentNullException("messageService"); } if (pleaseWaitService == null) { throw new ArgumentNullException("pleaseWaitService"); } _messageService = messageService; _pleaseWaitService = pleaseWaitService; _applyCommand = new Command(Apply, CanApply); _closeCommand = new Command(CloseCmd); CanceledAsync += async(sender, args) => Debug.WriteLine("{0} canceled", Title); CancelingAsync += async(sender, args) => Debug.WriteLine("{0} canceling", Title); ClosedAsync += async(sender, args) => Debug.WriteLine("{0} closed", Title); ClosingAsync += async(sender, args) => Debug.WriteLine("{0} closing", Title); InitializedAsync += async(sender, args) => Debug.WriteLine("{0} initialized", Title); NavigationCompleted += async(sender, args) => Debug.WriteLine("{0} navigation", Title); }
public ExplorerViewModel(IRepositoryNavigatorService repositoryNavigatorService, ISearchSettingsService searchSettingsService, IPackageCommandService packageCommandService, IPleaseWaitService pleaseWaitService, IPackageQueryService packageQueryService, ISearchResultService searchResultService, IDispatcherService dispatcherService, IPackagesUpdatesSearcherService packagesUpdatesSearcherService, IPackageBatchService packageBatchService, INuGetConfigurationService nuGetConfigurationService, IConfigurationService configurationService) { Argument.IsNotNull(() => repositoryNavigatorService); Argument.IsNotNull(() => searchSettingsService); Argument.IsNotNull(() => packageCommandService); Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => packageQueryService); Argument.IsNotNull(() => searchResultService); Argument.IsNotNull(() => dispatcherService); Argument.IsNotNull(() => packagesUpdatesSearcherService); Argument.IsNotNull(() => packageBatchService); Argument.IsNotNull(() => nuGetConfigurationService); Argument.IsNotNull(() => configurationService); _repositoryNavigatorService = repositoryNavigatorService; _packageCommandService = packageCommandService; _pleaseWaitService = pleaseWaitService; _packageQueryService = packageQueryService; _dispatcherService = dispatcherService; _packagesUpdatesSearcherService = packagesUpdatesSearcherService; _packageBatchService = packageBatchService; _nuGetConfigurationService = nuGetConfigurationService; _configurationService = configurationService; SearchSettings = searchSettingsService.SearchSettings; SearchResult = searchResultService.SearchResult; AvailableUpdates = new ObservableCollection<IPackageDetails>(); PackageAction = new TaskCommand<IPackageDetails>(OnPackageActionExecuteAsync, OnPackageActionCanExecute); CheckForUpdates = new TaskCommand(OnCheckForUpdatesExecute); OpenUpdateWindow = new TaskCommand(OnOpenUpdateWindowExecuteAsync); AccentColorHelper.CreateAccentColorResourceDictionary(); }
public ExplorerViewModel(IRepositoryNavigatorService repositoryNavigatorService, ISearchSettingsService searchSettingsService, IPackageCommandService packageCommandService, IPleaseWaitService pleaseWaitService, IPackageQueryService packageQueryService, ISearchResultService searchResultService, IDispatcherService dispatcherService, IPackagesUpdatesSearcherService packagesUpdatesSearcherService, IPackageBatchService packageBatchService, INuGetConfigurationService nuGetConfigurationService, IConfigurationService configurationService) { Argument.IsNotNull(() => repositoryNavigatorService); Argument.IsNotNull(() => searchSettingsService); Argument.IsNotNull(() => packageCommandService); Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => packageQueryService); Argument.IsNotNull(() => searchResultService); Argument.IsNotNull(() => dispatcherService); Argument.IsNotNull(() => packagesUpdatesSearcherService); Argument.IsNotNull(() => packageBatchService); Argument.IsNotNull(() => nuGetConfigurationService); Argument.IsNotNull(() => configurationService); _repositoryNavigatorService = repositoryNavigatorService; _packageCommandService = packageCommandService; _pleaseWaitService = pleaseWaitService; _packageQueryService = packageQueryService; _dispatcherService = dispatcherService; _packagesUpdatesSearcherService = packagesUpdatesSearcherService; _packageBatchService = packageBatchService; _nuGetConfigurationService = nuGetConfigurationService; _configurationService = configurationService; SearchSettings = searchSettingsService.SearchSettings; SearchResult = searchResultService.SearchResult; AvailableUpdates = new ObservableCollection <IPackageDetails>(); PackageAction = new TaskCommand <IPackageDetails>(OnPackageActionExecuteAsync, OnPackageActionCanExecute); CheckForUpdates = new TaskCommand(OnCheckForUpdatesExecute); OpenUpdateWindow = new TaskCommand(OnOpenUpdateWindowExecuteAsync); AccentColorHelper.CreateAccentColorResourceDictionary(); }
public MainWindowViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; ProvidersCollection = new ObservableCollection <ProviderModel>(); using (var db = new ProcessingContext()) { var res = from ap in db.AccessProviders join p in db.Providers on ap.Provider_id equals p.Id join u in db.Users on ap.User_id equals u.Id select new { p.Name, p.Logo }; foreach (var t in res) { ProvidersCollection.Add(new ProviderModel() { Name = t.Name, Logo = ConfigurationManager.AppSettings["images_folder"] + t.Logo }); } } }
public ApplicationOpenProjectCommandContainer( ICommandManager commandManager, IProjectManager projectManager, IOpenFileService openFileService, IPleaseWaitService pleaseWaitService, INotificationService notificationService, IRecentlyUsedItemsService recentlyUsedItemsService, ILoggerService loggerService, Tw3Controller tw3Controller, Cp77Controller cp77Controller ) : base(AppCommands.Application.OpenProject, commandManager, projectManager, notificationService, loggerService) { Argument.IsNotNull(() => openFileService); Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => recentlyUsedItemsService); _pleaseWaitService = pleaseWaitService; _openFileService = openFileService; _recentlyUsedItemsService = recentlyUsedItemsService; _tw3Controller = tw3Controller; _cp77Controller = cp77Controller; }
/// <summary>Initializes a new instance of the <see cref="ReviewViewModel" /> class.</summary> /// <param name="database">The database.</param> /// <param name="spacedRepetition">The spaced repetition.</param> /// <param name="languageService">The language service.</param> /// <param name="pleaseWaitService">The please wait service.</param> /// <param name="messageService">The message service.</param> /// <param name="commandManager">The command manager.</param> public ReviewViewModel( IDatabaseAsync database, ISpacedRepetition spacedRepetition, ILanguageService languageService, IPleaseWaitService pleaseWaitService, IMessageService messageService, ICommandManagerEx commandManager) { _database = database; _spacedRepetition = spacedRepetition; _languageService = languageService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; AnswerTaskCommand = new TaskCommand <Grade>( OnAnswerExecuteAsync, g => !AnswerTaskCommand.IsExecuting); AnswerKeyPressCommand = new Command <int>( OnAnswerKeyPressExecute, i => i <= ReviewAnswerInfos.Length && !AnswerTaskCommand.IsExecuting); foreach ( var answerGesture in Commands.SpacedRepetition.CollectionReview.AnswerGestures.Take(5)) { commandManager.RegisterCommand( answerGesture.Item1, AnswerKeyPressCommand, answerGesture.Item3); } }
public MainWindowViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; regLogViewModel = new RegLogViewModel(_uiVisualizerService, _pleaseWaitService, _messageService); _uiVisualizerService.ShowDialogAsync(regLogViewModel, (sender, e) => { if (regLogViewModel.isUserViewModelExist) { this.userViewModel = regLogViewModel.userViewModel; UserLogin = userViewModel.UserLogin; VICollection = new ObservableCollection <VolumeIndication>(); AddressesCollection = new ObservableCollection <Address>(); RatesCollection = new ObservableCollection <Rate>(); ServicesCollection = new ObservableCollection <Service>(); UserAddressesCollection = new ObservableCollection <Address>(); writeDataInTable(); foreach (var item in AddressesCollection) { UserAddressesCollection.Add(item); } if (UserAddressesCollection.Count > 0) { SelectedAddress = UserAddressesCollection.First(); } SelectedDate = DateTime.Now; writeDataInTable(); } else { this.CloseViewModelAsync(true); } }); }
public DemoLongOperationCommandContainer(ICommandManager commandManager, IPleaseWaitService pleaseWaitService) : base(Commands.Demo.LongOperation, commandManager) { _pleaseWaitService = pleaseWaitService; }
public XamlPleaseWaitInterruptService(IPleaseWaitService pleaseWaitService) { Argument.IsNotNull(() => pleaseWaitService); _pleaseWaitService = pleaseWaitService; }
/// <summary> /// Initializes a new instance of the <see cref="ModuleManagerViewModel" /> class. /// </summary> /// <exception cref="System.ArgumentNullException">The <paramref name="moduleCatalog"/> is <c>null</c>.</exception> /// <exception cref="System.ArgumentNullException">The <paramref name="moduleManager"/> is <c>null</c>.</exception> /// <exception cref="System.ArgumentNullException">The <paramref name="pleaseWaitService"/> is <c>null</c>.</exception> public ModuleManagerViewModel(IModuleCatalog moduleCatalog, IModuleManager moduleManager, IPleaseWaitService pleaseWaitService) { Argument.IsNotNull(() => moduleManager); Argument.IsNotNull(() => moduleCatalog); Argument.IsNotNull(() => pleaseWaitService); _moduleManager = moduleManager; _pleaseWaitService = pleaseWaitService; var modules = moduleCatalog.Modules; var moduleTemplates = modules.Select(moduleInfo => new ModuleTemplate(moduleInfo)).OrderBy(template => template.ModuleName); Modules = new ObservableCollection <ModuleTemplate>(moduleTemplates); LoadModuleCommand = new Command <ModuleTemplate>(LoadModuleCommandExecute, LoadModuleCommandCanExecute); }
public ProjectManagementCloseApplicationWatcher(IProjectManager projectManager, IPleaseWaitService pleaseWaitService, ISaveProjectChangesService saveProjectChangesService) { Argument.IsNotNull(() => projectManager); Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => saveProjectChangesService); _projectManager = projectManager; _pleaseWaitService = pleaseWaitService; _saveProjectChangesService = saveProjectChangesService; }
/// <summary> /// Calls <see cref="IPleaseWaitService.Push"/> and returns a disposable token. As soon as the token is disposed, it will /// call <see cref="IPleaseWaitService.Pop"/>. /// <para /> /// This is a great way to safely show a busy indicator and ensure that the indicator hides, even when an exception occurs. /// </summary> /// <param name="pleaseWaitService">The please wait service.</param> /// <param name="status">The status to change the text to.</param> /// <returns>IDisposable.</returns> /// <example> /// <![CDATA[ /// using (pleaseWaitService.PushInScope()) /// { /// // some code that might throw exceptions /// } /// ]]> /// </example> public static IDisposable PushInScope(this IPleaseWaitService pleaseWaitService, string status = "") { Argument.IsNotNull("pleaseWaitService", pleaseWaitService); return(new DisposableToken <IPleaseWaitService>(pleaseWaitService, token => token.Instance.Push(status), token => token.Instance.Pop())); }
public IPManagementViewModel(IPManagementModel model, IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { IPManagement = model; _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; BanIPCommand = new Command(BanIP); UnbanIPCommand = new Command(UnbanIP); }
public RestoreDatabaseViewModel(RestoreDatabaseModel model, IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { RestoreDatabase = model; _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; DeleteBackupCommand = new Command(DeleteBackup); RestoreDatabaseCommand = new Command(RestoreDatabaseNow); Init(); }
public MyStopDetailsViewModel(Stop myStop, IMessageService messageService, IPleaseWaitService pleaseWaitService) { // Here is the context with the injected Stop parameter. Note that I have // also injected several other services to show how you can use the combination }
public AccountManagementViewModel(AccountsManagementModel model, IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { Accounts = model; _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; BanAccountCommand = new Command(BanAccount); UnbanAccountCommand = new Command(UnbanAccount); }
public static IDisposable WaitingScope(this IPleaseWaitService pleaseWaitService) { return(new DisposableToken <IPleaseWaitService>(pleaseWaitService, token => token.Instance.Push(), token => token.Instance.Pop())); }
public BackupDatabaseViewModel(BackupDatabaseModel model, IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService) { BackupDatabase = model; _uiVisualizerService = uiVisualizerService; _pleaseWaitService = pleaseWaitService; _messageService = messageService; _busy = false; BackupNowCommand = new Command(BackupNow); SaveCommand = new Command(SaveAndClose); }
/// <summary> /// Initializes a new instance of the <see cref="HomeWindowViewModel"/> class. /// </summary> public HomeWindowViewModel(IUpdateMessagesListTask updateMessagesListTask, IMessageMediator mediator, IPleaseWaitService pleaseWaitService, IFolderWatcher folderWatcher, ITryFindParent tryFindParent, IOpenEmailFile openEmailFile) { this.updateMessagesListTask = updateMessagesListTask; this.mediator = mediator; this.pleaseWaitService = pleaseWaitService; this.folderWatcher = folderWatcher; this.tryFindParent = tryFindParent; this.openEmailFile = openEmailFile; RowDoubleClick = new Command <MouseButtonEventArgs>(OnRowDoubleClickExecute, OnRowDoubleClickCanExecute); CheckMessagesCommand = new AsynchronousCommand(OnCheckMessagesCommandExecute, () => !CheckMessagesCommand.IsExecuting); MarkAsReadCommand = new Command <MessageModel>(OnMarkAsReadCommandExecute); ImageSingleClick = new Command <MessageModel>(OnImageSingleClickExecute); Messages = new InitialLoadCommand().Load(); CheckMessagesWithWaiting(); }
/// <summary> /// Shows the please wait window using the specific <paramref name="service"/>. /// </summary> /// <param name="service">The service.</param> /// <param name="status">The status.</param> private void ShowPleaseWaitWindow(IPleaseWaitService service, string status) { string determinateFormatString = "Updating item {0} of {1} (" + status + ")"; const int CounterMax = 25; int counter = 0; bool isIndeterminate = IsPleaseWaitIndeterminate; var dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100); dispatcherTimer.Tick += (sender, e) => { bool exit = false; counter++; if (counter >= CounterMax + 1) { exit = true; } else if (!isIndeterminate) { service.UpdateStatus(counter, CounterMax, determinateFormatString); } if (exit) { dispatcherTimer.Stop(); service.Hide(); } }; if (isIndeterminate) { service.Show(status); } else { service.UpdateStatus(1, CounterMax, determinateFormatString); } dispatcherTimer.Start(); }
/// <summary> /// The execute. /// </summary> private void Execute() { IsRunning = true; lock (_syncObj) { IsCommitting = false; } IPleaseWaitService pleaseWaitService = null; if (_viewModelType == null) { pleaseWaitService = GetService <IPleaseWaitService>(); } try { bool aborted = false, retry = false; int progress = 0; int total = _tasks.Count; var processedTasks = new Stack <ITask>(); while (!aborted && _tasks.Count > 0) { if (!retry) { processedTasks.Push(_tasks.Dequeue()); } retry = false; ITask task = processedTasks.Peek(); try { Log.Debug("Executing task '{0}'. ", task.Name); if (pleaseWaitService != null) { pleaseWaitService.UpdateStatus(++progress, total, task.Name); } else if (_progressNotifyableViewModel != null) { _progressNotifyableViewModel.UpdateStatus(progress++, total, task); } _dispatcherService.Invoke(task.Execute); } catch (Exception e) { Log.Error(e); var messageResult = _messageService.Show(string.Format(TaskExecutionErrorMessagePattern, task.Name), "Error", MessageButton.YesNoCancel, MessageImage.Error); switch (messageResult) { case MessageResult.Yes: retry = true; break; case MessageResult.Cancel: aborted = true; break; } } } if (aborted) { while (processedTasks.Count > 0) { ITask task = processedTasks.Pop(); Log.Debug("Rolling back task '{0}'. ", task.Name); try { if (pleaseWaitService != null) { pleaseWaitService.UpdateStatus(progress--, total, string.Format("Rollback '{0}'", task.Name)); } else if (_progressNotifyableViewModel != null) { _progressNotifyableViewModel.UpdateStatus(progress--, total, task); } task.Rollback(); } catch (Exception e) { Log.Warning("Rollback of task '{0}' failed", task.Name); Log.Error(e); } } } } finally { if (pleaseWaitService != null) { pleaseWaitService.Hide(); } IsRunning = false; _dispatcherService.Invoke(() => { if (_progressNotifyableViewModel != null) { _progressNotifyableViewModel.CloseViewModel(null); } }); if (_completedCallback != null) { _dispatcherService.Invoke(() => _completedCallback.Invoke()); } } }