Ejemplo n.º 1
0
        public EditorViewModel(StudioStateModel studioState,
            IMementoService mementoService)
        {
            Argument.IsNotNull(() => studioState);
            Argument.IsNotNull(() => mementoService);

            this.StudioState = studioState;
            this.StudioState.ProjectPropertyChanged += this.OnStudioStateProjectPropertyChanged;
            this.mementoService = mementoService;
            this.isMainScript = true;
        }
Ejemplo n.º 2
0
        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;
        }
 private async Task InitializeMainModel()
 {
     var studioModel = new StudioStateModel();
     ServiceLocator.Default.RegisterType(m => studioModel);
 }