示例#1
0
 public InstructionProperty(ScriptedPropertyAttribute propertyAttribute, PropertyInfo propertyInfo,
                            ScriptedInstructionViewModel parentViewModel)
 {
     this.propertyAttribute = propertyAttribute;
     this.propertyInfo      = propertyInfo;
     this.parentViewModel   = parentViewModel;
     IsValid = true;
 }
        private ScriptedInstructionViewModel CreateAction(InstructionItem instructionItem)
        {
            var helper = new InstructionFactory(instructionItem.Type);

            var instruction = helper.Create();

            var viewModel = new ScriptedInstructionViewModel(this)
            {
                ScriptedInstruction = instruction
            };

            return(viewModel);
        }
        private void UpdateProjectState(Project.Project project, string projectPath)
        {
            var viewModels = from item in project.ScriptedInstructions
                             select new ScriptedInstructionViewModel(this)
            {
                ScriptedInstruction = item
            };

            if (Script != null)
            {
                Script.CollectionChanged -= ScriptCollectionChanged;
            }

            Script = new ObservableCollection <ScriptedInstructionViewModel>(viewModels.ToList());
            Script.CollectionChanged    += ScriptCollectionChanged;
            projectInstructions          = project.ProjectInstructions;
            ProjectInstructionsViewModel = new ScriptedInstructionViewModel(this)
            {
                ScriptedInstruction = projectInstructions
            };
            outputFileName = project.OutputFileName;
            ProjectPath    = projectPath;
            HasChanges     = false;
        }