コード例 #1
0
ファイル: SwitchNode.cs プロジェクト: wsrf2009/KnxUiEditor
        public static TreeNode GetActionNode()
        {
            SwitchNode nodeAction = new SwitchNode();
            nodeAction.Text = nodeAction.KNXMainNumber + "." + nodeAction.KNXSubNumber + " " + nodeAction.Name;

            DatapointActionNode actionOn = new DatapointActionNode();
            actionOn.Name = actionOn.Text = ResourceMng.GetString("On");
            actionOn.Value = 1;

            DatapointActionNode actionOff = new DatapointActionNode();
            actionOff.Name = actionOff.Text = ResourceMng.GetString("Off");
            actionOff.Value = 0;

            nodeAction.Nodes.Add(actionOn);
            nodeAction.Nodes.Add(actionOff);

            return nodeAction;
        }
コード例 #2
0
        public static TreeNode GetActionNode()
        {
            ControlDimmingNode nodeAction = new ControlDimmingNode();
            nodeAction.Text = nodeAction.KNXMainNumber + "." + nodeAction.KNXSubNumber + " " + nodeAction.Name;

            DatapointActionNode actionBrighter25per = new DatapointActionNode();
            actionBrighter25per.Name = actionBrighter25per.Text = ResourceMng.GetString("Brighter25per");
            actionBrighter25per.Value = 0x0B;

            DatapointActionNode actionBrighter50per = new DatapointActionNode();
            actionBrighter50per.Name = actionBrighter50per.Text = ResourceMng.GetString("Brighter50per");
            actionBrighter50per.Value = 0x0A;

            DatapointActionNode actionBrighter100per = new DatapointActionNode();
            actionBrighter100per.Name = actionBrighter100per.Text = ResourceMng.GetString("Brighter100per");
            actionBrighter100per.Value = 0x09;

            DatapointActionNode actionDim25per = new DatapointActionNode();
            actionDim25per.Name = actionDim25per.Text = ResourceMng.GetString("Dim25per");
            actionDim25per.Value = 0x03;

            DatapointActionNode actionDim50per = new DatapointActionNode();
            actionDim50per.Name = actionDim50per.Text = ResourceMng.GetString("Dim50per");
            actionDim50per.Value = 0x02;

            DatapointActionNode actionDim100per = new DatapointActionNode();
            actionDim100per.Name = actionDim100per.Text = ResourceMng.GetString("Dim100per");
            actionDim100per.Value = 0x01;

            nodeAction.Nodes.Add(actionBrighter25per);
            nodeAction.Nodes.Add(actionBrighter50per);
            nodeAction.Nodes.Add(actionBrighter100per);
            nodeAction.Nodes.Add(actionDim25per);
            nodeAction.Nodes.Add(actionDim50per);
            nodeAction.Nodes.Add(actionDim100per);

            return nodeAction;
        }
コード例 #3
0
        public static TreeNode GetActionNode()
        {
            SceneControlNode nodeAction = new SceneControlNode();
            nodeAction.Text = nodeAction.KNXMainNumber + "." + nodeAction.KNXSubNumber + " " + nodeAction.Name;

            DatapointActionNode actionScene1 = new DatapointActionNode();
            actionScene1.Name = actionScene1.Text = ResourceMng.GetString("Scene1");
            actionScene1.Value = 0;

            DatapointActionNode actionScene2 = new DatapointActionNode();
            actionScene2.Name = actionScene2.Text = ResourceMng.GetString("Scene2");
            actionScene2.Value = 1;

            DatapointActionNode actionScene3 = new DatapointActionNode();
            actionScene3.Name = actionScene3.Text = ResourceMng.GetString("Scene3");
            actionScene3.Value = 2;

            nodeAction.Nodes.Add(actionScene1);
            nodeAction.Nodes.Add(actionScene2);
            nodeAction.Nodes.Add(actionScene3);

            return nodeAction;
        }
コード例 #4
0
        private bool addActionToList(DatapointActionNode newAction, bool duplicateTip)
        {
            if (null == Address.Actions)
            {
                Address.Actions = new List<DatapointActionNode>();
            }

            DatapointActionNode action = getActionAccrodingToActionName(newAction.Name);
            if (null != action)
            {
                if (duplicateTip)
                {
                    MessageBox.Show(ResourceMng.GetString("Message32"), ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }


                return false;
            }

            if (KNXDataType.Bit1 == Address.Type)
            {
                if ((0 > newAction.Value) || (1 < newAction.Value))
                {
                    MessageBox.Show(ResourceMng.GetString("Message33"), ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return false;
                }
            }
            else if (KNXDataType.Bit4 == Address.Type)
            {
                if ((0 > newAction.Value) || (15 < newAction.Value))
                {
                    MessageBox.Show(ResourceMng.GetString("Message34"), ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return false;
                }
            }
            else if (KNXDataType.Bit8 == Address.Type)
            {
                if ((-127 > newAction.Value) || (255 < newAction.Value))
                {
                    MessageBox.Show(ResourceMng.GetString("Message35"), ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return false;
                }

                if ((DatapointType.DPT_5 == Address.KnxMainNumber) && (DatapointType.DPST_1 == Address.KnxSubNumber))
                {
                    if ((0 > newAction.Value) || (255 < newAction.Value))
                    {
                        MessageBox.Show(ResourceMng.GetString("Message36"), ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);

                        return false;
                    }
                }
                else if ((DatapointType.DPT_18 == Address.KnxMainNumber) && (DatapointType.DPST_1 == Address.KnxSubNumber))
                {
                    if ((0 > newAction.Value) || (255 < newAction.Value))
                    {
                        MessageBox.Show(ResourceMng.GetString("Message36"), ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);

                        return false;
                    }
                }
            }

            Address.Actions.Add(newAction);
            this.listBoxActios.Items.Add(newAction.Name);
            this.textBoxActionName.Text = "";
            this.comboBoxActionValue.Text = "";
            this.listBoxActios.Refresh();

            return true;
        }