示例#1
0
        static void Main(string[] args)
        {
            Clynic.InitializeParams(new Dictionary <Params, object>()
            {
                { Params.OrdinNum, 20 },
                { Params.DocNum, 6 },
                { Params.DP, 0.4 },
                { Params.Stats, true },
                { Params.UpdatePeriod, 2000 },
                { Params.MaxTime, 50 },
                { Params.PatientCome, 0.5 },
                { Params.StatPeople, 120 },
                { Params.ToFile, true },
                { Params.FileOut, "out.txt" }
            });

            Clynic.StartProcess();

            Console.ReadKey();
        }
示例#2
0
        public static void InitializeParams(Dictionary <Params, object> Parametres)
        {
            StringBuilder StartingInfo = new StringBuilder();

            foreach (var Element in Parametres)
            {
                StartingInfo.Append($" {Element.Key} -> {Element.Value}\n");


                switch (Element.Key)
                {
                case Params.DocNum:
                    _MaxNumOfDoctors = Math.Abs((int)Element.Value);
                    break;

                case Params.StatPeople:
                    _StartNumOfHumans = Math.Abs((int)Element.Value);
                    break;

                case Params.ToFile:
                    _WriteLogToFile = (bool)(Element.Value);
                    break;

                case Params.MaxTime:
                    _MaxTime = Math.Abs((int)Element.Value);
                    break;

                case Params.DP:
                    _DoctorNHFProbability = Math.Abs((double)Element.Value);
                    break;

                case Params.Stats:
                    _ShowStats = (bool)Element.Value;
                    break;

                case Params.UpdatePeriod:
                    _DrawUpdatePeriod = Math.Abs((int)Element.Value);
                    break;

                case Params.PatientCome:
                    _PatientComeProbability = Math.Abs((double)Element.Value);
                    break;

                case Params.OrdinNum:
                    _MaxNumInOrRoom = Math.Abs((int)Element.Value);
                    break;

                case Params.FileOut:
                    _OutputFile = (string)(Element.Value);
                    break;

                default:
                    break;
                }
            }

            if (_WriteLogToFile)
            {
                try
                {
                    if (_OutputFile.Length != 0)
                    {
                        _OutputWriter = File.AppendText(_OutputFile);
                    }
                }
                catch (IOException FileOpenError)
                {
                    Print("Не могу открыть файлик", true);
                    Print(FileOpenError.Message, true);
                    return;
                }
            }

            Print($"Запустим со следующими значениями: {StartingInfo.ToString()}", true);

            //Иницилизируем людей в очереди
            for (int i = 0; i < _StartNumOfHumans; ++i)
            {
                Clynic.PatientCome();
            }


            Thread.Sleep(2000);
        }