private void UpdateRegionsConfigs() { // Update Config Pin if there is a change if (regionList.Count > 0) { RegionXML = AutomataRegion.DataSerializeRegion(regionList); //EnumManager.UpdateEnum(myGUID + "_Regions", regionList[0].Name, regionList.Select(x => x.Name).ToArray()); RegionsEnum.Clear(); regionList.ForEach(region => RegionsEnum.AddEntry(region.Name)); } else { RegionXML = ""; //EnumManager.UpdateEnum(myGUID + "_Regions", "", regionList.Select(x => x.Name).ToArray()); RegionsEnum.Clear(); } }
private bool DownloadRegions() { OutputMessage("Загрузка справочника регионов"); regions = RegionsEnum.GetRegions(); return(regions != null); }
private void InitSettings() { //load settings if (stateList.Count < 2 && StateXML.Length > 3 && Initialize) { try { stateList = State.DataDeserializeState(StateXML); transitionList = Transition.DataDeserializeTransition(TransitionXML); if (RegionXML.Length > 3) { regionList = AutomataRegion.DataDeserializeRegion(RegionXML); } } catch { debug = "Loading XML Graph failed!"; } //new enum technique //EnumManager.UpdateEnum(myGUID + "_States", stateList[0].Name, stateList.Select(x => x.Name).ToArray()); stateList.ForEach(state => StatesEnum.AddEntry(state.Name)); //EnumManager.UpdateEnum(myGUID + "_Transitions", transitionList[0].Name, transitionList.Select(x => x.Name).Distinct().ToArray()); transitionList.ForEach(transition => TransitionsEnum.AddEntry(transition.Name)); //EnumManager.UpdateEnum(myGUID + "_Regions", regionList[0].Name, regionList.Select(x => x.Name).ToArray()); regionList.ForEach(region => RegionsEnum.AddEntry(region.Name)); //EnumManager.UpdateEnum(myGUID + "_AllTransitions", transitionList[0].Name, transitionList.Select(x => x.Name).ToArray()); //repair relation foreach (Transition transition in transitionList) { transition.startState = stateList.First(x => x.ID.Contains(transition.startState.ID)); transition.endState = stateList.First(x => x.ID.Contains(transition.endState.ID)); } this.Invalidate(); previousPosition = MousePosition; p.StagePos.X = 0; p.StagePos.Y = 0; Initialize = false; } else if (stateList.Count < 2 && Initialize) { //add state to state list stateList.Add(new State() { ID = "Init", Name = "Init", Bounds = new Rectangle(new Point(0, 0), new Size(p.StateSize, p.StateSize)) }); UpdateStateConfigs(); // update JSON,Enums and Redraw this.Invalidate(); previousPosition = MousePosition; p.StagePos.X = 0; p.StagePos.Y = 0; Initialize = false; } }