Exemplo n.º 1
0
        public ConditionSelectionMasterModel(ConditionService service)
        {
            Selector = new ConditionSelectorModel(service);
            Editor = new ConditionEditorModel(service);

            Selector.Edit += OnEdit;
        }
Exemplo n.º 2
0
        public ConditionEditorModel(ConditionService service)
        {
            AndAtoms = new ObservableCollection<ConditionComponentListingModel>();
            OrAtoms = new ObservableCollection<ConditionComponentListingModel>();
            EditorModel = new ComponentEditorModel();
            ConditionSelectorModel = new ExistingConditionSelectorModel(service);

            ConditionSelectorModel.OnSelect += ConditionSelected;
        }
Exemplo n.º 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;
 }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
 public ConditionService SaveNewDefinitionAs(string conditionsFile)
 {
     ConditionService service = new ConditionService(conditionsFile, Definition);
     service.SaveDefinition();
     return service;
 }
Exemplo n.º 7
0
        /// <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();
        }
Exemplo n.º 8
0
 public void UpdateService()
 {
     Service = new ConditionService(SelectedRange, true);
 }