Beispiel #1
0
        private void _路线属性_VisibilityChange(bool isvisible)
        {
            ListBoxEx innerControl = this._路线属性.InnerControl as ListBoxEx;

            if (!isvisible)
            {
                ListBox.SelectedObjectCollection selectedItems = innerControl.SelectedItems;
                string str   = "";
                int    count = innerControl.Items.Count;
                int    num2  = 0;
                for (int i = 0; i < count; i++)
                {
                    if (selectedItems.Contains(innerControl.Items[i]))
                    {
                        ListBoxItem item = innerControl.Items[i] as ListBoxItem;
                        num2 |= Convert.ToInt32(item.Tag.ToString());
                        str   = str + item.Name.ToString() + ",";
                    }
                }
                string str2 = Convert.ToString(num2, 2).PadLeft(4, '0');
                this.dgvPathSegment.CurrentRow.Cells["SegmentFlagValue"].Value = num2;
                this.setTimeSpeedReadOnly(this.dgvPathSegment.CurrentRow, num2);
                this.seghi[this.dgvPathSegment.CurrentRow.Cells["PathID"].Value.ToString() + "," + this.dgvPathSegment.CurrentRow.Cells["PathSegmentID"].Value.ToString()] = Convert.ToInt32(str2, 2);
                if (this.dgvPathSegment.CurrentCell != null)
                {
                    try
                    {
                        this.dgvPathSegment.CurrentCell.Value = str.Trim(new char[] { ',' });
                        this.dgvPathSegment.CurrentCell.Tag   = str2;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            else
            {
                innerControl.ClearSelected();
                if (this.dgvPathSegment.CurrentCell.Value.ToString().Length > 0)
                {
                    List <string> list       = new List <string>();
                    string[]      collection = this.dgvPathSegment.CurrentCell.Value.ToString().Split(new char[] { ',' });
                    list.AddRange(collection);
                    int num4 = innerControl.Items.Count;
                    for (int j = 0; j < num4; j++)
                    {
                        ListBoxItem item2 = innerControl.Items[j] as ListBoxItem;
                        if (list.Contains(item2.Name))
                        {
                            innerControl.SetSelected(j, true);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void _路线属性_VisibilityChange(bool isvisible)
        {
            ListBoxEx innerControl = this._路线属性.InnerControl as ListBoxEx;

            if (!isvisible)
            {
                string str = "";
                new List <string>();
                ListBox.SelectedObjectCollection selectedItems = innerControl.SelectedItems;
                int       count = innerControl.Items.Count;
                ArrayList list  = new ArrayList(count);
                for (int i = 0; i < count; i++)
                {
                    string str2 = "";
                    if (selectedItems.Contains(innerControl.Items[i]))
                    {
                        str2 = "1";
                        Client.ListBoxItem item = innerControl.Items[i] as Client.ListBoxItem;
                        str = str + item.Name.ToString() + ",";
                    }
                    else
                    {
                        str2 = "0";
                    }
                    list.Add(str2);
                }
                if (this.dgvPath.CurrentCell != null)
                {
                    try
                    {
                        this.dgvPath.CurrentCell.Value = str.Trim(",".ToCharArray());
                        this.dgvPath.CurrentCell.Tag   = list;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            else
            {
                innerControl.ClearSelected();
                if (this.dgvPath.CurrentCell.Tag == null)
                {
                    if (this.dgvPath.CurrentCell.Value != null)
                    {
                        List <string> list2 = new List <string>();
                        list2.AddRange(this.dgvPath.CurrentCell.Value.ToString().Split(",".ToCharArray()));
                        int num3 = innerControl.Items.Count;
                        for (int j = 0; j < num3; j++)
                        {
                            Client.ListBoxItem item2 = innerControl.Items[j] as Client.ListBoxItem;
                            if (list2.Contains(item2.Name))
                            {
                                innerControl.SetSelected(j, true);
                            }
                        }
                    }
                }
                else if (this.dgvPath.CurrentCell.Tag != null)
                {
                    ArrayList tag = this.dgvPath.CurrentCell.Tag as ArrayList;
                    for (int k = 0; k < innerControl.Items.Count; k++)
                    {
                        innerControl.SetSelected(k, tag[k].ToString().Equals("1"));
                    }
                }
            }
        }