public GenerationOptionsViewModel(GenerationOptions model, IMarkDirty dirtyService, IMessageBoxService messageBoxService)
 {
     _model                      = model ?? throw new ArgumentNullException(nameof(model));
     _dirtyService               = dirtyService ?? throw new ArgumentNullException(nameof(dirtyService));
     _messageBoxService          = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService));
     HeaderFilePathDialogCommand = new RelayCommand <string>(OpenHeaderFilePathDialog);
     CodeFilePathDialogCommand   = new RelayCommand <string>(OpenCodeFilePathDialog);
 }
        public StateMachineReferenceViewModel(StateMachine model, IViewService viewService, IMarkDirty parentDirtyService, IMessageBoxService messageBoxService)
        {
            _model              = model ?? throw new ArgumentNullException(nameof(model));
            _viewService        = viewService ?? throw new ArgumentNullException(nameof(viewService));
            _parentDirtyService = parentDirtyService ?? throw new ArgumentNullException(nameof(parentDirtyService));
            _messageBoxService  = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService));

            RenameCommand = new RelayCommand(Rename);
            EditCommand   = new RelayCommand(() => Edit());

            CheckNumberOfInstancesValue();
        }
 public static void Reset(IMarkDirty group)
 {
     try
     {
         if (!group.Scheduled)
         {
             return;
         }
         _dirty[group.Batch].Remove(group);
         group.Scheduled = false;
     }
     catch (Exception e)
     {
         Plugin.Error("", e);
     }
 }
 public static void Schedule(IMarkDirty group)
 {
     try
     {
         if (group.Scheduled)
         {
             return;
         }
         _dirty[group.Batch].Add(group);
         group.Scheduled = true;
     }
     catch (Exception e)
     {
         Plugin.Error("", e);
     }
 }
        public ProjectViewModel(StateMachineProject project, IMarkDirty dirtyService, IMessageBoxService messageBoxService)
        {
            _project           = project;
            _dirtyService      = dirtyService;
            _messageBoxService = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService));

            if (_project.StateMachines != null)
            {
                StateMachines.AddRange(_project.StateMachines
                                       .Select(sm => ApplicationContainer.Container.Resolve <StateMachineReferenceViewModel>(
                                                   new TypedParameter(typeof(StateMachine), sm),
                                                   new TypedParameter(typeof(IDirtyService), _dirtyService)
                                                   )));
            }

            _generationOptions = new GenerationOptionsViewModel(project.GenerationOptions, dirtyService, _messageBoxService);

            NewStateMachineCommand    = new RelayCommand(NewStateMachine);
            DeleteStateMachineCommand = new RelayCommand(DeleteStateMachine, CanDeleteStateMachine);
            GenerateCommand           = new RelayCommand <string>((s) => GenerateWithNoDebug(s), (s) => CanGenerate(s));
            GenerateAndDebugCommand   = new RelayCommand <string>((s) => GenerateAndDebug(s), (s) => CanGenerate(s));
        }
 public static void ResetChangedOwnership(IMarkDirty group)
 {
     _changedOwnership.TryRemove(group);
 }
 public static void OnChangedOwnership(IMarkDirty group)
 {
     _changedOwnership.Add(group);
 }