Example #1
0
        private void InitMyComponents()
        {
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length > 1)
            {
                ConfigIniFileName = args[1];
            }
            if (!File.Exists(ConfigIniFileName))
            {
                OnErrorHappen("Файл "+ ConfigIniFileName + " не найден. Запуск невозможен");
                Environment.Exit(0);
            }
            IniHlp = new IniHlpClass(ConfigIniFileName);

            var newLine = IniHlp.GetDateTimeFromLine(DateThenAllowPrintPickerString);
            if (newLine.Year == 1) newLine = Convert.ToDateTime("2015-01-01");
            dateThenAllowPrintPicker.Value = newLine;

            string tempStr = string.Empty;
            tempStr = IniHlp.GetStringFromLine(NumberOfListsString);
            NumberOfLists.Text = tempStr;
            if (string.IsNullOrEmpty(tempStr)) tempStr = "1";
            MaxLists = Convert.ToUInt32(tempStr);

            tempStr = IniHlp.GetStringFromLine(MaxQuestionOnListString);
            MaxQuestionOnListText.Text = tempStr;
            if (string.IsNullOrEmpty(tempStr)) tempStr = "1";
            MaxQuestionOnListUint = Convert.ToUInt32(tempStr);

            tempStr = IniHlp.GetStringFromLine(MaxQuestionRepeatString);
            MaxQuestionRepeatText.Text = tempStr;
            if (string.IsNullOrEmpty(tempStr)) tempStr = "1";
            MaxQuestonRepeatUint= Convert.ToUInt32(tempStr);

            var bannedSymbols = IniHlp.GetStringFromLine(BannedSymbolsString);
            NewBannedSymbols1 = new BannedSymbolsClass(bannedSymbols.Split('|'));

            LSTEasyNumber = IniHlp.GetIntFromLine(EasyQuestionString);
            LSTMiddleNumber = IniHlp.GetIntFromLine(MiddleQuestionString);
            LSTHardNumber = IniHlp.GetIntFromLine(HardQuestionString);
            {
                switch (IniHlp.GetIntFromLine(ModeString))
                {
                    case 1:
                    {
                        CurrentWorkEnum = WorkLikeEnum.OnlyGenerator;
                        break;
                    }
                    case 2:
                    {
                        CurrentWorkEnum = WorkLikeEnum.GeneratorAndConst;
                        break;
                    }
                    case 3:
                    {
                        CurrentWorkEnum = WorkLikeEnum.GeneratorAndLST;
                        break;
                    }
                    default:
                        OnErrorHappen("Не указан режим работы");
                        break;
                }
            }
            ReCreateDT();
        }