public AppDataService(IMessageService messageService, ISaveFileService saveFileService, IProcessService processService, IDirectoryService directoryService, IFileService fileService) { Argument.IsNotNull(() => messageService); Argument.IsNotNull(() => saveFileService); Argument.IsNotNull(() => processService); Argument.IsNotNull(() => directoryService); Argument.IsNotNull(() => fileService); _messageService = messageService; _saveFileService = saveFileService; _processService = processService; _directoryService = directoryService; _fileService = fileService; ExclusionFilters = new List<string>(new [] { "licenseinfo.xml", "*.log" }); var applicationDataDirectory = Catel.IO.Path.GetApplicationDataDirectory(); _directoryService.Create(applicationDataDirectory); ApplicationDataDirectory = applicationDataDirectory; }
public DocumentViewModel(string path, IMessageService messageService, ISaveFileService saveFileService, IMessageMediator messageMediator) { this.messageService = messageService; this.saveFileService = saveFileService; this.messageMediator = messageMediator; SaveCommand = new TaskCommand(SaveAsync, () => HasChanges); SaveAsCommand = new TaskCommand(SaveFileAs); if (string.IsNullOrWhiteSpace(path)) { Name = "Document " + (++documentCounter) + ".txt"; HasChanges = true; } else { fullFileName = path; Name = Path.GetFileName(path); Text = File.ReadAllText(path); HasChanges = false; } }
public EnsureStartupService(ISaveFileService saveFileService, IMessageService messageService, INavigationService navigationService, IAppDataService appDataService) { Argument.IsNotNull(() => saveFileService); Argument.IsNotNull(() => messageService); Argument.IsNotNull(() => navigationService); Argument.IsNotNull(() => navigationService); Argument.IsNotNull(() => appDataService); _saveFileService = saveFileService; _messageService = messageService; _navigationService = navigationService; _appDataService = appDataService; var checkFile = GetCheckFileName(); SuccessfullyStarted = !File.Exists(checkFile); // Always create the file Log.Debug("Creating fail safe file check"); using (File.Create(checkFile)) { // Dispose required } }
public ImageLoaderViewModel( IMessageBoxService messageBoxService, IOpenFileService openFileService, ISaveFileService saveFileService, IUIVisualizerService uiVisualizerService, IImageProvider imageProvider, IImageDiskOperations imageDiskOperations, IViewAwareStatus viewAwareStatusService) { //setup services this.messageBoxService = messageBoxService; this.openFileService = openFileService; this.saveFileService = saveFileService; this.uiVisualizerService = uiVisualizerService; this.imageProvider = imageProvider; this.imageDiskOperations = imageDiskOperations; this.viewAwareStatusService = viewAwareStatusService; this.viewAwareStatusService.ViewLoaded += ViewAwareStatusService_ViewLoaded; //commands, SimpleCommand<T1,T2> T1 is CanExecute parameter type, and T2 is Execute type AddImageRatingCommand = new SimpleCommand <Object, Object>(ExecuteAddImageRatingCommand); SaveToFileCommand = new SimpleCommand <Object, Object>(ExecuteSaveToFileCommand); OpenExistingFileCommand = new SimpleCommand <Object, Object>(ExecuteOpenExistingFileCommand); //EventToCommand triggered, see the View ShowActionsCommand = new SimpleCommand <Object, Object>(ExecuteShowActionsCommand); HideActionsCommand = new SimpleCommand <Object, Object>(ExecuteHideActionsCommand); //some reverse commands, that the VM fires, and the View uses as CompletedAwareCommandTriggers //to carry out some actions. In this case GoToStateActions are used in the View ShowActionsCommandReversed = new SimpleCommand <Object, Object>((input) => { }); HideActionsCommandReversed = new SimpleCommand <Object, Object>((input) => { }); }
public ApplicationDeleteProjectCommandContainer( IRecentlyUsedItemsService recentlyUsedItemsService, IServiceLocator serviceLocator, ICommandManager commandManager, INavigationService navigationService, IProjectManager projectManager, ISaveFileService saveFileService, INotificationService notificationService, IUIVisualizerService uIVisualizerService, IViewModelFactory viewModelFactory, IMessageService messageService, ILoggerService loggerService) : base(AppCommands.Application.DelProject, commandManager) { Argument.IsNotNull(() => recentlyUsedItemsService); Argument.IsNotNull(() => serviceLocator); Argument.IsNotNull(() => navigationService); Argument.IsNotNull(() => loggerService); Argument.IsNotNull(() => saveFileService); _recentlyUsedItemsService = recentlyUsedItemsService; _serviceLocator = serviceLocator; _navigationService = navigationService; _loggerService = loggerService; _saveFileService = saveFileService; _uIVisualizerService = uIVisualizerService; _viewModelFactory = viewModelFactory; _messageService = messageService; }
public AppDataService(IMessageService messageService, ISaveFileService saveFileService, IProcessService processService) { Argument.IsNotNull(() => messageService); Argument.IsNotNull(() => saveFileService); Argument.IsNotNull(() => processService); _messageService = messageService; _saveFileService = saveFileService; _processService = processService; ExclusionFilters = new List <string>(new [] { "licenseinfo.xml", "*.log" }); var applicationDataDirectory = Catel.IO.Path.GetApplicationDataDirectory(); if (!Directory.Exists(applicationDataDirectory)) { Directory.CreateDirectory(applicationDataDirectory); } ApplicationDataDirectory = applicationDataDirectory; }
/// <summary> /// Save As command executed. /// </summary> protected virtual void SaveAsModelCommandExecuted() { if (this.SelectedModelContextViewModel == null) { return; } if (this.SelectedModelContextViewModel.ModelContext == null) { return; } ISaveFileService saveFileService = this.GlobalServiceProvider.Resolve <ISaveFileService>(); saveFileService.Filter = this.SelectedModelContextViewModel.EditorTitle + " files|*.xml|All files|*.*"; if (saveFileService.ShowDialog(null) == true) { // add to mru list this.MRUFilesViewModel.AddMRUEntry(saveFileService.FileName); //this.ViewModelStore.GetDomainModelServices(this.SelectedModelContextViewModel.ModelContext.RootElement).ElementParentProvider.SetDomainModelFilePath(this.SelectedModelContextViewModel.ModelContext.RootElement, saveFileService.FileName); (this.SelectedModelContextViewModel.ModelContext.RootElement as IParentModelElement).DomainFilePath = saveFileService.FileName; SaveModelCommandExecuted(); this.SelectedModelContextViewModel.OnDocumentLoaded(); } }
public AppDataService(ISaveFileService saveFileService, IProcessService processService, IDirectoryService directoryService, IFileService fileService) { Argument.IsNotNull(() => saveFileService); Argument.IsNotNull(() => processService); Argument.IsNotNull(() => directoryService); Argument.IsNotNull(() => fileService); _saveFileService = saveFileService; _processService = processService; _directoryService = directoryService; _fileService = fileService; ExclusionFilters = new List <string>(new [] { "licenseinfo.xml", "*.log" }); var applicationDataDirectory = Catel.IO.Path.GetApplicationDataDirectory(); _directoryService.Create(applicationDataDirectory); ApplicationDataDirectory = applicationDataDirectory; }
public FileSaveAsCommandContainer(ICommandManager commandManager, IProjectManager projectManager, ISaveFileService saveFileService) : base(Commands.File.SaveAs, commandManager, projectManager) { Argument.IsNotNull(() => saveFileService); _saveFileService = saveFileService; }
/// <summary> /// Initializes a new instance of the <see cref="ViewExportService" /> class. /// </summary> /// <param name="viewManager">The view manager.</param> /// <param name="saveFileService">The save file service.</param> /// <exception cref="ArgumentNullException">The <paramref name="viewManager" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="saveFileService" /> is <c>null</c>.</exception> public ViewExportService(IViewManager viewManager, ISaveFileService saveFileService) { Argument.IsNotNull("viewManager", viewManager); Argument.IsNotNull("saveFileService", saveFileService); _viewManager = viewManager; _saveFileService = saveFileService; }
/// <summary> /// Initializes a new instance of the <see cref="ViewExportService" /> class. /// </summary> /// <param name="viewManager">The view manager.</param> /// <param name="saveFileService">The save file service.</param> /// <exception cref="ArgumentNullException">The <paramref name="viewManager" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="saveFileService" /> is <c>null</c>.</exception> public ViewExportService(IViewManager viewManager, ISaveFileService saveFileService) { Argument.IsNotNull(() => viewManager); Argument.IsNotNull(() => saveFileService); _viewManager = viewManager; _saveFileService = saveFileService; }
/// <summary> /// Initializes a new instance of the <see cref="DataGridViewModel"/> class. /// </summary> /// <param name="title">The title.</param> /// <param name="openFileService">The open file service.</param> /// <param name="saveFileService">The save file service.</param> /// <param name="uiVisualizerService">The UI visualizer service.</param> /// <param name="messageMediator">The message mediator.</param> public DataGridViewModel(string title, IOpenFileService openFileService, ISaveFileService saveFileService, IUIVisualizerService uiVisualizerService, IMessageMediator messageMediator, IContextualViewModelManager contextualViewModelManager) : this(openFileService, saveFileService, uiVisualizerService, messageMediator, contextualViewModelManager) { if (!string.IsNullOrWhiteSpace(title)) { Title = title; } }
/// <summary> /// Handles the completion of the execution. /// </summary> /// <param name="saveFileSerivce">The save file service.</param> /// <param name="args">The <see cref="ResultCompletionEventArgs"/> instance containing the event data.</param> protected virtual void OnCompleted(ISaveFileService saveFileSerivce, ResultCompletionEventArgs args) { if (!args.WasCancelled) { lazyStream = new Lazy <Stream>(saveFileSerivce.OpenFile); } Completed(this, args); }
public MainViewModel(IOpenFileService openFileService, ISaveFileService saveFileService, IPdfService pdfService, CharacterSheetViewModel characterSheet) { _openFileService = openFileService; _saveFileService = saveFileService; _pdfService = pdfService; _saveFileService.Filter = "Pdf File (*.pdf)|*.pdf"; _saveFileService.Title = "Salva Scheda Personaggio"; _saveFileService.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); _saveFileService.DefaultFileName = "output.pdf"; _characterSheet = characterSheet; }
public SaveFilePickerViewModel(ISaveFileService saveFileService, IProcessService processService) { Argument.IsNotNull(() => saveFileService); Argument.IsNotNull(() => processService); _saveFileService = saveFileService; _processService = processService; OpenDirectory = new Command(OnOpenDirectoryExecute, OnOpenDirectoryCanExecute); SelectFile = new Command(OnSelectFileExecute); }
public EffectSizeVM( IEffectSizeCalculator cohensCalculator, ISaveFileService saveFileService, IResultExporter resultExporter, IEffectSizeSetupVM effectSizeSetupVM) { _cohensCalculator = cohensCalculator; _saveFileService = saveFileService; _resultExporter = resultExporter; Content = effectSizeSetupVM; }
public FileInfoService( MongoSettings mongoSettings, ISaveFileService saveFileService, IHttpContextAccessor contextAccessor) { var client = new MongoClient(mongoSettings.ConnectionString); var database = client.GetDatabase(mongoSettings.DatabaseName); _files = database.GetCollection <FileInfo>(mongoSettings.CollectionName); _saveFileService = saveFileService; _contextAccessor = contextAccessor; }
public DataGridViewModel(IOpenFileService openFileService, ISaveFileService saveFileService, IUIVisualizerService uiVisualizerService, IMessageMediator messageMediator) { Argument.IsNotNull(() => openFileService); Argument.IsNotNull(() => saveFileService); Argument.IsNotNull(() => uiVisualizerService); Argument.IsNotNull(() => messageMediator); _openFileService = openFileService; _saveFileService = saveFileService; _uiVisualizerService = uiVisualizerService; _messageMediator = messageMediator; }
public CommandsService(StudioStateModel model, ICommandManager commandManager, IMementoService mementoService, IMessageService messageService, IOpenFileService openFileService, IRecentlyUsedItemsService recentlyUsedItemsService, ISaveFileService saveFileService, IProcessService processService) { Argument.IsNotNull(() => model); Argument.IsNotNull(() => commandManager); Argument.IsNotNull(() => mementoService); Argument.IsNotNull(() => messageService); Argument.IsNotNull(() => openFileService); Argument.IsNotNull(() => recentlyUsedItemsService); Argument.IsNotNull(() => saveFileService); Argument.IsNotNull(() => processService); this.model = model; this.commandManager = commandManager; this.mementoService = mementoService; this.messageService = messageService; this.openFileService = openFileService; this.recentlyUsedItemsService = recentlyUsedItemsService; this.saveFileService = saveFileService; this.processService = processService; this.UndoCommand = new Command(this.Undo, this.CanUndo); this.RedoCommand = new Command(this.Redo, this.CanRedo); this.OpenProjectCommand = new Command(this.OpenProject, () => true); this.SaveProjectAsCommand = new Command(delegate { this.SaveAsProject(); }, () => true); this.SaveProjectCommand = new Command(delegate { this.SaveProject(); }, this.CanSave); this.OpenRecentlyUsedItemCommand = new Command<string>(this.OnOpenRecentlyUsedItemExecute); this.PinItemCommand = new Command<string>(this.PinItem); this.UnpinItemCommand = new Command<string>(this.UnpinItem); this.OpenInExplorerCommand = new Command<string>(this.OpenInExplorer); this.StartCommand = new Command(this.Start, this.CanStart); this.ExitCommand = new Command(this.Exit); commandManager.RegisterCommand("Script.Open", this.OpenProjectCommand); commandManager.RegisterCommand("Script.Save", this.SaveProjectCommand); commandManager.RegisterCommand("Script.SaveAs", this.SaveProjectAsCommand); commandManager.RegisterCommand("App.Exit", this.ExitCommand); this.model.ProjectPropertyChanged += this.OnProjectPropertyChanged; }
public ApplicationCreateNewProjectCommandContainer( ICommandManager commandManager, IProjectManager projectManager, ISaveFileService saveFileService, INotificationService notificationService, ILoggerService loggerService) : base(AppCommands.Application.CreateNewProject, commandManager, projectManager, notificationService, loggerService) { Argument.IsNotNull(() => loggerService); Argument.IsNotNull(() => saveFileService); _loggerService = loggerService; _saveFileService = saveFileService; }
public FilterExportResultCommandContainer(ICommandManager commandManager, ISaveFileService saveFileService, IFileService fileService, ILogTableService logTableService) : base(Commands.Filter.ExportResult, commandManager) { Argument.IsNotNull(() => saveFileService); Argument.IsNotNull(() => fileService); Argument.IsNotNull(() => logTableService); _saveFileService = saveFileService; _fileService = fileService; _logTableService = logTableService; }
/// <summary> /// Initializes a new instance of the <see cref="SolutionValidatorViewModel"/> class. /// </summary> public SolutionValidatorViewModel(ISelectDirectoryService selectDirectoryService, IOpenFileService openFileService, ISaveFileService saveFileService) { Argument.IsNotNull(() => selectDirectoryService); Argument.IsNotNull(() => openFileService); _selectDirectoryService = selectDirectoryService; _openFileService = openFileService; _saveFileService = saveFileService; CreateCommands(); LoadAppSettings(); ValidationResults = new ObservableCollection <ValidationMessage>(); TotalCheckCount = 0; }
public DisplayCollectionViewModel(IChooseFileNameService chooseFileNameService, IOpenFileService openFileService, IOpenSimulationService openSimulationService, ICanCloseService canCloseService, ISaveFileService saveFileService) { _chooseFileNameService = chooseFileNameService; _openFileService = openFileService; _openSimulationService = openSimulationService; _canCloseService = canCloseService; _saveFileService = saveFileService; _openFileService.OpenFile += (s, e) => openFile(e.Path, e.Index, e.IndexIsObjectIndex); _openSimulationService.OpenSimulation += (s, e) => openSimulation(e.Simulation); _canCloseService.CloseMe += (s, e) => Models.Remove(s as ClosableViewModel); }
public ManageUserDataService(IMessageService messageService, OrcFilterService filterService, IFilterSchemeManager filterSchemeManager, IWorkspaceManager workspaceManager, ISaveFileService saveFileService, IProcessService processService, IDirectoryService directoryService, IFileService fileService) : base(saveFileService, processService, directoryService, fileService) { Argument.IsNotNull(() => messageService); Argument.IsNotNull(() => filterService); Argument.IsNotNull(() => filterSchemeManager); Argument.IsNotNull(() => workspaceManager); _messageService = messageService; _filterService = filterService; _filterSchemeManager = filterSchemeManager; _workspaceManager = workspaceManager; }
public MainWindowVM( IOpenFileService openFileService, ISaveFileService saveFileService, IExcelImporter excelImporter, IColumnReducer columnReducer, IDynamicListGenerator dynamicListGenerator) { _openFileService = openFileService; _saveFileService = saveFileService; _excelImporter = excelImporter; _columnReducer = columnReducer; _dynamicListGenerator = dynamicListGenerator; // TODO: Unomment in release! OpenExcelSheet("data.xlsx"); }
public VstPluginChunkViewModel(IRemotePluginInstance pluginInstance, IOpenFileService openFileService, ISaveFileService saveFileService, DeveloperService developerService) { _openFileService = openFileService; _saveFileService = saveFileService; _developerService = developerService; Plugin = pluginInstance.Plugin; PluginInstance = pluginInstance; Title = "Plugin Info for " + Plugin.PluginName; OpenBankWithHexEditor = new TaskCommand(OnOpenBankWithHexEditorExecute); OpenPresetWithHexEditor = new TaskCommand(OnOpenPresetWithHexEditorExecute); SaveBankChunk = new TaskCommand(OnSaveBankChunkExecute); LoadBankChunk = new TaskCommand(OnLoadBankChunkExecute); Refresh = new Command(OnRefreshExecute); }
public MainWindowViewModel(ISaveFileService saveFileService, IOpenFileService openFileService) { SaveFileService = saveFileService; OpenFileService = openFileService; GroupCommandArgs = new GroupCommandArgs { CreateHostingItem = () => new Group() }; LoadCommand = new SimpleCommand<object, object>(o => Load()); SaveCommand = new SimpleCommand<object, object>(o => Save()); this.Document = CreateSampleItems(); this.Recorder = this.Document.QueryInterface<IRecordable>().Recorder; this.Recorder.Clear(); }
public MainWindowViewModel(ISaveFileService saveFileService, IOpenFileService openFileService) { SaveFileService = saveFileService; OpenFileService = openFileService; GroupCommandArgs = new GroupCommandArgs { CreateHostingItem = () => new Group() }; LoadCommand = new SimpleCommand <object, object>(o => Load()); SaveCommand = new SimpleCommand <object, object>(o => Save()); this.Document = CreateSampleItems(); this.Recorder = this.Document.QueryInterface <IRecordable>().Recorder; this.Recorder.Clear(); }
/// <summary> /// This method registers services with the service provider. /// </summary> private void FetchCoreServiceTypes() { try { ViewModelBase.isInitialised = false; //ILogger : Allows MessageBoxs to be shown logger = (ILogger)this.iocProvider.GetTypeFromContainer <ILogger>(); ServiceProvider.Add(typeof(ILogger), logger); //IMessageBoxService : Allows MessageBoxs to be shown IMessageBoxService messageBoxService = (IMessageBoxService)this.iocProvider.GetTypeFromContainer <IMessageBoxService>(); ServiceProvider.Add(typeof(IMessageBoxService), messageBoxService); //IOpenFileService : Allows Opening of files IOpenFileService openFileService = (IOpenFileService)this.iocProvider.GetTypeFromContainer <IOpenFileService>(); ServiceProvider.Add(typeof(IOpenFileService), openFileService); //ISaveFileService : Allows Saving of files ISaveFileService saveFileService = (ISaveFileService)this.iocProvider.GetTypeFromContainer <ISaveFileService>(); ServiceProvider.Add(typeof(ISaveFileService), saveFileService); //IUIVisualizerService : Allows popup management IUIVisualizerService uiVisualizerService = (IUIVisualizerService)this.iocProvider.GetTypeFromContainer <IUIVisualizerService>(); ServiceProvider.Add(typeof(IUIVisualizerService), uiVisualizerService); //call the callback delegate to setup IUIVisualizerService managed //windows if (SetupVisualizer != null) { SetupVisualizer(uiVisualizerService); } ViewModelBase.isInitialised = true; } catch (Exception ex) { LogExceptionIfLoggerAvailable(ex); } }
public ProductExplorerViewModel(IEventAggregator eventAggregator, ISaveFileService saveFileService) { if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) return; this._eventAggregator = eventAggregator; this._saveFileService = saveFileService; this._applicationUnit = new ApplicationUnit(); this.Products = new ObservableCollection<Product>(this._applicationUnit.Products.GetAll().ToList()); this.Products.CollectionChanged += (s,e) => RaiseCanExecuteCommands(); this.DeleteProductCommand = new RelayCommand(DeleteProductCommandExecute, DeleteProductCommandCanExecute); this.SaveChangesCommand = new RelayCommand(SaveChangesCommandExecute); this.RefreshCommand = new RelayCommand(RefreshCommandExecute); this.SaveAsCSVCommand = new RelayCommand(SaveAsCSVCommandExecute, SaveAsCSVCommandCanExecute); this.RegisterCommand(this.DeleteProductCommand); this.RegisterCommand(this.SaveAsCSVCommand); }
/// <summary> /// Initializes a new instance of the <see cref="DataGridViewModel"/> class. /// </summary> /// <param name="openFileService">The open file service.</param> /// <param name="saveFileService">The save file service.</param> /// <param name="uiVisualizerService">The UI visualizer service.</param> /// <param name="messageMediator">The message mediator.</param> public DataGridViewModel(IOpenFileService openFileService, ISaveFileService saveFileService, IUIVisualizerService uiVisualizerService, IMessageMediator messageMediator, IContextualViewModelManager contextualViewModelManager) { Argument.IsNotNull(() => openFileService); Argument.IsNotNull(() => saveFileService); Argument.IsNotNull(() => uiVisualizerService); Argument.IsNotNull(() => messageMediator); Argument.IsNotNull(() => contextualViewModelManager); _openFileService = openFileService; _saveFileService = saveFileService; _uiVisualizerService = uiVisualizerService; _messageMediator = messageMediator; _contextualViewModelManager = contextualViewModelManager; Items.CollectionChanged += ItemsCollectionChanged; Title = "Datagrid"; }
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> /// Creates a new referenced model. /// </summary> protected virtual void CreateNewReferencedModel() { ISaveFileService saveFileService = this.GlobalServiceProvider.Resolve <ISaveFileService>(); saveFileService.Filter = FileDialogFilter; if (saveFileService.ShowDialog(null) == true) { if (!EnsureClosing()) { return; } System.IO.File.CreateText(saveFileService.FileName).Close(); SetReferencedModel(saveFileService.FileName); } OnPropertyChanged("IsReferencedModelSet"); OnPropertyChanged("PropertyValue"); }
public MainWindowViewModel( IViewAwareStatus viewAwareStatusService, IMessageBoxService messageBoxService, IUIVisualizerService uiVisualizerService, IOpenFileService openFileService, ISaveFileService saveFileService, ISavePNGFileService savePNGService, IPrintPNGFileService printPNGFileService, IAssemblyManipulationService assemblyManipulationService ) { SettingsViewModel.Instance.SetGraphObject(graphLayout); this.assemblyManipulationService = assemblyManipulationService; this.viewAwareStatusService = viewAwareStatusService; this.viewAwareStatusService.ViewLoaded += ViewAwareStatusService_ViewLoaded; this.messageBoxService = messageBoxService; this.uiVisualizerService = uiVisualizerService; this.openFileService = openFileService; this.saveFileService = saveFileService; this.savePNGService = savePNGService; this.printPNGFileService = printPNGFileService; //Commands SaveSettingsAsXmlCommand = new SimpleCommand <Object, Object>(ExecuteSaveSettingsAsXmlCommand); ShowSettingsWindowCommand = new SimpleCommand <Object, Object>(NotBusyCheck, ExecuteShowSettingsWindowCommand); OpenFileCommand = new SimpleCommand <Object, Object>(NotBusyCheck, ExecuteOpenFileCommand); OpenFileDragCommand = new SimpleCommand <Object, Object>(NotBusyCheck, ExecuteOpenFileDragCommand); CommenceDrawingCommand = new SimpleCommand <Object, Object>(CanExecuteCommenceDrawingCommand, ExecuteCommenceDrawingCommand); ReLayoutCommand = new SimpleCommand <Object, Object>(NotBusyCheckAndNotDrawingAndHasGraphCheck, ExecuteReLayoutCommand); SaveCommand = new SimpleCommand <Object, Object>(NotBusyCheckAndNotDrawingAndHasGraphCheck, ExecuteSaveCommand); PrintFileCommand = new SimpleCommand <Object, Object>(NotBusyCheckAndNotDrawingAndHasGraphCheck, ExecutePrintFileCommand); ShowSpecificNotAssociatedVertexCommand = new SimpleCommand <Object, Object>(ExecuteShowSpecificNotAssociatedVertexCommand); AboutCommand = new SimpleCommand <Object, Object>(NotBusyCheck, ExecuteAboutCommand); HelpCommand = new SimpleCommand <Object, Object>(NotBusyCheck, ExecuteHelpCommand); CollapseVertexRegionsCommand = new SimpleCommand <Object, Object>(NotBusyCheckAndNotDrawingAndHasGraphCheck, ExecuteCollapseVertexRegionsCommand); Mediator.Instance.Register(this); }
public ApplicationNewProjectCommandContainer( ICommandManager commandManager, IProjectManager projectManager, ISaveFileService saveFileService, INotificationService notificationService, IUIVisualizerService uIVisualizerService, ILoggerService loggerService, IServiceLocator serviceLocator, Tw3Controller tw3Controller, Cp77Controller cp77Controller ) : base(AppCommands.Application.NewProject, commandManager, projectManager, notificationService, loggerService) { _loggerService = loggerService; _saveFileService = saveFileService; _tw3Controller = tw3Controller; _cp77Controller = cp77Controller; _uIVisualizerService = uIVisualizerService; _serviceLocator = serviceLocator; }
public DocumentViewModel(string path, IMessageService messageService, ISaveFileService saveFileService, IEventAggregator eventAggregator) { this.messageService = messageService; this.saveFileService = saveFileService; this.eventAggregator = eventAggregator; if (string.IsNullOrWhiteSpace(path)) { DisplayName = "Document " + (++documentCounter) + ".txt"; } else { fullFileName = path; DisplayName = Path.GetFileName(path); text = File.ReadAllText(path); } }
/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class. /// </summary> public MainWindowViewModel(IProjectManager projectManager, IOpenFileService openFileService, ISaveFileService saveFileService, IProcessService processService, IMessageService messageService) { Argument.IsNotNull(() => projectManager); Argument.IsNotNull(() => openFileService); Argument.IsNotNull(() => saveFileService); Argument.IsNotNull(() => processService); _projectManager = projectManager; _openFileService = openFileService; _saveFileService = saveFileService; _processService = processService; _messageService = messageService; LoadProject = new TaskCommand(OnLoadProjectExecuteAsync); RefreshProject = new TaskCommand(OnRefreshProjectExecuteAsync, OnRefreshProjectCanExecute); SaveProject = new TaskCommand(OnSaveProjectExecuteAsync, OnSaveProjectCanExecute); SaveProjectAs = new TaskCommand(OnSaveProjectAsExecuteAsync, OnSaveProjectAsCanExecute); CloseProject = new Command(OnCloseProjectExecute, OnCloseProjectCanExecute); OpenFile = new Command(OnOpenFileExecute, OnOpenFileCanExecute); }
public FileViewModel(ICanCloseService canCloseService, ISaveFileService saveFileService) : base(canCloseService) { _saveFileService = saveFileService; }
public InMemoryViewModel() { #region Obtain Services try { messageBoxService = Resolve<IMessageBoxService>(); saveFileService = Resolve<ISaveFileService>(); } catch { Logger.Error( "Error resolving services"); throw new ApplicationException("Error resolving services"); } #endregion #region Commands //Save VM Command saveVMCommand = new SimpleCommand { CanExecuteDelegate = x => CanExecuteSaveVMCommand, ExecuteDelegate = x => ExecuteSaveVMCommand() }; //Generate VM Command generateVMCommand = new SimpleCommand { CanExecuteDelegate = x => CanExecuteGenerateVMCommand, ExecuteDelegate = x => ExecuteGenerateVMCommand() }; #endregion Workspaces = new ObservableCollection<ViewModelBase>(); Workspaces.CollectionChanged += this.OnWorkspacesChanged; #region Create Validation Rules this.AddRule(new SimpleRule(viewModelNameChangeArgs.PropertyName, "ViewModelName can't be empty", delegate { return String.IsNullOrEmpty(this.ViewModelName); })); this.AddRule(new SimpleRule(viewModelNameChangeArgs.PropertyName, "ViewModelName can't contain spaces", delegate { if (String.IsNullOrEmpty(this.ViewModelName)) { return true; } else { return this.ViewModelName.Contains(" "); } })); this.AddRule(new SimpleRule(viewModelNamespaceChangeArgs.PropertyName, "ViewModelNamespace can't be empty", delegate { return String.IsNullOrEmpty(this.ViewModelNamespace); })); this.AddRule(new SimpleRule(viewModelNamespaceChangeArgs.PropertyName, "ViewModelNamespace can't contain spaces", delegate { if (String.IsNullOrEmpty(this.ViewModelNamespace)) { return true; } else { return this.ViewModelNamespace.Contains(" "); } })); #endregion }