Exemple #1
0
 void ToolStripMenuItem1Click(object sender, EventArgs e)
 {
     // dodanie silników krokowych
     Steppers.AddEditStepperDevice d = new Steppers.AddEditStepperDevice(Configuration, null, (treeView1.SelectedNode as InterfaceTreeNode).Interface);
     if (d.ShowDialog(this) == DialogResult.OK)
     {
         TreeNode node = new TreeNode(d.StepperDevice.Name2);
         node.Tag = d.StepperDevice;
         ((InterfaceTreeNode)treeView1.SelectedNode).Nodes.Add(node);
         treeView1.SelectedNode = node;
         ShowSteppers();
     }
 }
Exemple #2
0
        void Button4Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode == null || treeView1.SelectedNode == _root)
            {
                return;
            }

            if (treeView1.SelectedNode is InterfaceTreeNode)
            {
                RS232Configuration     rs = ((InterfaceTreeNode)treeView1.SelectedNode).Interface;
                AddEditInterfaceDialog d  = new AddEditInterfaceDialog(Configuration, rs);
                if (d.ShowDialog(this) == DialogResult.OK)
                {
                    ((InterfaceTreeNode)treeView1.SelectedNode).RefreshText();
                    ShowInfo();
                }
            }

            if (treeView1.SelectedNode.Tag is LCDDevice)
            {
                LCDDevice        dev = (LCDDevice)treeView1.SelectedNode.Tag;
                AddEditLCDDevice d   = new AddEditLCDDevice(Configuration, Array.IndexOf(Configuration.LCDDevices, dev), dev.Interface);
                if (d.ShowDialog(this) == DialogResult.OK)
                {
                    treeView1.SelectedNode.Text = dev.Name2;
                    ShowInfo();
                    if (d.LCDReduction)
                    {
                        ShowLCDAreas();
                    }
                }
            }

            if (treeView1.SelectedNode.Tag is LEDDevice)
            {
                LEDDevice        dev = (LEDDevice)treeView1.SelectedNode.Tag;
                AddEditLEDDevice d   = new AddEditLEDDevice(Configuration, Array.IndexOf(Configuration.LEDDevices, dev), dev.Interface);
                if (d.ShowDialog(this) == DialogResult.OK)
                {
                    treeView1.SelectedNode.Text = dev.Name2;
                    ShowInfo();
                    ShowLEDs();
                }
            }

            if (treeView1.SelectedNode.Tag is LEDDisplayDevice)
            {
                LEDDisplayDevice dev            = (LEDDisplayDevice)treeView1.SelectedNode.Tag;
                AddEditLEDDisplayDeviceDialog d = new AddEditLEDDisplayDeviceDialog(Configuration, Array.IndexOf(Configuration.LEDDisplayDevices, dev), dev.Interface);
                if (d.ShowDialog(this) == DialogResult.OK)
                {
                    treeView1.SelectedNode.Text = dev.Name2;
                    ShowInfo();
                    ShowLEDDisplays();
                }
            }

            if (treeView1.SelectedNode.Tag is Steppers.StepperDevice)
            {
                Steppers.StepperDevice        dev = (Steppers.StepperDevice)treeView1.SelectedNode.Tag;
                Steppers.AddEditStepperDevice d   = new Steppers.AddEditStepperDevice(Configuration, dev, dev.Interface);
                if (d.ShowDialog(this) == DialogResult.OK)
                {
                    treeView1.SelectedNode.Text = dev.Name2;
                    ShowInfo();
                    ShowSteppers();
                }
            }

            if (treeView1.SelectedNode.Tag is Servos.ServoDevice)
            {
                Servos.ServoDevice        dev = (Servos.ServoDevice)treeView1.SelectedNode.Tag;
                Servos.AddEditServoDevice d   = new Servos.AddEditServoDevice(Configuration, Array.IndexOf(Configuration.ServoDevices, dev), dev.Interface);
                if (d.ShowDialog(this) == DialogResult.OK)
                {
                    treeView1.SelectedNode.Text = dev.Name2;
                    ShowInfo();
                    ShowServos();
                }
            }

            if (treeView1.SelectedNode.Tag is KeysDevice)
            {
                KeysDevice       dev = (KeysDevice)treeView1.SelectedNode.Tag;
                AddEditKeyDevice d   = new AddEditKeyDevice(Configuration, Array.IndexOf(Configuration.KeysDevices, dev), dev.Interface);
                if (d.ShowDialog(this) == DialogResult.OK)
                {
                    treeView1.SelectedNode.Text = dev.Name2;
                    ShowInfo();
                    ShowKeys();
                }
            }
        }