コード例 #1
0
        public ConditionSelectionMasterModel(ConditionService service)
        {
            Selector = new ConditionSelectorModel(service);
            Editor = new ConditionEditorModel(service);

            Selector.Edit += OnEdit;
        }
コード例 #2
0
ファイル: ConditionEditorModel.cs プロジェクト: ddksaku/rzr
        public ConditionEditorModel(ConditionService service)
        {
            AndAtoms = new ObservableCollection<ConditionComponentListingModel>();
            OrAtoms = new ObservableCollection<ConditionComponentListingModel>();
            EditorModel = new ComponentEditorModel();
            ConditionSelectorModel = new ExistingConditionSelectorModel(service);

            ConditionSelectorModel.OnSelect += ConditionSelected;
        }
コード例 #3
0
 public ExistingConditionSelectorModel(ConditionService service)
 {
     ObservableCollection<ExistingConditionListingModel> conditions = new ObservableCollection<ExistingConditionListingModel>();
     foreach (ConditionContainer container in service.Definition.ConfiguredConditions)
     {
         ExistingConditionListingModel containerModel = new ExistingConditionListingModel(container);
         containerModel.OnSelect += ItemSelect;
         conditions.Add(containerModel);
     }
     Conditions = conditions;
 }
コード例 #4
0
ファイル: ConditionSelectorModel.cs プロジェクト: ddksaku/rzr
        public ConditionSelectorModel(ConditionService service)
        {
            Service = service;

            ObservableCollection<string> availableRanges = new ObservableCollection<string>();
            foreach (string name in ConditionService.AvailableConditionSets)
                availableRanges.Add(name);
            availableRanges.Add(ADD_NEW_STRING);
            AvailableRanges = availableRanges;

            SelectedRange = service.Name;
        }
コード例 #5
0
ファイル: CompiledCondition.cs プロジェクト: ddksaku/rzr
        public CompiledCondition(ConditionContainer container, ConditionService service)
        {
            Container = container;
            List<CompiledConditionWorker> and = new List<CompiledConditionWorker>();
            if (container.AndConditions != null)
            {
                foreach (ConditionAtom atom in container.AndConditions)
                {
                    if (atom.Type == ConditionAtomType.Standard)
                    {
                        and.Add(new CompiledMaskCondition(atom.PrimaryMask));
                    }
                    else
                    {
                        ConditionContainer linked = service.Definition.ConfiguredConditions.Find(x => x.ID == atom.LinkedContainerId);
                        CompiledCondition subCondition = new CompiledCondition(linked, service);
                        and.Add(new CompiledSubCondition(subCondition));
                    }
                }
            }
            _andConditions = and.ToArray();

            List<CompiledConditionWorker> or = new List<CompiledConditionWorker>();
            if (container.OrConditions != null)
            {
                foreach (ConditionAtom atom in container.OrConditions)
                {
                    if (atom.Type == ConditionAtomType.Standard)
                    {
                        or.Add(new CompiledMaskCondition(atom.PrimaryMask));
                    }
                    else
                    {
                        ConditionContainer linked = service.Definition.ConfiguredConditions.Find(x => x.ID == atom.LinkedContainerId);
                        CompiledCondition subCondition = new CompiledCondition(linked, service);
                        or.Add(new CompiledSubCondition(subCondition));
                    }
                }
            }
            _orConditions = or.ToArray();
        }
コード例 #6
0
ファイル: ConditionService.cs プロジェクト: ddksaku/rzr
 public ConditionService SaveNewDefinitionAs(string conditionsFile)
 {
     ConditionService service = new ConditionService(conditionsFile, Definition);
     service.SaveDefinition();
     return service;
 }
コード例 #7
0
ファイル: ConditionService.cs プロジェクト: ddksaku/rzr
        /// <summary>
        /// Initialise the default service withthe default condition set
        /// </summary>
        public static void Initialise()
        {
            string mapPath = Path.Combine(RzrConfiguration.DataDirectory, RzrConfiguration.ConditionsMap);
            ConditionMap = LoadMap(mapPath);

            string conditionsPath = Path.Combine(RzrConfiguration.DataDirectory, RzrConfiguration.DefaultConditions);
            DefaultService = new ConditionService(conditionsPath, false);
            DefaultService.Name = RZR_DEFAULT_CONDITION_NAME;

            DirectoryInfo info = new DirectoryInfo(RzrConfiguration.SaveDirectory);
            FileInfo[] files = info.GetFiles("*" + RZR_CONDITION_SAVE_SUFFIX);
            AvailableConditionSets = files.Select(x => x.Name.Replace(RZR_CONDITION_SAVE_SUFFIX, "")).ToList();
        }
コード例 #8
0
ファイル: ConditionSelectorModel.cs プロジェクト: ddksaku/rzr
 public void UpdateService()
 {
     Service = new ConditionService(SelectedRange, true);
 }