public ConditionSelectionMasterModel(ConditionService service) { Selector = new ConditionSelectorModel(service); Editor = new ConditionEditorModel(service); Selector.Edit += OnEdit; }
public ConditionEditorModel(ConditionService service) { AndAtoms = new ObservableCollection<ConditionComponentListingModel>(); OrAtoms = new ObservableCollection<ConditionComponentListingModel>(); EditorModel = new ComponentEditorModel(); ConditionSelectorModel = new ExistingConditionSelectorModel(service); ConditionSelectorModel.OnSelect += ConditionSelected; }
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; }
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; }
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(); }
public ConditionService SaveNewDefinitionAs(string conditionsFile) { ConditionService service = new ConditionService(conditionsFile, Definition); service.SaveDefinition(); return service; }
/// <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(); }
public void UpdateService() { Service = new ConditionService(SelectedRange, true); }