コード例 #1
0
ファイル: ThisWorkbook.cs プロジェクト: tupseny/SecretaryST
        public static void StartProtocol2Generate()
        {
            DistanceGroupAmount amount  = DistanceGroupAmount.Two;
            List <string>       headers = Settings.StartProtOptions.StartProtGroup2.ChoosedHeaders;
            StartTimer          timer   = new StartTimer(Globals.Options.FirstStartTime2, Globals.Options.StartInterval2);

            StartProtocolGenerate(amount, timer, headers);
        }
コード例 #2
0
ファイル: ThisWorkbook.cs プロジェクト: tupseny/SecretaryST
        private static void StartProtocolGenerate(DistanceGroupAmount amnt, StartTimer timer, List <string> lHeaders = null)
        {
            //all distances
            List <Distance> lDistances = База.DbList;

            //get all protocol variants
            Dictionary <DistanceLevels, List <DistanceGroupType> > lVariants = new Dictionary <DistanceLevels, List <DistanceGroupType> >();

            foreach (Distance d in lDistances)
            {
                DistanceLevels level = d.Level;
                if (!lVariants.ContainsKey(level))
                {
                    lVariants.Add(level, new List <DistanceGroupType>());
                }

                foreach (KeyValuePair <Structs.GroupIndexAmountStruct, DistanceGroup> kvPair in d.Groups)
                {
                    if (!lVariants[level].Contains(kvPair.Value.Type))
                    {
                        lVariants[level].Add(kvPair.Value.Type);
                    }
                }
            }

            //generate protocol for each distance type
            foreach (KeyValuePair <DistanceLevels, List <DistanceGroupType> > kvPair in lVariants)
            {
                foreach (DistanceGroupType type in kvPair.Value)
                {
                    Distance distance = База.GetOneDistance(amnt, kvPair.Key, type);

                    if (distance.Groups.Count > 0)
                    {
                        string nameSuffix = kvPair.Key.ToString() + "_" + EnumCasters.GroupTypeStringRepresent(type);

                        StartProtocolGenerator generator = new StartProtocolGenerator(amnt, timer);

                        if (lHeaders != null)
                        {
                            generator.LHeaders = lHeaders;
                        }

                        generator.Create(distance, suffix: nameSuffix);

                        timer.Reset();
                    }
                }
            }
        }