private void doadditemoepration()
        {
            if (treeView1.SelectedNode.Parent == null && root.IsSelected && chekroot == "Assy")
            {
                //contextMenuStrip1.Items[1].Enabled = true;
                //contextMenuStrip1.Items[0].Enabled = false;
                SPM_ConnectItems connectItems = new SPM_ConnectItems();
                connectItems.ShowDialog();
                try
                {
                    string _itemno       = SPM_ConnectItems.ItemNo;
                    string _description  = SPM_ConnectItems.description;
                    string _family       = SPM_ConnectItems.family;
                    string _oem          = SPM_ConnectItems.oem;
                    string _manufacturer = SPM_ConnectItems.Manufacturer;

                    SearchNodes(_itemno, treeView1.Nodes[0]);
                    if (itemexists != "yes")
                    {
                        TreeNode childNode;

                        childNode = new TreeNode
                        {
                            Text = _itemno + " - " + _description + " (1)",
                            Tag  = _itemno + "][" + _description + "][" + _family + "][" + _manufacturer + "][" + _oem + "][1"
                        };
                        treeView1.SelectedNode.Nodes.Add(childNode);
                        childNode.Tag = _itemno + "][" + _description + "][" + _family + "][" + _manufacturer + "][" + _oem + "][1";
                    }
                    else
                    {
                        itemexists = null;
                    }
                    if (!Expandchk.Checked)
                    {
                        treeView1.ExpandAll();
                    }
                }
                catch (Exception)
                {
                    return;
                    //MessageBox.Show(ex.Message);
                }
            }
            else
            {
                contextMenuStrip1.Items[0].Enabled = true;
                contextMenuStrip1.Items[1].Enabled = false;
            }
        }
예제 #2
0
        private void AddItemToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode.Parent == null && root.IsSelected && chekroot == "Assy")
            {
                //contextMenuStrip1.Items[1].Enabled = true;
                //contextMenuStrip1.Items[0].Enabled = false;
                SPM_ConnectItems connectItems = new SPM_ConnectItems();
                connectItems.ShowDialog();
                try
                {
                    string _itemno       = SPM_ConnectItems.ItemNo;
                    string _description  = SPM_ConnectItems.description;
                    string _family       = SPM_ConnectItems.family;
                    string _oem          = SPM_ConnectItems.oem;
                    string _manufacturer = SPM_ConnectItems.Manufacturer;

                    _SearchNodes(_itemno, treeView1.Nodes[0]);
                    if (itemexists != "yes")
                    {
                        TreeNode childNode;

                        childNode = new TreeNode
                        {
                            Text = _itemno + " - " + _description + " (1)",
                            Tag  = _itemno + "][" + _description + "][" + _family + "][" + _manufacturer + "][" + _oem + "][1"
                        };
                        treeView1.SelectedNode.Nodes.Add(childNode);
                        childNode.Tag = _itemno + "][" + _description + "][" + _family + "][" + _manufacturer + "][" + _oem + "][1";
                    }
                    else
                    {
                        itemexists = null;
                    }
                    if (!Expandchk.Checked)
                    {
                        treeView1.ExpandAll();
                    }
                }
                catch
                {
                    return;
                }
            }
            else
            {
                Addremovecontextmenu.Items[0].Enabled = true;
                Addremovecontextmenu.Items[1].Enabled = false;
            }
        }