public void UpdateModel(AdditionalApplicationModel model)
 {
     Ensure.NotNull(model, "model");
     Icon = IconExtractor.Get(model.Path);
     Path = model.Path;
     Model = model;
 }
 public SaveApplicationCommand(AdditionalApplicationEditViewModel viewModel, AdditionalApplicationModel sourceModel, Action<AdditionalApplicationModel> onSaved)
 {
     Ensure.NotNull(viewModel, "viewModel");
     Ensure.NotNull(onSaved, "onSaved");
     this.viewModel = viewModel;
     this.sourceModel = sourceModel;
     this.onSaved = onSaved;
 }
        protected override void Execute()
        {
            AdditionalApplicationModel targetModel = null;
            if (sourceModel == null)
                targetModel = new AdditionalApplicationModel(viewModel.Name, viewModel.Path, viewModel.Arguments);
            else if(viewModel.Path != sourceModel.Path || viewModel.Name != sourceModel.Name || viewModel.Arguments != sourceModel.Arguments)
                targetModel = new AdditionalApplicationModel(viewModel.Name, viewModel.Path, viewModel.Arguments);

            if (targetModel != null)
                onSaved(targetModel);
            else
                onSaved(null);
        }
        public AdditionalApplicationEditViewModel(AdditionalApplicationModel model, Action<AdditionalApplicationModel> onSaved)
        {
            if (model != null)
            {
                IsNameChanged = true;
                Name = model.Name;
                Path = model.Path;
                Arguments = model.Arguments;
            }

            saveCommand = new SaveApplicationCommand(this, model, onSaved);
        }
        private void OnAdditionalApplicationSaved(AdditionalApplicationModel model)
        {
            additionalApplicationEditWindow.Close();

            if (onAdditionalApplicationSaved != null)
                onAdditionalApplicationSaved(model);
        }
        public void OpenAdditionalApplicationEdit(AdditionalApplicationModel model, Action<AdditionalApplicationModel> onSaved)
        {
            sourceAdditionalApplicationModel = model;
            onAdditionalApplicationSaved = onSaved;

            AdditionalApplicationEditViewModel viewModel = new AdditionalApplicationEditViewModel(model, OnAdditionalApplicationSaved);
            additionalApplicationEditWindow = new AdditionalApplicationEditWindow(viewModel);
            additionalApplicationEditWindow.Owner = configurationWindow;
            additionalApplicationEditWindow.ShowDialog();
        }
 public AdditionalApplicationListViewModel(AdditionalApplicationModel model)
 {
     UpdateModel(model);
 }