Beispiel #1
0
        private void jcbtnSetting_Click(object sender, EventArgs e)
        {
            SelIDUList.Clear();
            RefreshPanel();
            foreach (DataGridViewRow r in this.dgvIndoorDiff.SelectedRows)
            {
                SelectedIDUList sel = new SelectedIDUList();
                sel.IndoorNo = Convert.ToInt32(r.Cells[0].Value.ToString());

                sel.IndoorTag = r.Cells[0].Tag as MyNode;
                if (!string.IsNullOrEmpty(r.Cells[3].Value.ToString()))
                {
                    sel.IndoorModel = r.Cells[3].Value.ToString();
                }
                SelIDUList.Add(sel);
            }

            if (SelIDUList.Count > 0)
            {
                //foreach (SelectedIDUList ind in SelIDUList)
                //{
                //    cklistIndoor.Items.Add(new CheckBoxItem(ind.IndoorName + " [" + ind.IndoorModel + "] ", ind.IndoorNo.ToString()), true);
                //}

                //CHbox
                if (SelIDUList[0].IndoorTag is MyNodeCH)
                {
                    MyNodeCH nodeCh = SelIDUList[0].IndoorTag as MyNodeCH;
                    if (nodeCh.HeightDiff < 0)
                    {
                        this.jccmbPosition.SelectedIndex   = 2;
                        this.jctxtIndoorDifference.Enabled = true;
                        nodeCh.HeightDiff = -nodeCh.HeightDiff;
                        this.jctxtIndoorDifference.Text = nodeCh.HeightDiff.ToString("n1");
                    }
                    else if (nodeCh.HeightDiff == 0)
                    {
                        this.jccmbPosition.SelectedIndex   = 1;
                        this.jctxtIndoorDifference.Enabled = false;
                        this.jctxtIndoorDifference.Text    = nodeCh.HeightDiff.ToString("n1");
                    }
                    else
                    {
                        this.jccmbPosition.SelectedIndex   = 0;
                        this.jctxtIndoorDifference.Enabled = true;
                        this.jctxtIndoorDifference.Text    = nodeCh.HeightDiff.ToString("n1");
                    }
                }
                //MultiCHbox
                else if (SelIDUList[0].IndoorTag is MyNodeMultiCH)
                {
                    MyNodeMultiCH nodeCh = SelIDUList[0].IndoorTag as MyNodeMultiCH;
                    if (nodeCh.HeightDiff < 0)
                    {
                        this.jccmbPosition.SelectedIndex   = 2;
                        this.jctxtIndoorDifference.Enabled = true;
                        nodeCh.HeightDiff = -nodeCh.HeightDiff;
                        this.jctxtIndoorDifference.Text = nodeCh.HeightDiff.ToString("n1");
                    }
                    else if (nodeCh.HeightDiff == 0)
                    {
                        this.jccmbPosition.SelectedIndex   = 1;
                        this.jctxtIndoorDifference.Enabled = false;
                        this.jctxtIndoorDifference.Text    = nodeCh.HeightDiff.ToString("n1");
                    }
                    else
                    {
                        this.jccmbPosition.SelectedIndex   = 0;
                        this.jctxtIndoorDifference.Enabled = true;
                        this.jctxtIndoorDifference.Text    = nodeCh.HeightDiff.ToString("n1");
                    }
                }
                //RoomIndoor
                else
                {
                    MyNodeIn nodeCh = SelIDUList[0].IndoorTag as MyNodeIn;
                    if (nodeCh.RoomIndooItem.PositionType == PipingPositionType.Lower.ToString())
                    {
                        this.jccmbPosition.SelectedIndex   = 2;
                        this.jctxtIndoorDifference.Enabled = true;
                        this.jctxtIndoorDifference.Text    = nodeCh.RoomIndooItem.HeightDiff.ToString("n1");
                    }
                    else if (nodeCh.RoomIndooItem.PositionType == PipingPositionType.SameLevel.ToString())
                    {
                        this.jccmbPosition.SelectedIndex   = 1;
                        this.jctxtIndoorDifference.Enabled = false;
                        this.jctxtIndoorDifference.Text    = nodeCh.RoomIndooItem.HeightDiff.ToString("n1");
                    }
                    else
                    {
                        this.jccmbPosition.SelectedIndex   = 0;
                        this.jctxtIndoorDifference.Enabled = true;
                        this.jctxtIndoorDifference.Text    = nodeCh.RoomIndooItem.HeightDiff.ToString("n1");
                    }
                }
            }
            panelHighDifference.Location = new Point(303, 164);
            panelHighDifference.Visible  = true;
        }
        private void OnSettingsClicked()
        {
            SelIDUList.Clear();

            if (listselectedIDU != null)
            {
                if (listselectedIDU.Count > 0)
                {
                    for (int i = 0; i < listselectedIDU.Count; i++)
                    {
                        if (this.SelectedIndex == 0)
                        {
                            cmbPositionType         = listselectedIDU[i].PositionType;
                            TxtIndoorHighDifference = Convert.ToString(listselectedIDU[i].HeightDiff);
                        }
                        else if (this.SelectedIndex == 1)
                        {
                            cmbPositionType         = listselectedIDU[i].PositionType;
                            TxtIndoorHighDifference = Convert.ToString(listselectedIDU[i].HeightDiff);
                        }
                        else
                        {
                            cmbPositionType         = listselectedIDU[i].PositionType;
                            TxtIndoorHighDifference = Convert.ToString(listselectedIDU[i].HeightDiff);
                        }
                    }
                }
            }
            else
            {
                int i = this.selectedRow;
                if (i != -1)
                {
                    if (ListIDU != null && ListIDU.Count > 0)
                    {
                        if (this.SelectedIndex == 0)
                        {
                            cmbPositionType         = ListIDU[i].PositionType;
                            TxtIndoorHighDifference = Convert.ToString(ListIDU[i].HeightDiff);
                        }
                        else if (this.SelectedIndex == 1)
                        {
                            cmbPositionType         = ListIDU[i].PositionType;
                            TxtIndoorHighDifference = Convert.ToString(ListIDU[i].HeightDiff);
                        }
                        else
                        {
                            cmbPositionType         = ListIDU[i].PositionType;
                            TxtIndoorHighDifference = Convert.ToString(ListIDU[i].HeightDiff);
                        }
                    }
                }
            }
            IsOpen              = true;
            PopupSettings       = Visibility.Visible;
            IsPipingPopupOpened = true;
            SelectedIDUList sel   = new SelectedIDUList();
            int             index = this.selectedRow + 1;

            if (listselectedIDU != null)
            {
                foreach (IDUList ind in listselectedIDU)
                {
                    SelectedIDUList sels = new SelectedIDUList();
                    sels.IndoorNo   = ind.IndoorNo;
                    sels.IndoorName = ind.IndoorName;
                    sel.Name        = ind.IndoorNo + "[" + ind.IndoorName + "]";
                    sels.IndoorTag  = ind.IndoorTag;
                    SelIDUList.Add(sels);
                }
            }
            else
            {
                foreach (IDUList ind in ListIDU)
                {
                    if (ind.IndoorNo == index)
                    {
                        dynamic         tag  = ListIDU[SelectedRow];
                        SelectedIDUList sels = new SelectedIDUList();
                        sels.IndoorNo   = ind.IndoorNo;
                        sels.IndoorName = ind.IndoorName;
                        sel.Name        = ind.IndoorNo + "[" + ind.IndoorName + "]";
                        sels.IndoorTag  = ind.IndoorTag;
                        SelIDUList.Add(sels);
                    }
                }
            }
        }