示例#1
0
        private void layerDelAllCmd_Click(object sender, EventArgs e)
        {
            string            message = "target : " + layerListBox.SelectedItem.ToString();
            string            caption = "delete layer";
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            DialogResult      result;

            result = MessageBox.Show(message, caption, buttons);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                for (int layerindex = 1; layerindex < memoryData.LayerData.Count; layerindex++)
                {
                    for (int i = memoryData.ButtonData.Count - 1; i >= 0; i--)
                    {
                        ButtonObjstruct tar = (ButtonObjstruct)memoryData.ButtonData[i];
                        if (tar.layer == layerListBox.Items[layerindex].ToString())
                        {
                            memoryData.ButtonData.Remove(tar);
                            int index = memoryData.iconTemp.IndexOf(tar.name);
                            if (index != -1)
                            {
                                memoryData.iconTemp.RemoveAt(index);
                                memoryData.iconDelTemp.Add(tar.name);
                            }
                        }
                    }

                    for (int i = memoryData.LabelData.Count - 1; i >= 0; i--)
                    {
                        LabelObjstruct tar = (LabelObjstruct)memoryData.LabelData[i];
                        if (tar.layer == layerListBox.Items[layerindex].ToString())
                        {
                            memoryData.LabelData.Remove(tar);
                            int index = memoryData.iconTemp.IndexOf(tar.name);
                            if (index != -1)
                            {
                                memoryData.iconTemp.RemoveAt(index);
                                memoryData.iconDelTemp.Add(tar.name);
                            }
                        }
                    }

                    for (int i = memoryData.InputData.Count - 1; i >= 0; i--)
                    {
                        InputObjectstruct tar = (InputObjectstruct)memoryData.InputData[i];
                        if (tar.layer == layerListBox.Items[layerindex].ToString())
                        {
                            memoryData.InputData.Remove(tar);
                            int index = memoryData.iconTemp.IndexOf(tar.name);
                            if (index != -1)
                            {
                                memoryData.iconTemp.RemoveAt(index);
                                memoryData.iconDelTemp.Add(tar.name);
                            }
                        }
                    }

                    for (int i = memoryData.OutputButtonData.Count - 1; i >= 0; i--)
                    {
                        OutputButtonObjectstruct tar = (OutputButtonObjectstruct)memoryData.OutputButtonData[i];
                        if (tar.layer == layerListBox.Items[layerindex].ToString())
                        {
                            memoryData.OutputButtonData.Remove(tar);
                            int index = memoryData.iconTemp.IndexOf(tar.name);
                            if (index != -1)
                            {
                                memoryData.iconTemp.RemoveAt(index);
                                memoryData.iconDelTemp.Add(tar.name);
                            }
                        }
                    }

                    for (int i = memoryData.OutputTextData.Count - 1; i >= 0; i--)
                    {
                        OutputTextObjectstruct tar = (OutputTextObjectstruct)memoryData.OutputTextData[i];
                        if (tar.layer == layerListBox.Items[layerindex].ToString())
                        {
                            memoryData.OutputTextData.Remove(tar);
                            int index = memoryData.iconTemp.IndexOf(tar.name);
                            if (index != -1)
                            {
                                memoryData.iconTemp.RemoveAt(index);
                                memoryData.iconDelTemp.Add(tar.name);
                            }
                        }
                    }

                    for (int i = memoryData.OutputPopData.Count - 1; i >= 0; i--)
                    {
                        OutputPopObjectstruct tar = (OutputPopObjectstruct)memoryData.OutputPopData[i];
                        if (tar.layer == layerListBox.Items[layerindex].ToString())
                        {
                            memoryData.OutputPopData.Remove(tar);
                            int index = memoryData.iconTemp.IndexOf(tar.name);
                            if (index != -1)
                            {
                                memoryData.iconTemp.RemoveAt(index);
                                memoryData.iconDelTemp.Add(tar.name);
                            }
                        }
                    }

                    for (int i = memoryData.PictureData.Count - 1; i >= 0; i--)
                    {
                        PictureboxObjectstruct tar = (PictureboxObjectstruct)memoryData.PictureData[i];
                        if (tar.layer == layerListBox.Items[layerindex].ToString())
                        {
                            memoryData.PictureData.Remove(tar);
                            int index = memoryData.iconTemp.IndexOf(tar.name);
                            if (index != -1)
                            {
                                memoryData.iconTemp.RemoveAt(index);
                                memoryData.iconDelTemp.Add(tar.name);
                            }
                        }
                    }

                    for (int i = memoryData.AlarmData.Count - 1; i >= 0; i--)
                    {
                        AlarmObjectstruct tar = (AlarmObjectstruct)memoryData.AlarmData[i];
                        if (tar.layer == layerListBox.Items[layerindex].ToString())
                        {
                            for (int am = 0; am < memoryData.AlarmMonitorValue.Count; am++)
                            {
                                AlarmMoniTorNV edit = (AlarmMoniTorNV)memoryData.AlarmMonitorValue[am];
                                if (edit.name == tar.name)
                                {
                                    memoryData.AlarmMonitorValue.Remove(edit);
                                    break;
                                }
                            }
                            memoryData.AlarmData.Remove(tar);
                            int index = memoryData.iconTemp.IndexOf(tar.name);
                            if (index != -1)
                            {
                                memoryData.iconTemp.RemoveAt(index);
                                memoryData.iconDelTemp.Add(tar.name);
                            }
                        }
                    }
                }
            }



            for (int i = layerListBox.Items.Count - 1; i > 0; i--)
            {
                layerListBox.Items.RemoveAt(i);
                memoryData.LayerData.RemoveAt(i);
            }
        }
示例#2
0
        private void layerDelCmd_Click(object sender, EventArgs e)
        {
            if (layerListBox.SelectedItem != null)
            {
                if (layerListBox.SelectedIndex != 0)
                {
                    string tarName = layerListBox.Text;

                    string            message = "target : " + layerListBox.SelectedItem.ToString();
                    string            caption = "delete layer";
                    MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                    DialogResult      result;
                    result = MessageBox.Show(message, caption, buttons);

                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        for (int i = memoryData.AlarmData.Count - 1; i >= 0; i--)
                        {
                            AlarmObjectstruct tar = (AlarmObjectstruct)memoryData.AlarmData[i];
                            if (tar.layer == tarName)
                            {
                                memoryData.AlarmData.Remove(tar);
                                int index = memoryData.iconTemp.IndexOf(tar.name);
                                if (index != -1)
                                {
                                    memoryData.iconTemp.RemoveAt(index);
                                    memoryData.iconDelTemp.Add(tar.name);
                                }
                            }

                            for (int a = 0; a < memoryData.AlarmMonitorValue.Count; a++)
                            {
                                AlarmMoniTorNV mtar = (AlarmMoniTorNV)memoryData.AlarmMonitorValue[a];
                                if (mtar.name == tar.name)
                                {
                                    memoryData.AlarmMonitorValue.Remove(mtar);
                                    break;
                                }
                            }
                        }

                        for (int i = memoryData.ButtonData.Count - 1; i >= 0; i--)
                        {
                            ButtonObjstruct tar = (ButtonObjstruct)memoryData.ButtonData[i];
                            if (tar.layer == tarName)
                            {
                                memoryData.ButtonData.Remove(tar);
                                int index = memoryData.iconTemp.IndexOf(tar.name);
                                if (index != -1)
                                {
                                    memoryData.iconTemp.RemoveAt(index);
                                    memoryData.iconDelTemp.Add(tar.name);
                                }
                            }
                        }

                        for (int i = memoryData.InputData.Count - 1; i >= 0; i--)
                        {
                            InputObjectstruct tar = (InputObjectstruct)memoryData.InputData[i];
                            if (tar.layer == tarName)
                            {
                                memoryData.InputData.Remove(tar);
                                int index = memoryData.iconTemp.IndexOf(tar.name);
                                if (index != -1)
                                {
                                    memoryData.iconTemp.RemoveAt(index);
                                    memoryData.iconDelTemp.Add(tar.name);
                                }
                            }
                        }

                        for (int i = memoryData.LabelData.Count - 1; i >= 0; i--)
                        {
                            LabelObjstruct tar = (LabelObjstruct)memoryData.LabelData[i];
                            if (tar.layer == tarName)
                            {
                                memoryData.LabelData.Remove(tar);
                                int index = memoryData.iconTemp.IndexOf(tar.name);
                                if (index != -1)
                                {
                                    memoryData.iconTemp.RemoveAt(index);
                                    memoryData.iconDelTemp.Add(tar.name);
                                }
                            }
                        }

                        for (int i = memoryData.OutputButtonData.Count - 1; i >= 0; i--)
                        {
                            OutputButtonObjectstruct tar = (OutputButtonObjectstruct)memoryData.OutputButtonData[i];
                            if (tar.layer == tarName)
                            {
                                memoryData.OutputButtonData.Remove(tar);
                                int index = memoryData.iconTemp.IndexOf(tar.name);
                                if (index != -1)
                                {
                                    memoryData.iconTemp.RemoveAt(index);
                                    memoryData.iconDelTemp.Add(tar.name);
                                }
                            }
                        }

                        for (int i = memoryData.OutputPopData.Count - 1; i >= 0; i--)
                        {
                            OutputPopObjectstruct tar = (OutputPopObjectstruct)memoryData.OutputPopData[i];
                            if (tar.layer == tarName)
                            {
                                memoryData.OutputPopData.Remove(tar);
                                int index = memoryData.iconTemp.IndexOf(tar.name);
                                if (index != -1)
                                {
                                    memoryData.iconTemp.RemoveAt(index);
                                    memoryData.iconDelTemp.Add(tar.name);
                                }
                            }
                        }

                        for (int i = memoryData.OutputTextData.Count - 1; i >= 0; i--)
                        {
                            OutputTextObjectstruct tar = (OutputTextObjectstruct)memoryData.OutputTextData[i];
                            if (tar.layer == tarName)
                            {
                                memoryData.OutputTextData.Remove(tar);
                                int index = memoryData.iconTemp.IndexOf(tar.name);
                                if (index != -1)
                                {
                                    memoryData.iconTemp.RemoveAt(index);
                                    memoryData.iconDelTemp.Add(tar.name);
                                }
                            }
                        }

                        for (int i = memoryData.PictureData.Count - 1; i >= 0; i--)
                        {
                            PictureboxObjectstruct tar = (PictureboxObjectstruct)memoryData.PictureData[i];
                            if (tar.layer == tarName)
                            {
                                memoryData.PictureData.Remove(tar);
                                int index = memoryData.iconTemp.IndexOf(tar.name);
                                if (index != -1)
                                {
                                    memoryData.iconTemp.RemoveAt(index);
                                    memoryData.iconDelTemp.Add(tar.name);
                                }
                            }
                        }

                        for (int i = 0; i < memoryData.LayerData.Count; i++)
                        {
                            Layerstruct getVal = (Layerstruct)memoryData.LayerData[i];
                            if (getVal.name == tarName)
                            {
                                memoryData.LayerData.Remove(memoryData.LayerData[i]);
                                //layerListBox.Items.Remove(layerListBox.SelectedItem);
                                layerListBox.Items.RemoveAt(layerListBox.SelectedIndex);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("bottom layer can not delete!");
                }
            }
        }
        private void config_InputTagObject_Load(object sender, EventArgs e)
        {
            formatList.SelectedIndex = 0;
            Labtext.ForeColor        = Color.DarkRed;
            Labtext.BackColor        = Color.White;

            //TreeNode[] arr1 = deviceList.Nodes.Find("proportional_f", true);
            //for (int i = 0; i < arr1.Length; i++) { deviceList.SelectedNode = arr1[i]; deviceList.SelectedNode.Remove(); }
            //TreeNode[] arr2 = deviceList.Nodes.Find("UCPTproportional_f", true);
            //for (int i = 0; i < arr2.Length; i++) { deviceList.SelectedNode = arr2[i]; deviceList.SelectedNode.Remove(); }
            //TreeNode[] arr3 = deviceList.Nodes.Find("nciProportion_A", true);
            //for (int i = 0; i < arr3.Length; i++) { deviceList.SelectedNode = arr3[i]; deviceList.SelectedNode.Remove(); }
            //TreeNode[] arr4 = deviceList.Nodes.Find("proportion_A", true);
            //for (int i = 0; i < arr4.Length; i++) { deviceList.SelectedNode = arr4[i]; deviceList.SelectedNode.Remove(); }

            for (int site = 0; site < deviceList.Nodes.Count; site++)
            {
                for (int fab = 0; fab < deviceList.Nodes[site].Nodes.Count; fab++)
                {
                    for (int area = 0; area < deviceList.Nodes[site].Nodes[fab].Nodes.Count; area++)
                    {
                        for (int device = 0; device < deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes.Count; device++)
                        {
                            if (deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Tag.ToString() == "lon")
                            {
                                for (int obj = 0; obj < deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes.Count; obj++)
                                {
                                    for (int nv = deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Nodes.Count - 1; nv >= 0; nv--)
                                    {
                                        //string[] chk = deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Nodes[nv].Text.Split('#');
                                        //if (chk[0] == "UCPTproportional_f" || chk[0] == "proportional_f" || chk[0]=="nciProportion_A" || chk[0]=="proportion_A")
                                        //{
                                        //    deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Nodes[nv].Remove();
                                        //}

                                        string[] tempNVType = deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Nodes[nv].Tag.ToString().Split('#');

                                        if (tempNVType[0] != NVType)
                                        //if (deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Nodes[nv].Tag.ToString() != NVType)
                                        {
                                            deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Nodes[nv].Remove();
                                        }
                                        else if (deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Nodes[nv].Tag.ToString() == NVType)
                                        {
                                            if (deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Text != "VirtFb")
                                            {
                                                string snvt = deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Nodes[nv].Text.Substring(0, 3);
                                                if (snvt != "nvo")
                                                {
                                                    deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Nodes[nv].Remove();
                                                }
                                                else
                                                {
                                                    deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Nodes[nv].Tag = deviceList.Nodes[site].Nodes[fab].Nodes[area].Nodes[device].Nodes[obj].Nodes[nv].FullPath.ToString();
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            deviceList.CollapseAll();

            for (int i = 0; i < memoryData.InputData.Count; i++)
            {
                InputObjectstruct ol = (InputObjectstruct)memoryData.InputData[i];

                if (ol.name == LabelName)
                {
                    textX.Text             = ol.x.ToString();
                    textY.Text             = ol.y.ToString();
                    previewLab.Font        = ol.font;
                    previewLab.ForeColor   = Color.FromArgb(ol.forecolor);
                    previewLab.BackColor   = Color.FromArgb(ol.backcolor);
                    previewLab.BorderStyle = ol.border;
                    if (ol.logdata == true)
                    {
                        LogUse.Checked = true;
                        LogTime.Text   = ol.logtime.ToString();
                    }
                    else
                    {
                        LogUse.Checked = false;
                    }

                    lonPollTime.Text = ol.lonPolltime.ToString();

                    if (ol.NVtype == "SNVT_switch")
                    {
                        previewLab.Text = ol.showvalue;
                    }
                    else if (ol.NVtype == "SNVT_occupancy")
                    {
                        previewLab.Text = ol.showvalue;
                    }
                    else
                    {
                        string[] num = ol.value.Split('@');
                        if (num.Length == 1)
                        {
                            showValue       = float.Parse(ol.value);
                            previewLab.Text = showValue.ToString(ol.stringFormat);
                        }
                        else if (num.Length == 2)
                        {
                            show2           = float.Parse(ol.value);
                            previewLab.Text = show2.ToString(ol.stringFormat);
                        }


                        //previewLab.Text = showValue.ToString("G");
                        //previewLab.Text = showValue.ToString(ol.stringFormat);
                    }


                    //previewLab.Text = showValue.ToString(ol.stringFormat);


                    if (ol.stringFormat == "G" || ol.stringFormat == "")
                    {
                        formatList.SelectedIndex = 0;
                    }
                    else if (ol.stringFormat == "0")
                    {
                        formatList.SelectedIndex = 1;
                    }
                    else if (ol.stringFormat == "0.0")
                    {
                        formatList.SelectedIndex = 2;
                    }
                    else if (ol.stringFormat == "0.00")
                    {
                        formatList.SelectedIndex = 3;
                    }
                    else if (ol.stringFormat == "#,##0")
                    {
                        formatList.SelectedIndex = 4;
                    }
                    else if (ol.stringFormat == "#,##0.00")
                    {
                        formatList.SelectedIndex = 5;
                    }
                    else
                    {
                        formatList.SelectedIndex = 6; formatUser.Text = ol.stringFormat;
                    }

                    load      = true;
                    loadNV    = ol.NVtype;
                    loadValue = ol.value;

                    //ol.value;
                    //ol.stringFormat;
                    description.Text = ol.description;
                    Labtext.Text     = ol.target;
                    targetindex.Text = ol.targetindex;
                    if (ol.target != "")
                    {
                        string[] index = ol.targetindex.Split('_');
                        deviceList.SelectedNode = deviceList.Nodes[int.Parse(index[0])].Nodes[int.Parse(index[1])].Nodes[int.Parse(index[2])].Nodes[int.Parse(index[3])].Nodes[int.Parse(index[4])].Nodes[int.Parse(index[5])];
                    }
                    else
                    {
                        deviceList.SelectedNode = deviceList.Nodes[0].Nodes[0].Nodes[0];
                        deviceList.Nodes[0].Expand();
                        deviceList.Nodes[0].Nodes[0].Expand();
                        deviceList.Nodes[0].Nodes[0].Nodes[0].Expand();
                    }


                    if (ol.unituse == true)
                    {
                        checkUnit.Checked = true;
                        unitList.Text     = ol.unit;
                        previewLab.Text   = showValue.ToString(ol.stringFormat) + " " + unitList.Text;
                    }
                    else
                    {
                        checkUnit.Checked = false;
                    }



                    if (ol.border.ToString() == "None")
                    {
                        borderStyle.SelectedIndex = 0;
                    }
                    else if (ol.border.ToString() == "FixedSingle")
                    {
                        borderStyle.SelectedIndex = 1;
                    }
                    else if (ol.border.ToString() == "Fixed3D")
                    {
                        borderStyle.SelectedIndex = 2;
                    }
                }
            }


            deviceList.Select();
        }
示例#4
0
        private void layerRenameCmd_Click(object sender, EventArgs e)
        {
            if (layerListBox.SelectedItem != null)
            {
                if (layerListBox.SelectedIndex != 0)
                {
                    for (int i = 0; i < memoryData.LayerData.Count; i++)
                    {
                        Layerstruct getVal = (Layerstruct)memoryData.LayerData[i];
                        if (getVal.name == layerListBox.Text)
                        {
                            getVal.name             = layerName.Text;
                            memoryData.LayerData[i] = getVal;
                            break;
                        }
                    }

                    for (int i = 0; i < memoryData.LabelData.Count; i++)
                    {
                        LabelObjstruct edit = (LabelObjstruct)memoryData.LabelData[i];
                        if (edit.layer == layerListBox.Text)
                        {
                            edit.layer = layerName.Text;
                            memoryData.LabelData[i] = edit;
                        }
                    }

                    for (int i = 0; i < memoryData.ButtonData.Count; i++)
                    {
                        ButtonObjstruct edit = (ButtonObjstruct)memoryData.ButtonData[i];
                        if (edit.layer == layerListBox.Text)
                        {
                            edit.layer = layerName.Text;
                            memoryData.ButtonData[i] = edit;
                        }
                    }

                    for (int i = 0; i < memoryData.InputData.Count; i++)
                    {
                        InputObjectstruct edit = (InputObjectstruct)memoryData.InputData[i];
                        if (edit.layer == layerListBox.Text)
                        {
                            edit.layer = layerName.Text;
                            memoryData.InputData[i] = edit;
                        }
                    }

                    for (int i = 0; i < memoryData.OutputButtonData.Count; i++)
                    {
                        OutputButtonObjectstruct edit = (OutputButtonObjectstruct)memoryData.OutputButtonData[i];
                        if (edit.layer == layerListBox.Text)
                        {
                            edit.layer = layerName.Text;
                            memoryData.OutputButtonData[i] = edit;
                        }
                    }

                    for (int i = 0; i < memoryData.OutputTextData.Count; i++)
                    {
                        OutputTextObjectstruct edit = (OutputTextObjectstruct)memoryData.OutputTextData[i];
                        if (edit.layer == layerListBox.Text)
                        {
                            edit.layer = layerName.Text;
                            memoryData.OutputTextData[i] = edit;
                        }
                    }

                    for (int i = 0; i < memoryData.OutputPopData.Count; i++)
                    {
                        OutputPopObjectstruct edit = (OutputPopObjectstruct)memoryData.OutputPopData[i];
                        if (edit.layer == layerListBox.Text)
                        {
                            edit.layer = layerName.Text;
                            memoryData.OutputPopData[i] = edit;
                        }
                    }

                    for (int i = 0; i < memoryData.PictureData.Count; i++)
                    {
                        PictureboxObjectstruct edit = (PictureboxObjectstruct)memoryData.PictureData[i];
                        if (edit.layer == layerListBox.Text)
                        {
                            edit.layer = layerName.Text;
                            memoryData.PictureData[i] = edit;
                        }
                    }

                    for (int i = 0; i < memoryData.AlarmData.Count; i++)
                    {
                        AlarmObjectstruct edit = (AlarmObjectstruct)memoryData.AlarmData[i];
                        if (edit.layer == layerListBox.Text)
                        {
                            edit.layer = layerName.Text;
                            memoryData.AlarmData[i] = edit;
                        }
                    }

                    layerListBox.Items[layerListBox.SelectedIndex] = layerName.Text;
                }
                else
                {
                    MessageBox.Show("bottom layer can not rename!");
                }
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            if (deviceList.SelectedNode.Level == 5)
            {
                previewLab.Tag = textX.Text + "_" + textY.Text;

                Form1 lForm1 = (Form1)this.Owner;//把Form2的父窗口指針賦給lForm1
                lForm1.Relab      = previewLab;
                lForm1.Gettooltip = description.Text;

                for (int i = 0; i < memoryData.InputData.Count; i++)
                {
                    InputObjectstruct getstr = (InputObjectstruct)memoryData.InputData[i];

                    if (getstr.name == LabelName)
                    {
                        getstr.forecolor = previewLab.ForeColor.ToArgb();
                        getstr.font      = previewLab.Font;
                        getstr.backcolor = previewLab.BackColor.ToArgb();
                        getstr.border    = previewLab.BorderStyle;
                        getstr.x         = int.Parse(textX.Text);
                        getstr.y         = int.Parse(textY.Text);
                        getstr.ip        = targetip;

                        if (lonPollTime.Text != "0")
                        {
                            //if (lonPollTime.Text != "")
                            getstr.lonPolltime = int.Parse(lonPollTime.Text);
                        }
                        else
                        {
                            getstr.lonPolltime = 600;
                        }

                        getstr.stringFormat = formatUser.Text;
                        getstr.NVtype       = NVType;
                        getstr.showvalue    = previewLab.Text;
                        getstr.description  = description.Text;

                        if (LogUse.Checked == true)
                        {
                            getstr.logdata = true; getstr.logtime = int.Parse(LogTime.Text);
                        }
                        else if (LogNot.Checked == true)
                        {
                            getstr.logdata = false; getstr.logtime = 0;
                        }

                        if (checkUnit.Checked == true)
                        {
                            getstr.unituse = true; getstr.unit = unitList.Text;
                        }
                        else
                        {
                            getstr.unituse = false; getstr.unit = "";
                        }

                        if (NVType == "SNVT_switch")
                        {
                            getstr.unituse = false; getstr.unit = ""; getstr.stringFormat = "";
                        }
                        else if (NVType == "SNVT_occupancy")
                        {
                            getstr.unituse = false; getstr.unit = ""; getstr.stringFormat = "";
                        }


                        if (Labtext.Text != "")
                        {
                            getstr.target      = Labtext.Text;
                            getstr.targetindex = targetindex.Text;
                            string[] getpath = deviceList.SelectedNode.FullPath.ToString().Split('\\');
                            getstr.area     = getpath[2];
                            getstr.fab      = getpath[1];
                            getstr.site     = getpath[0];
                            getstr.device   = getpath[3];
                            getstr.function = getpath[4];
                            getstr.NV       = getpath[5];
                        }
                        else
                        {
                            getstr.target      = "";
                            getstr.targetindex = "";
                            getstr.area        = "";
                            getstr.fab         = "";
                            getstr.site        = "";
                            getstr.device      = "";
                            getstr.function    = "";
                            getstr.NV          = "";
                        }

                        string[] gettemp = Labtext.Text.Split('@');

                        getstr.potocol          = gettemp[0]; //monitorType;
                        getstr.count            = 0;
                        memoryData.InputData[i] = getstr;

                        break;
                    }
                }

                this.Close();
            }
        }