コード例 #1
0
        static void Main()
        {
            BrewingProcessHandler brewingProcessHandler = BrewingProcessHandler.GetInstance();
            //brewingProcessHandler.StartNewBrew("09/09/2018", "Maltina", "258");
            //ApplicationSettings appsettings = new ApplicationSettings();
            MyAppSettings appSettings = MyAppSettings.GetInstance();

            //string connectionString = appsettings.ConnectionString;
            //string templateFilePath = appsettings.TemplateFilePath;
            string connectionString       = appSettings.ConnectionString;
            string periodTemplateFilePath = appSettings.PeriodTemplateFilePath;
            //string templateFilePath = $"{AppDomain.CurrentDomain.BaseDirectory}period_template.xlsx";

            // Setup Datasource Handler
            Datasource        datasource        = new XlDatasource(connectionString, periodTemplateFilePath);
            DatasourceHandler datasourceHandler = DatasourceHandler.GetInstance(datasource);

            // Gui Thread
            ThreadStart guiRef    = new ThreadStart(StartGui);
            Thread      guiThread = new Thread(guiRef);

            guiThread.Start();

            // Main thread
            //BrewMonitorTimer brewMonitorTimer = BrewMonitorTimer.GetInstance();
            //BrewMonitorTimer.Startup();
            StartBrewMonitor();

            //TestDataSource();
        }
 public CompleteWortCopperProcessStepCommand(string brandName, string brewNumber, string fieldName, string fieldValue, string fieldSection)
 {
     this._brandName            = brandName;
     this._brewNumber           = brewNumber;
     this._fieldName            = fieldName;
     this._fieldValue           = fieldValue;
     this._fieldSection         = fieldSection;
     this.brewingProcessHandler = BrewingProcessHandler.GetInstance();
 }
コード例 #3
0
 public StartWortCopperHeatingCommand(string startDate, string startTime, string brandName, string brewNumber, string fieldName, string fieldValue, string fieldSection)
 {
     this._startDate            = startDate;
     this._startTime            = startTime;
     this._brandName            = brandName;
     this._brewNumber           = brewNumber;
     this._fieldName            = fieldName;
     this._fieldValue           = fieldValue;
     this._fieldSection         = fieldSection;
     this.brewingProcessHandler = BrewingProcessHandler.GetInstance();
 }
コード例 #4
0
 public StartMashCopperMashingInCommand(string startDate, string startTime, string brandName, string brewNumber, string fieldName, string fieldValue, string fieldSection)
 {
     _startDate            = startDate;
     _startTime            = startTime;
     _brandName            = brandName;
     _brewNumber           = brewNumber;
     _fieldName            = fieldName;
     _fieldValue           = fieldValue;
     _fieldSection         = fieldSection;
     brewingProcessHandler = BrewingProcessHandler.GetInstance();
 }
コード例 #5
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();
            }
        }
コード例 #6
0
        public AppForm()
        {
            //Initialize picturebox static parameters
            ProcessViewPictureBox.ImagesFolderPath = imagesFolderPath;
            ProcessViewPictureBox.ProcessViewScale = processViewScale;

            // Default Constructor
            Text = "Windows Forms app";

            // Model & Controller for process parameters views
            brewingProcessHandler = BrewingProcessHandler.GetInstance();
            guiModel = brewingProcessHandler;
            // Register with BrewingProcessHandler Subject
            guiModel.Attach(this);

            brewParametersGuiModel    = new BrewParametersGuiModel();
            guiProcessParametersModel = brewParametersGuiModel;
            ReportGenerator reportGenerator = new XlReportGenerator();

            guiController = new BrewLoggerGuiController(guiProcessParametersModel, this, reportGenerator);
            // Register with BrewParametersGuiModel Subject
            guiProcessParametersModel.Attach(this);

            // Model for process equipment view
            //processViewModel = new ProcessViewModel();
            //processViewModel.AddObserver(this);

            this.Size = new Size(1200, 800);

            //Setup GUI elements
            SetupProcessView();
            SetupNewBrewView();
            SetupBrewsListView();
            SetupProcessEquipmentParametersView();
            SetupReportView();

            render();
        }