コード例 #1
0
ファイル: Dashboard.cs プロジェクト: willwhitehead94/SCIPA
        private void add_bNewAction_Click(object sender, EventArgs e)
        {
            //Save the new Device.
            add_bSaveNewDevice.PerformClick();

            //Create and display the DataBoard form.
            var window = new DataBoard(_communicator, _selectedDevice);
            window.GoToActionPage();
            window.ShowDialog();

            //Get the Comm object created.
            _action = window.GetAction();

            //Update the labels.
            UpdateStartLabels();
        }
コード例 #2
0
ファイル: Dashboard.cs プロジェクト: willwhitehead94/SCIPA
        private void modrules_bSetAction_Click(object sender, EventArgs e)
        {
            //Save the Rule as it stands.
            modrules_tSave.PerformClick();

            var controller = new ActionController();
            if (controller.RetrieveActionsForRule(_rule.Id).Any())
            {
                //Get the actual Action.
                var action = controller.RetrieveActionsForRule(_rule.Id).FirstOrDefault();
                _action = action;

                //Load the values required.
                modact_cEnabled.Checked = action.Enabled;
                modact_tValue.Text = action.OutputValue;
                modact_tRule.Text = _rule.ToString();

                //Download the required communicator
                var commController = new CommunicatorController();
                var comm = commController.GetAllCommunicators().FirstOrDefault(c => c.Id == action.CommunicatorId);

                if (comm != null)
                {
                    _communicator = comm;
                    _action.Communicator = comm;
                    modact_tComm.Text = comm.ToString();
                }
                else
                {
                    modact_tComm.Text = "";
                }

                //Actions exist.
                pTabPanel.SelectedTab = pModifyActions;
            }
            else
            {
                var db = new DataBoard(_communicator,_selectedDevice);
                db.GoToActionPage(_rule);
                db.ShowDialog();

                _action = db.GetAction();
                DebugOutput.Print("Changes made in the Data Manager are saved.");
            }

        }
コード例 #3
0
ファイル: Dashboard.cs プロジェクト: willwhitehead94/SCIPA
        private void modact_bSave_Click(object sender, EventArgs e)
        {
            _action.Rule = _rule;
            _action.RuleId = _rule.Id;
            _action.Communicator = _communicator;
            _action.CommunicatorId = _communicator.Id;
            _action.OutputValue = modact_tValue.Text;
            _action.Enabled = modact_cEnabled.Checked;

            var controller = new ActionController();
            var updated = controller.UpdateAction(_action);

            if (updated == null)
            {
                DebugOutput.Print("Update of the Action failed!");
            }
            else
            {
                _action = updated;
                DebugOutput.Print("Action was updated successfully.");
            }
        }