Example #1
0
        private void SetUIControllerData()
        {
            AquaControllerCmd cmd = (AquaControllerCmd)cbContrAccUpdate.SelectedItem;
            var runDataList       = AquaController.GetAllRunData();

            bool cmdExists = runDataList.Exists(x => x.accType == cmd.AccTypeMap);

            if (!cmdExists)
            {
                return;
            }

            RunData data = runDataList.Find(x => x.accType == cmd.AccTypeMap);

            cbEnabled.Checked = data.enabled;

            dtpNextRun.Value = data.GetNextRun();

            if (cmd.TheAccType == AquaControllerCmd.AccType.WaterPump ||
                cmd.TheAccType == AquaControllerCmd.AccType.DryDoser) //putting dry doser here for now, not sure how run ever works on arduino for dry doser.
            {
                //var runEvery = AquaControllerCmd.PumpRunEveryInHrs.Find(x => x.Value == data.GetRunEvery().TotalHours);
                var runEvery = AquaControllerCmd.PumpRunEveryInHrs.FindClosest(data.GetRunEvery().TotalSeconds);
                cbRunEvery.Text = runEvery.Name;

                var dur = AquaControllerCmd.PumpRunDur.FindClosest(data.runDurration);
                cbRunDuration.Text = dur;
            }
            else
            {
                var runEvery = AquaControllerCmd.MicrosMacrosRunEveryInHrs.FindClosest(data.GetRunEvery().TotalSeconds);
                if (runEvery != null)
                {
                    cbRunEvery.Text = runEvery.Name;
                }
                var dur = AquaControllerCmd.MicrosMacrosRunDur.FindClosest(data.runDurration);
                cbRunDuration.Text = dur;
            }
        }
Example #2
0
        private void DataBindUIAccInfoData()
        {
            lblAccRunInfo.Text = "";

            AquaControllerCmd cmd = (AquaControllerCmd)cbContrAccInfo.SelectedItem;
            var runDataList       = AquaController.GetAllRunData();

            bool cmdExists = runDataList.Exists(x => x.accType == cmd.AccTypeMap);

            if (!cmdExists)
            {
                lblAccRunInfo.Text = "diabled";
                return;
            }

            RunData data = runDataList.Find(x => x.accType == cmd.AccTypeMap);

            if (!data.enabled)
            {
                lblAccRunInfo.Text = "diabled";
                return;
            }

            lblAccRunInfo.Text = string.Format("Next Run: {0:MM/dd/yyyy h:mm tt}{1}Last Run: {2:MM/dd/yyyy h:mm tt}", data.GetNextRun(), Environment.NewLine, data.GetLastRun());
        }