コード例 #1
0
        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();
            }
        }
コード例 #2
0
        public void SetOrb(tAstroMapType amt, tPlanetType pt1, AspectType at, double value)
        {
            OrbsMapCollection omc = null;

            omc = Data.OrbsMapCollection.Where(x => x.MapType == amt).FirstOrDefault();

            PlanetsAspectsOrbsPairsCollection paoc = omc.PlanetsAspectsOrbsCollection.Where(x => x.PlanetType == pt1).FirstOrDefault();

            if (paoc != null)
            {
                AspectOrbsPair aop = paoc.AspectOrbsCollection.Where(x => x.AspectType == at).FirstOrDefault();
                aop.OrbValue = value;
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        protected AspectOrbsPair GetAspectOrbsPair(tAstroMapType amt, tPlanetType pt, AspectType at)
        {
            AspectOrbsPair aop = null;

            OrbsMapCollection omc = Data.OrbsMapCollection.Where(x => x.MapType == amt).First();

            if (omc != null)
            {
                PlanetsAspectsOrbsPairsCollection paopc = omc.PlanetsAspectsOrbsCollection.Where(x => x.PlanetType == pt).FirstOrDefault();
                if (paopc != null)
                {
                    aop = paopc.AspectOrbsCollection.Where(x => x.AspectType == at).First();
                }
            }
            return(aop);
        }
コード例 #5
0
        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;
            }
        }