Пример #1
0
 public void CheckDate(RandomMessage randomMessages, int groupBefore1, int groupBefore2, int remove1, int remove2, int passiveGroup1, int passiveGroup2, int passiveAdd1, int passiveAdd2)
 {
     try
     {
         if (Secs < randomMessages.AnswerPause1[Step] || Secs > randomMessages.AnswerPause2[Step] ||
             Mins <randomMessages.AnswerNoPause1[Step] || Mins> randomMessages.AnswerNoPause2[Step])
         {
             ChangeDate(randomMessages, groupBefore1, groupBefore2, remove1, remove2, passiveGroup1, passiveGroup2, passiveAdd1, passiveAdd2, false);
         }
     }
     catch { }
 }
Пример #2
0
        public void ChangeDate(RandomMessage randomMessages, int groupBefore1, int groupBefore2, int remove1, int remove2, int passiveGroup1, int passiveGroup2, int passiveAdd1, int passiveAdd2, bool refreshDate = true)
        {
            try
            {
                if (refreshDate)
                {
                    Date = DateTime.Now;
                }
                int pause1 = 0, pause2 = 0, pause3 = 0, pause4 = 0;
                if (Step == 7)
                {
                    Completed = true;
                }
                if (Added && AddedGroup)
                {
                    pause1 = remove1;
                    pause2 = remove2;
                    pause3 = remove1 * 60;
                    pause4 = remove2 * 60;
                }
                else if (Step == 7)
                {
                    pause1          = groupBefore1;
                    pause2          = groupBefore2;
                    pause3          = groupBefore1 * 60;
                    pause4          = groupBefore2 * 60;
                    DateEndedDialog = DateTime.Now;
                }
                else
                {
                    pause1 = randomMessages.AnswerPause1[Step];
                    pause2 = randomMessages.AnswerPause2[Step];
                    pause3 = randomMessages.AnswerNoPause1[Step];
                    pause4 = randomMessages.AnswerNoPause2[Step];
                }
                var ms1 = Convert.ToInt64(TimeSpan.FromSeconds(pause1).TotalMilliseconds);
                var ms2 = Convert.ToInt64(TimeSpan.FromSeconds(pause2).TotalMilliseconds);
                Secs = Helper.LongRandom(ms1, ms2, random) / 1000d;
                ms1  = Convert.ToInt64(TimeSpan.FromMinutes(pause3).TotalMilliseconds);
                ms2  = Convert.ToInt64(TimeSpan.FromMinutes(pause4).TotalMilliseconds);
                Mins = Helper.LongRandom(ms1, ms2, random) / 60000d;

                ms1 = Convert.ToInt64(TimeSpan.FromMinutes(passiveGroup1).TotalMilliseconds);
                ms2 = Convert.ToInt64(TimeSpan.FromMinutes(passiveGroup2).TotalMilliseconds);
                PassiveGroupMins = Helper.LongRandom(ms1, ms2, random) / 60000d;
                ms1            = Convert.ToInt64(TimeSpan.FromMinutes(passiveAdd1).TotalMilliseconds);
                ms2            = Convert.ToInt64(TimeSpan.FromMinutes(passiveAdd2).TotalMilliseconds);
                PassiveAddMins = Helper.LongRandom(ms1, ms2, random) / 60000d;
            }
            catch { }
        }