コード例 #1
0
        public void CreateBrewInProcess(string filePath, string brewNumber)
        {
            UpdateProcessFields(filePath, brewNumber);
            BrewInProcess brewInProcess = new BrewInProcess(filePath, brewNumber, _processHeaderFields, _processSectionFields);

            if (!_brewsInProcess.ContainsKey(brewNumber))
            {
                _brewsInProcess.Add(brewNumber, brewInProcess);
            }
        }
コード例 #2
0
        private void AddToWatchList(string filePath, string brandName, string brewNumber)
        {
            _brewLoader.CreateBrewInProcess(filePath, brewNumber);
            //Console.WriteLine("In AddToWatchList");
            BrewInProcess nBrewInProcess = _brewLoader.GetBrewInProcess(filePath, brewNumber);

            //Add to watchlist
            if (!_brewsInProcess.ContainsKey(nBrewInProcess.BrewNumber))
            {
                _brewsInProcess.Add(nBrewInProcess.BrewNumber, nBrewInProcess);
            }
        }
コード例 #3
0
        public void MonitorBrews()
        {
            isMonitoring = true;
            Console.WriteLine("In MonitorBrews!");
            foreach (KeyValuePair <string, BrewInProcess> brewInProcess in _brewsInProcess)
            {
                Console.WriteLine("In _brewsInProcess count!");
                string brewNumber = brewInProcess.Key.Trim();
                _brewInProcess = brewInProcess.Value;
                string filePath = _brewInProcess.FilePath;

                Console.WriteLine("Before: Has new field? " + _brewInProcess.HasNewField().ToString());

                //Get updated brew in process
                _brewInProcess = _brewLoader.GetBrewInProcess(filePath, brewNumber);

                //Console.WriteLine("After: Has new field? " + _brewInProcess.HasNewField().ToString());

                if (_brewInProcess.HasNewField())
                {
                    Console.WriteLine("In HasNewField!");
                    foreach (KeyValuePair <string, ConcurrentDictionary <string, string> > section in _brewInProcess.NewField)
                    {
                        IDictionary <string, string> sectionFields = new Dictionary <string, string>();
                        sectionFields = section.Value;
                        foreach (KeyValuePair <string, string> field in sectionFields)
                        {
                            string fieldName    = field.Key;
                            string fieldValue   = field.Value;
                            string fieldSection = section.Key;

                            Console.WriteLine("Has new field!");
                            Console.WriteLine(fieldSection + ": " + fieldSection);
                            Console.WriteLine(fieldName + ": " + fieldValue);

                            BrewingProcessHandler brewingProcessHandler = BrewingProcessHandler.GetInstance();
                            Brew brew = brewingProcessHandler.GetBrew(_brewInProcess.BrewNumber);

                            LiveBrewCommandDispatcherFactory liveBrewCommandDispatcherFactory = LiveBrewCommandDispatcherFactory.GetInstance();
                            LiveBrewCommandDispatcher        liveBrewCommandDispatcher        = liveBrewCommandDispatcherFactory.GetLiveBrewCommandDispatcher(fieldSection);

                            liveBrewCommandDispatcher.CreateLiveBrewCommands(fieldName, fieldValue, brew, fieldSection);
                            liveBrewCommandDispatcher.SendAllCommands();
                        }
                    }
                }
                _brewInProcess.ResetNewField();
            }
        }
コード例 #4
0
        public BrewInProcess GetBrewInProcess(string filePath, string brewNumber)
        {
            Console.WriteLine("In GetBrewInProcess!");
            BrewInProcess brewInProcess = null;

            UpdateProcessFields(filePath, brewNumber);

            if (_brewsInProcess.ContainsKey(brewNumber))
            {
                Console.WriteLine("In _brewsInProcess.ContainsKey(brewNumber)!");
                brewInProcess = _brewsInProcess[brewNumber];
                Console.WriteLine("");
                brewInProcess.Update(this._processHeaderFields, this._processSectionFields);
            }

            return(brewInProcess);
        }