Ejemplo n.º 1
0
        private void tglStartStopVessel(object sender, RoutedEventArgs e)
        {
            if (_viewModel.ProcessIsRunning)
            {
                (_vessel as IStirrer)?.SetStirrer(0);
                (_vessel as IStirrer)?.SetStirrerSpeed(0);
                _vessel.SetTargetTemperature(_viewModel.ToBeTemperature);

                var settings = GetSettings();

                settings.PasteurTime       = _viewModel.ToBeTime;
                settings.TargetTemperature = _viewModel.ToBeTemperature;

                SetSettings(settings);

                _vessel.Start();
            }
            else
            {
                _vessel.Stop();
                //_viewModel.VesselStartStopButtonBackground = new SolidColorBrush(Colors.Green);
                //_viewModel.VesselStartStopButtonForeground = new SolidColorBrush(Colors.Wheat);
                //_viewModel.VesselStartStopButtonText = "Start";
            }
        }
Ejemplo n.º 2
0
        public void StartStep(Step step)
        {
            if (!_run)
            {
                _stepType            = step.StepType;
                _stepNo              = step.SortOrder;
                _stepEvent.StartTime = DateTime.Now;
                _stepEvent.StepName  = step.Name;
                _stepEvent.StepNo    = _stepNo;
                _stepEvent.Duration  = step.Duration;
                _stepEvent.TimeLeft  = new TimeSpan(0, step.Duration, 0);
                _stepEvent.StepType  = step.StepType;

                _vessel.SetTargetTemperature(step.Temperature);
                (_vessel as IStirrer)?.SetStirrer(StirrerDirection.Left);
                (_vessel as IStirrer)?.SetStirrerSpeed(step.StirrerSpeed);
                _vessel.Start();
                _updateTimer.Start();
                _updateTimer_Elapsed(this, null);
                //if (step.StepType == StepType.Heating)
                //{
                //    _vessel.SetTargetTemperature(step.Temperature);
                //    _vessel.SetStirrer(StirrerDirection.Left);
                //    _vessel.SetStirrerSpeed(step.StirrerSpeed);

                //}
                //else
                if (step.StepType == StepType.HoldAuto)
                {
                    // hold
                    //_vessel.SetTargetTemperature(step.Temperature);
                    //_vessel.SetStirrer(StirrerDirection.Left);
                    //_vessel.SetStirrerSpeed(step.StirrerSpeed);

                    //var timer = new System.Timers.Timer(step.Duration * 60000);

                    _stepTimer.Interval = step.Duration * 60000;
                    _stepTimer.Enabled  = true;

                    // Hook up the event handler for the Elapsed event.
                    //timer.Elapsed += Timer_Elapsed;

                    // Only raise the event the first time Interval elapses.
                    //timer.AutoReset = false;
                }
                //else
                //{
                //    // MashIn
                //    _vessel.SetTargetTemperature(step.Temperature);
                //    _vessel.SetStirrer(StirrerDirection.Left);
                //    _vessel.SetStirrerSpeed(step.StirrerSpeed);
                //}
                _run = true;
            }
        }