protected void AddOrbsCollectionData(string system) { OrbsCollectionDataSerializer oss = new OrbsCollectionDataSerializer(system); if (oss != null) { OrbsCollectionData ocd = oss.Data as OrbsCollectionData; if (ocd == null) { ocd = new OrbsCollectionData(); ocd.OrbsSystemName = system; } if (ocd.OrbsMapCollection == null) { ocd.OrbsMapCollection = new List <OrbsMapCollection>(); } if (ocd.OrbsMapCollection.Count == 0) { ocd.OrbsMapCollection.Add(new OrbsMapCollection() { MapType = tAstroMapType.NATAL, PlanetsAspectsOrbsCollection = new List <PlanetsAspectsOrbsPairsCollection>() }); } OrbsCollection.Add(ocd); } }
private void OnCopyOrbsByAspect(object sender, EventArgs e) { bool isOK = false; AspectType atFrom = Utilities.FromStringToEnumType <AspectType>(cmbAspectFrom.SelectedValue.ToString(), "AT_"); AspectType atTo = Utilities.FromStringToEnumType <AspectType>(cmbAspectTo.SelectedValue.ToString(), "AT_"); OrbsCollectionData ocd = OrbsCollection.Where(x => x.OrbsSystemName == CurrentSystem).FirstOrDefault(); OrbsMapCollection omc = ocd.OrbsMapCollection.Where(x => x.MapType == MapType).FirstOrDefault(); foreach (PlanetsAspectsOrbsPairsCollection papc in omc.PlanetsAspectsOrbsCollection) { tPlanetType pt = papc.PlanetType; AspectOrbsPair aop1 = papc.AspectOrbsCollection.Where(x => x.AspectType == atFrom).FirstOrDefault(); if (aop1 != null) { AspectOrbsPair aop2 = papc.AspectOrbsCollection.Where(x => x.AspectType == atTo).FirstOrDefault(); if (aop2 == null) { aop2 = new AspectOrbsPair(); aop2.AspectType = atTo; papc.AspectOrbsCollection.Add(aop2); } aop2.OrbValue = aop1.OrbValue; isOK = true; } } if (isOK) { InitTable(); } }
private void OnOrbsClicked(object sender, EventArgs e) { //HousesData selectedsys = null; using (dlgOrbsSystem dlg = new dlgOrbsSystem()) { if (dlg.ShowDialog() == DialogResult.OK) { OrbsCollectionData = dlg.GetOrbsCollectionData(); } } }
protected void InitTable() { OrbsCollectionData ocd = OrbsCollection.Where(x => x.OrbsSystemName == CurrentSystem).FirstOrDefault(); OrbsMapCollection omc = ocd.OrbsMapCollection.Where(x => x.MapType == MapType).FirstOrDefault(); if (omc == null || omc.PlanetsAspectsOrbsCollection == null) { omc = new OrbsMapCollection(); omc.MapType = MapType; omc.PlanetsAspectsOrbsCollection = new List <PlanetsAspectsOrbsPairsCollection>(); ocd.OrbsMapCollection.Add(omc); } UpdateViewPanel(omc.PlanetsAspectsOrbsCollection); }
private void SaveData() { OrbsCollectionData ocd = OrbsCollection.Where(x => x.OrbsSystemName == CurrentSystem).FirstOrDefault(); if (ocd != null) { OrbsSystemListProcessor proc = new OrbsSystemListProcessor(); proc.AddNewSystem(CurrentSystem); OrbsCollectionDataSerializer ser = new OrbsCollectionDataSerializer(CurrentSystem); ser.Data = ocd; ser.Save(); //this.DialogResult = DialogResult.OK; } }
protected void CreateDefaultData() { Data = new OrbsCollectionData() { OrbsSystemName = _system, OrbsMapCollection = new List <OrbsMapCollection>() }; for (int imap = (int)tAstroMapType.NATAL; imap < (int)tAstroMapType.NUMBER_DYNAMIC_TYPES; imap++) { Data.OrbsMapCollection.Add( new OrbsMapCollection() { MapType = (tAstroMapType)imap, PlanetsAspectsOrbsCollection = new List <PlanetsAspectsOrbsPairsCollection>() } ); for (int pt = (int)tPlanetType.PT_SUN; pt <= (int)tPlanetType.PT_PLUTO; ++pt) { PlanetsAspectsOrbsPairsCollection poc = new PlanetsAspectsOrbsPairsCollection() { PlanetType = (tPlanetType)pt, AspectOrbsCollection = new List <AspectOrbsPair>() }; for (int iasp = 0; iasp < Constants._aspects.Count; ++iasp) { AspectType at = Utilities.FromStringToEnumType <AspectType>(Constants._aspects[iasp], "AT_"); poc.AspectOrbsCollection.Add( new AspectOrbsPair() { AspectType = at, OrbValue = 1 } ); } Data.OrbsMapCollection[0].PlanetsAspectsOrbsCollection.Add(poc); } } InitDefaults(); }
private void btnNew_Click(object sender, EventArgs e) { using (dlgSomethingNew dlg = new dlgSomethingNew("Orbs System")) { if (dlg.ShowDialog() == DialogResult.OK) { CurrentSystem = dlg.NewValue; OrbsSystemListProcessor proc = new OrbsSystemListProcessor(); proc.AddNewSystem(CurrentSystem); cmbExisting.DataSource = proc.OrbsSystemList; cmbExisting.SelectedItem = CurrentSystem; OrbsCollectionData newcol = new OrbsCollectionData(); newcol.OrbsSystemName = CurrentSystem; newcol.OrbsMapCollection = new List <OrbsMapCollection>(); OrbsCollection.Add(newcol); InitTable(); } } }
public void SetData(OrbsCollectionData data) { _serializer.Data = data; _serializer.Save(); }
public OrbsCollectionData GetOrbsCollectionData() { OrbsCollectionData ocd = OrbsCollection.Where(x => x.OrbsSystemName == CurrentSystem).FirstOrDefault(); return(ocd); }
private void OnCopyOrbsByMap(object sender, EventArgs e) { bool isOK = false; tAstroMapType typeFrom = Utilities.FromStringToEnumType <tAstroMapType>(cmbMapFrom.SelectedValue.ToString()); tAstroMapType typeTo = Utilities.FromStringToEnumType <tAstroMapType>(cmbMapTo.SelectedValue.ToString()); OrbsCollectionData ocd = OrbsCollection.Where(x => x.OrbsSystemName == CurrentSystem).FirstOrDefault(); OrbsMapCollection mapFrom = ocd.OrbsMapCollection.Where(x => x.MapType == typeFrom).FirstOrDefault(); OrbsMapCollection mapTo = ocd.OrbsMapCollection.Where(x => x.MapType == typeTo).FirstOrDefault(); if (mapFrom != null) { if (mapTo == null) { mapTo = new OrbsMapCollection(); mapTo.MapType = typeTo; mapFrom.PlanetsAspectsOrbsCollection = new List <PlanetsAspectsOrbsPairsCollection>(); ocd.OrbsMapCollection.Add(mapTo); } foreach (PlanetsAspectsOrbsPairsCollection collectionFrom in mapFrom.PlanetsAspectsOrbsCollection) { tPlanetType ptypeFrom = collectionFrom.PlanetType; PlanetsAspectsOrbsPairsCollection collectionTo = mapTo.PlanetsAspectsOrbsCollection.Where(x => x.PlanetType == ptypeFrom).FirstOrDefault(); if (collectionTo == null) { collectionTo = new PlanetsAspectsOrbsPairsCollection(); collectionTo.PlanetType = ptypeFrom; collectionTo.AspectOrbsCollection = new List <AspectOrbsPair>(); mapTo.PlanetsAspectsOrbsCollection.Add(collectionTo); } foreach (AspectOrbsPair orbs in collectionFrom.AspectOrbsCollection) { AspectType at = orbs.AspectType; double dorbval = orbs.OrbValue; AspectOrbsPair orb2 = collectionTo.AspectOrbsCollection.Where(x => x.AspectType == at).FirstOrDefault(); if (orb2 == null) { orb2 = new AspectOrbsPair() { AspectType = at }; collectionTo.AspectOrbsCollection.Add(orb2); } orb2.OrbValue = dorbval; } } isOK = true; } if (isOK) { InitTable(); string tabname = Utilities.FromUpperCaseToLowerWithFirstCapital <tAstroMapType>(mapTo.MapType); int ipos = tabname.IndexOf(" "); if (ipos >= 0) { tabname = tabname.Replace(" ", ""); } tabname = $"tab{tabname}"; TabPage tp = tabCollectionsOrbs.TabPages[tabname]; tabCollectionsOrbs.SelectedTab = tp; } }
protected void LoadOrbsCollectionData() { OrbsCollectionDataFactory fact = new OrbsCollectionDataFactory(_userpref.OrbsSystemName); OrbsCollectionData = fact.Data; }
protected void GetData() { _fact = new OrbsCollectionDataFactory(CurrentSystem); Data = _fact.Data; }