public ListViewSubItem this[int index]
            {
                get
                {
                    if (index < 0 || index >= Count)
                    {
                        throw new ArgumentOutOfRangeException(nameof(index), index, string.Format(SR.InvalidArgument, nameof(index), index));
                    }

                    return(_owner.subItems[index]);
                }
                set
                {
                    if (index < 0 || index >= Count)
                    {
                        throw new ArgumentOutOfRangeException(nameof(index), index, string.Format(SR.InvalidArgument, nameof(index), index));
                    }

                    ListViewSubItem oldSubItem = _owner.subItems[index];

                    _owner.subItems[index] = value.OrThrowIfNull();
                    value._owner           = _owner;

                    oldSubItem._owner = null;

                    _owner.UpdateSubItems(index);
                }
            }
예제 #2
0
 public static void SetIfChanged(this ListViewSubItem item, string value)
 {
     if (item.Text != value)
     {
         item.Text = value;
     }
 }
예제 #3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            Cursor.Current    = Cursors.WaitCursor;
            this.button2.Text = "export to .txt";
            this.total        = 0;
            this.pBar1.Value  = 1;
            this.button1.Text = "Fetching Prices...";
            ListViewItem item1 = new ListViewItem("item1", 0);



            if (async == true)
            {
                List <double> prices = ((double[])AsyncGetPrices(myParts1).Result).ToList();
                populateList(prices);
            }
            else
            {
                myPartsPrices1 = GetPrices(myParts1);
            }

            string          val3  = string.Format("${0:N2}", this.total);
            ListViewSubItem item3 = new ListViewSubItem();

            item3.Text = val3;
            item3.Font = new Font(this.listView1.Font, FontStyle.Bold);
            this.listView1.Items[this.myParts1.Count() + 1].SubItems.Add(item3);
            Cursor.Current    = Cursors.Default;
            this.button1.Text = "Get Prices";
        }
예제 #4
0
파일: Form.cs 프로젝트: htadwilliams/NerfDX
        private void ListViewControllers_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            ConnectedDeviceInfo connectedDeviceInfo = connectedDeviceInfos[e.ItemIndex];

            // Name
            ListViewItem listViewItem = new ListViewItem();

            listViewItem.Text = connectedDeviceInfo.Information.InstanceName;

            // Type
            ListViewSubItem listViewSubItem = new ListViewSubItem();

            listViewSubItem.Text = connectedDeviceInfo.Information.Type.ToString();
            listViewItem.SubItems.Add(listViewSubItem);

            // Buttons
            listViewSubItem      = new ListViewSubItem();
            listViewSubItem.Text = connectedDeviceInfo.Capabilities.ButtonCount.ToString();
            listViewItem.SubItems.Add(listViewSubItem);

            // Hats
            listViewSubItem      = new ListViewSubItem();
            listViewSubItem.Text = connectedDeviceInfo.Capabilities.PovCount.ToString();
            listViewItem.SubItems.Add(listViewSubItem);

            // Axes
            listViewSubItem      = new ListViewSubItem();
            listViewSubItem.Text = connectedDeviceInfo.Capabilities.AxeCount.ToString();
            listViewItem.SubItems.Add(listViewSubItem);

            e.Item = listViewItem;
        }
예제 #5
0
 public void Remove(ListViewSubItem item)
 {
     if (List.Contains(item))
     {
         List.Remove(item);
     }
 }
예제 #6
0
            public ListViewSubItem Add(object value)
            {
                ListViewSubItem anItem = new ListViewSubItem(_owner);

                anItem.Value = value;
                return(this.Add(anItem));
            }
예제 #7
0
            public ListViewSubItem Add(ListViewSubItem item)
            {
                item._owner = _owner;
                int index = List.Add(item);

                return((ListViewSubItem)List[index]);
            }
예제 #8
0
파일: ListItem.cs 프로젝트: yakoder/NRaas
        protected virtual void Set(IResourceIndexEntry entry, IPackage package)
        {
            mEntry   = entry;
            mPackage = package;

            mType = (ResourceType)mEntry.ResourceType;

            if (mEntry != null)
            {
                // NameColumn
                NameMapResource.NameMapResource nameMap = MainForm.CreateKeyResource(package) as NameMapResource.NameMapResource;
                if ((nameMap != null) && (nameMap.ContainsKey(mEntry.Instance)))
                {
                    Text = nameMap[mEntry.Instance];
                }

                // TagColumn
                SubItems.Add(Type.ToString());

                // Instance
                mInstance = SubItems.Add(Instance);

                // Filename
                mFilename = SubItems.Add("");
            }
        }
예제 #9
0
        public void ListViewSubItemAndSubItemStyle_RoundTripAndExchangeWithNet()
        {
            string coreBlob;

            using (var font = new Font(FontFamily.GenericSansSerif, 9f))
            {
                var listViewSubItem = new ListViewSubItem(
                    new ListViewItem(),
                    "SubItem1",
                    foreColor: Color.White,
                    backColor: Color.Black,
                    font)
                {
                    Tag = "UserData"
                };
                coreBlob = BinarySerialization.ToBase64String(listViewSubItem);
            }

            Assert.Equal(ClassicListViewSubItem, coreBlob);

            var result = BinarySerialization.EnsureDeserialize <ListViewSubItem>(coreBlob);

            Assert.Equal("SubItem1", result.Text);
            Assert.True(result.CustomStyle);
            Assert.True(result.CustomForeColor);
            Assert.True(result.CustomBackColor);
            Assert.True(result.CustomFont);
            Assert.Equal(Color.White, result.ForeColor);
            Assert.Equal(Color.Black, result.BackColor);
            Assert.Equal(FontFamily.GenericSansSerif.Name, result.Font.FontFamily.Name);
            Assert.Null(result.Tag); // UserData is wiped on deserialization
        }
예제 #10
0
        /// <summary>
        /// Create a new subitem with a zeroed Tag.
        /// </summary>
        /// <returns></returns>
        protected ListViewSubItem NewSubItem()
        {
            ListViewSubItem item = new ListViewSubItem();

            item.Tag = -1; // Arbitrarily initialize to -1.
            return(item);
        }
예제 #11
0
 public ListViewSubItem Add(ListViewSubItem item)
 {
     SizeSubItemArray(1, -1);
     owner.subItems[owner.subItemsCount++] = item;
     //TODO
     return(item);
 }
예제 #12
0
            /// <summary>
            /// Adds a sub-item to the list view item. 
            /// </summary>
            /// <param name="itemText">The text of the sub-item.</param>
            public void AddSubItem(string itemText)
            {
                ListViewSubItem listViewSubItem = new ListViewSubItem();
                listViewSubItem.Text = itemText;

                SubItems.Add(listViewSubItem);
            }
예제 #13
0
        protected virtual void Set(IResourceIndexEntry entry, IPackage package)
        {
            mEntry = entry;
            mPackage = package;

            mType = (ResourceType)mEntry.ResourceType;

            if (mEntry != null)
            {
                // NameColumn
                NameMapResource.NameMapResource nameMap = MainForm.CreateKeyResource(package) as NameMapResource.NameMapResource;
                if ((nameMap != null) && (nameMap.ContainsKey(mEntry.Instance)))
                {
                    Text = nameMap[mEntry.Instance];
                }

                // TagColumn
                SubItems.Add(Type.ToString());

                // Instance
                mInstance = SubItems.Add(Instance);

                // Filename
                mFilename = SubItems.Add("");
            }
        }
            public ListViewSubItem Add(string text, Color foreColor, Color backColor, Font font)
            {
                ListViewSubItem item = new ListViewSubItem(_owner, text, foreColor, backColor, font);

                Add(item);
                return(item);
            }
예제 #15
0
            public ListViewSubItem Add(string text)
            {
                ListViewSubItem item = new ListViewSubItem(owner, text);

                this.AddInternal(item);
                return(item);
            }
예제 #16
0
        public JobListItem(int id,String name,String status)
            : base(id.ToString())
        {
            this.id = id;
            lblName = new ListViewSubItem();
            lblName.Text = name;

            lblStatus = new ListViewSubItem();
            lblStatus.Text = status;

            this.SubItems.Add(lblName);
            this.SubItems.Add(lblStatus);

            (new Thread(() =>
            {
                while (true)
                {
                    lock (locker)
                    {
                        update();
                        Thread.Sleep(800);
                    }
                }
            })).Start();
        }
예제 #17
0
        private void BillDetailList(String custName, String masterBillNo)
        {
            String criteria = $"(客户简称 = '{custName}' And (len(总单号) = 0 or 总单号 is null))";

            if (!String.IsNullOrEmpty(masterBillNo))
            {
                criteria += $" or (总单号 = '{masterBillNo}')";
            }
            var list = ds.Tables["Info"].Select(criteria).Select(p => new { billno = p["交货单号"], masterbillno = p["总单号"] });

            this.listView1.Items.Clear();
            foreach (var l in list)
            {
                ListViewItem item = new ListViewItem(l.billno.ToString())
                {
                    UseItemStyleForSubItems = false
                };
                var subitem = new ListViewSubItem(item, String.IsNullOrEmpty(l.masterbillno?.ToString()) ? "未关联" : "已关联")
                {
                    ForeColor = String.IsNullOrEmpty(l.masterbillno?.ToString()) ? Color.Red : Color.Green
                };
                item.SubItems.Add(subitem);
                this.listView1.Items.Add(item);
            }
        }
예제 #18
0
        public TimerEntry(string id)
        {
            m_id = id;

            m_subToday   = SubItems.Add("-");
            m_subAllTime = SubItems.Add("-");
        }
예제 #19
0
            // Make sure we have enough space in the array. insert at "index" or at the end if index is -1.
            private void SizeSubItemArray(int size, int index)
            {
                // Do we need more space?
                if (owner.subItems.Length < owner.subItemsCount + size)
                {
                    int newLength = owner.subItems.Length * 2;
                    int minLength = owner.subItemsCount + size;
                    for (; newLength < minLength; newLength *= 2)
                    {
                    }
                    ListViewSubItem[] newSubItems = new ListViewSubItem[newLength];
                    if (index != -1)
                    {
                        Array.Copy(owner.subItems, 0, newSubItems, 0, index);
                        Array.Copy(owner.subItems, index, newSubItems, index + size, owner.subItemsCount - index);
                    }
                    else
                    {
                        Array.Copy(owner.subItems, newSubItems, owner.subItemsCount);
                    }
                    owner.subItems = newSubItems;
                    return;
                }

                // Move items after index up to make space for the new items.
                if (index != -1)
                {
                    for (int i = owner.subItemsCount - 1; i >= index; i--)
                    {
                        owner.subItems[(i + size)] = owner.subItems[i];
                    }
                }
            }
            public ListViewSubItem Add(string text)
            {
                ListViewSubItem item = new ListViewSubItem(_owner, text);

                Add(item);
                return(item);
            }
예제 #21
0
        private void LoadProfiles(ListView list, List <String> activeProfiles)
        {
            list.Items.Clear();
            foreach (Profile profile in this.profiles)
            {
                var listitem = new ListViewItem();
                var path     = new ListViewSubItem();

                ListViewGroup group = GetGameGroup(profile.group);
                //list.Groups.Add(group);

                path.Text = profile.storeLocation;
                if (activeProfiles.Contains(profile.name))
                {
                    listitem.Font = new Font(listitem.Font, FontStyle.Bold);
                }


                listitem.Group = GetGameGroup(profile.group);
                listitem.Name  = profile.name;
                listitem.Text  = profile.name;

                listitem.SubItems.Add(path);
                list.Items.Add(listitem);
            }
        }
예제 #22
0
            /// <summary>
            /// Adds a sub-item to the list view item.
            /// </summary>
            /// <param name="itemText">The text of the sub-item.</param>
            public void AddSubItem(string itemText)
            {
                ListViewSubItem listViewSubItem = new ListViewSubItem();

                listViewSubItem.Text = itemText;

                SubItems.Add(listViewSubItem);
            }
예제 #23
0
 public void Insert(int index, ListViewSubItem item)
 {
     SizeSubItemArray(1, index);
     item.owner            = owner;
     owner.subItems[index] = item;
     owner.subItemsCount++;
     //TODO
 }
예제 #24
0
 public void Remove(object value)
 {
     if (value is ListViewSubItem)
     {
         ListViewSubItem listViewSubItem = (ListViewSubItem)value;
         this.RemoveInternal(listViewSubItem);
     }
 }
예제 #25
0
 public void Insert(int index, object value)
 {
     if (value is ListViewSubItem)
     {
         ListViewSubItem listViewSubItem = (ListViewSubItem)value;
         this.Insert(index, listViewSubItem);
     }
 }
예제 #26
0
            public virtual void RemoveByKey(string key)
            {
                ListViewSubItem value = this[key];

                if (value != null)
                {
                    this.RemoveInternal(value);
                }
            }
예제 #27
0
 public ServerVariableListViewItem(ServerVariableItem variable)
     : base(variable.Name)
 {
     _value = new ListViewSubItem(this, variable.Value);
     SubItems.Add(_value);
     _replace = new ListViewSubItem(this, variable.Replace.ToString());
     SubItems.Add(_replace);
     Item = variable;
 }
예제 #28
0
        public void AddAndDateStamp(ListView ListView)
        {
            ListViewSubItem dateStamp = new ListViewSubItem();
            dateStamp.Text = DateTime.Now.ToString();

            base.SubItems.Insert(1, dateStamp);
            ListView.Items.Insert(0, this);
            Datestamped = true;
        }
 public ConditionListViewItem(ConditionItem condition)
     : base(condition.Input)
 {
     _matchType = new ListViewSubItem(this, GetText(condition.MatchType));
     this.SubItems.Add(_matchType);
     _pattern = new ListViewSubItem(this, condition.MatchType > 3 ? condition.Pattern : "N/A");
     this.SubItems.Add(_pattern);
     this.Item = condition;
 }
예제 #30
0
            public void Remove(ListViewSubItem item)
            {
                int pos = this.IndexOf(item);

                if (pos != -1)
                {
                    RemoveAt(pos);
                }
            }
예제 #31
0
 public int Add(object value)
 {
     if (value is ListViewSubItem)
     {
         ListViewSubItem listViewSubItem = (ListViewSubItem)value;
         this.AddInternal(listViewSubItem);
     }
     return(this.subItems.Count);
 }
예제 #32
0
        public WorkingListViewItem(string rootfile, ListView parent, TextBox txtbtShow)
        {
            //initializing delegates
            mySetProgress      = new SetProgress(SetProgressCore);
            myWriteLog         = new WriteLog(WriteLogCore);
            myTransferState    = new TransferState(TransferStateCore);
            myIncProgressBlock = new IncProgressBlock(IncProgressBlockCore);
            progressListener   = new EventHandler(setProgressBlock);
            // feedbackListenerForLog = new EventHandler(WriteConverterLog);
            mySetProgressBarMove = new SetProgressBarMoveDelegate(SetProgressMoveCore);
            mySetProgressBarStop = new SetProgressBarMoveDelegate(SetProgressStopCore);

            state = new FileState();
            state.StateValProgress = StateVal.STATE_READY;

            this.state.SourceFileName = rootfile;
            this.ToolTipText          = rootfile;
            this.displayName          = Path.GetFileName(rootfile);
            Icon icon = GetSmallIcon(rootfile);

            if (icon == null)
            {
                icon = IconResource.Default;
            }

            fileIcon = icon.ToBitmap();

            //Create Working Thread
            workingThread = null;

            //For Status Button
            ListViewSubItem statusSub = this.SubItems[0];

            btnItem     = new UofStatusButton(this);
            btnItem.Tag = this.ListView;
            parent.Controls.Add(btnItem);
            ((UofListView)parent).AddControlToSubItem(btnItem, statusSub, true);

            //For name & Progress Bar
            ListViewSubItem nameSub = this.SubItems.Add("");

            pgbItem          = new UofProgressBar(this);
            pgbItem.Minimum  = 1;
            pgbItem.Maximum  = 1000;
            pgbItem.Step     = 1;
            pgbItem.Tag      = this.ListView;
            pgbItem.Showtext = displayName;
            parent.Controls.Add(pgbItem);
            ((UofListView)parent).AddControlToSubItem(pgbItem, nameSub, false);

            totalFiles  = 0;
            currentFile = 0;
            logText     = "";

            // this.txtbxShow = txtbxShow;
        }
예제 #33
0
 public AuthenticationListViewItem(AuthenticationFeature feature, AuthenticationPage page)
     : base(feature.Name)
 {
     _page   = page;
     Feature = feature;
     _status = new ListViewSubItem(this, feature.IsEnabled ? "Enabled" : "Disabled");
     SubItems.Add(_status);
     SubItems.Add(new ListViewSubItem(this, GetString(feature.AuthenticationType)));
     feature.AuthenticationSettingsUpdated = AuthenticationSettingsUpdated;
 }
예제 #34
0
 protected void SetMainListItem()
 {
     base.Checked = m_active;
     base.Text = m_caption;
     ListViewSubItem subItem = new ListViewSubItem();
     subItem.Name = SUBITEM_DESCRIPTION;
     subItem.Text = m_description;
     base.SubItems.Add(subItem);
     base.ImageKey = m_id;
 }
예제 #35
0
        public void AddAndDateStamp(ListView ListView)
        {
            ListViewSubItem dateStamp = new ListViewSubItem();

            dateStamp.Text = DateTime.Now.ToString();

            base.SubItems.Insert(1, dateStamp);
            ListView.Items.Insert(0, this);
            Datestamped = true;
        }
예제 #36
0
        public void AddAndDateStamp(ListView listView)
        {
            ListViewSubItem dateStamp = new ListViewSubItem {Text = DateTime.Now.ToString()};

            base.SubItems.Insert(1, dateStamp);

            // http://en.wikipedia.org/wiki/Wikipedia_talk:AutoWikiBrowser/Bugs#ArgumentException_in_AWBLogListener.AddAndDateStamp
            if(!listView.Items.Contains(this))
                listView.Items.Insert(0, this);

            Datestamped = true;
        }
        /// <summary>Initializes a new instance of the <see cref="TextMessageListViewItem"/> class.</summary>
        /// <param name="_message">The TextMessage whose details are to be displayed.</param>
        public TextMessageListViewItem(TextMessage _message)
            : base()
        {
            message = _message;
            format = message.Format;

            string toNamesAndNumbers = NamesAndNumbers(message.To);
            string fromNamesAndNumbers = NamesAndNumbers(message.From);
            string fromNumber = fromNamesAndNumbers;
            string toNumber = toNamesAndNumbers;

            //TODO: use Reflector to see the internals of new ListViewItem(string[]) - in regards to SubItems and the default item
            /*
            public ListViewItem(string[] items, int imageIndex) : this()
            {
            this.ImageIndexer.Index = imageIndex;
            if ((items != null) && (items.Length > 0))
            {
            this.subItems = new ListViewSubItem[items.Length];
            for (int i = 0; i < items.Length; i++)
            {
            this.subItems[i] = new ListViewSubItem(this, items[i]);
            }
            this.SubItemCount = items.Length;
            }
            }
            */

            ListViewSubItem fromNumberItem = new ListViewSubItem(this, fromNumber);
            fromNumberItem.Name = "FromNumber";
            SubItems.Add(fromNumberItem);
            ListViewSubItem messageItem = new ListViewSubItem(this, message.MessageText);
            messageItem.Name = "Message";
            SubItems.Add(messageItem);
            string dateString = message.DateTime.Date.ToShortDateString();
            ListViewSubItem dateItem = new ListViewSubItem(this, dateString);
            dateItem.Name = "Date";
            SubItems.Add(dateItem);
            string timeString = message.DateTime.TimeOfDay.ToString();
            ListViewSubItem timeItem = new ListViewSubItem(this, timeString);
            timeItem.Name = "Time";
            SubItems.Add(timeItem);
            ListViewSubItem toNumberItem = new ListViewSubItem(this, toNumber);
            toNumberItem.Name = "ToNumber";
            SubItems.Add(toNumberItem);
            ListViewSubItem fileNameItem = new ListViewSubItem(this, message.FileName);
            fileNameItem.Name = "FileName";
            SubItems.Add(fileNameItem);
            SubItems.RemoveAt(0);//remove initial default entry
        }
예제 #38
0
 public ConnectionStateListViewItem(IrcSharp.Extended.IrcConnection con)
 {
     Tag = con;
     Text = con.ConnectionID.ToString();
     ListViewSubItem subItem;
     subItem = new ListViewSubItem(this, con.NetworkName);
     if (subItem.Text == "")
         subItem.Text = "[Unnamed]";
     SubItems.Add(subItem);
     subItem = new ListViewSubItem(this, "");
     SubItems.Add(subItem);
     UpdateStatus();
     con.Connected += new IrcSharp.ConnectEventHandler(Client_OnConnect);
     con.Login += new IrcSharp.LoginEventHandler(Client_OnLogin);
 }
예제 #39
0
        public void AddAndDateStamp(ListView listView)
        {
            ListViewSubItem dateStamp = new ListViewSubItem {Text = DateTime.Now.ToString()};

            base.SubItems.Insert(1, dateStamp);

            // https://en.wikipedia.org/wiki/Wikipedia_talk:AutoWikiBrowser/Bugs/Archive_11#ArgumentException_in_AWBLogListener.AddAndDateStamp
            // TODO resolve exception by prevention rather than simply catching
            try
            {
                listView.Items.Insert(0, this);
            }

            catch { }

            Datestamped = true;
        }
예제 #40
0
 /// <include file='doc\ListViewItem.uex' path='docs/doc[@for="ListViewItem.ListViewSubItemCollection.Remove"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void Remove(ListViewSubItem item) {
     int index = IndexOf(item);
     if (index != -1) {                    
         RemoveAt(index);
     }
 }
예제 #41
0
 /// <include file='doc\ListViewItem.uex' path='docs/doc[@for="ListViewItem.ListViewSubItemCollection.Insert"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void Insert(int index, ListViewSubItem item) {
 
     if (index < 0 || index > Count) {
         throw new ArgumentOutOfRangeException("index");
     }
     
     item.owner = owner;
     
     EnsureSubItemSpace(1, index);
 
     // Insert new item
     //
     owner.subItems[index] = item;
     owner.SubItemCount++;
     owner.UpdateSubItems(-1);
 }
예제 #42
0
 /// <include file='doc\ListViewItem.uex' path='docs/doc[@for="ListViewItem.ListViewItem14"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public ListViewItem(ListViewSubItem[] subItems, int imageIndex, ListViewGroup group) : this(subItems, imageIndex) {
     this.Group = group;
 }
예제 #43
0
        private void init()
        {
            SubItems.Clear();

            if (Date == null)
            {
                Date    = "?";
            }
            if (Context == null)
            {
                Context = "?";
            }
            if (Data == null)
            {
                Data    = "null";
            }

            switch (Severity)
            {
                case (int)nUtility.MainWindow.TextSeverity.VERBOSE:
                    ItemColor = nUtility.MainWindow.TextSeverityColor.VERBOSE;
                    break;
                case (int)nUtility.MainWindow.TextSeverity.INFO:
                    ItemColor = nUtility.MainWindow.TextSeverityColor.INFO;
                    break;
                case (int)nUtility.MainWindow.TextSeverity.WARNING:
                    ItemColor = nUtility.MainWindow.TextSeverityColor.WARNING;
                    break;
                case (int)nUtility.MainWindow.TextSeverity.ERROR:
                    ItemColor = nUtility.MainWindow.TextSeverityColor.ERROR;
                    break;
                case (int)nUtility.MainWindow.TextSeverity.FATAL:
                    ItemColor = nUtility.MainWindow.TextSeverityColor.FATAL;
                    break;
                default:
                    ItemColor = nUtility.MainWindow.TextSeverityColor.INFO;
                    break;
            }

            ListViewSubItem date    = new ListViewSubItem(this, Date);
            ListViewSubItem context = new ListViewSubItem(this, Context);
            ListViewSubItem data    = new ListViewSubItem(this, Data.ToString());

            date.Tag    = DATE_TAG;
            context.Tag = CONTEXT_TAG;
            data.Tag    = DATA_TAG;

            date.Text       = Date;
            context.Text    = Context;
            data.Text       = Data.ToString();

            SubItems.Insert(0, date);
            SubItems.Insert(1, context);
            SubItems.Insert(2, data);

            ForeColor = ItemColor;
        }
예제 #44
0
        /// <include file='doc\ListViewItem.uex' path='docs/doc[@for="ListViewItem.ListViewItem18"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public ListViewItem(ListViewSubItem[] subItems, string imageKey) : this() {

            this.ImageIndexer.Key = imageKey;
            this.subItems = subItems;
            this.SubItemCount = this.subItems.Length;
            
            // Update the owner of these subitems
            //
            for(int i=0; i < subItems.Length; ++i) {
                subItems[i].owner = this;
            }
        }
예제 #45
0
        /// <include file='doc\ListViewItem.uex' path='docs/doc[@for="ListViewItem.ListViewItem16"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public ListViewItem(string[] items, string imageKey) : this() {

            this.ImageIndexer.Key = imageKey;
            if (items != null && items.Length > 0) {
                this.subItems = new ListViewSubItem[items.Length];
                for (int i = 0; i < items.Length; i++) {
                    subItems[i] = new ListViewSubItem(this, items[i]);
                }
                this.SubItemCount = items.Length;
            }
        }
예제 #46
0
        /// <include file='doc\ListViewItem.uex' path='docs/doc[@for="ListViewItem.Clone"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public virtual object Clone() {
            ListViewSubItem[] clonedSubItems = new ListViewSubItem[this.SubItems.Count];
            for(int index=0; index < this.SubItems.Count; ++index) {
                ListViewSubItem subItem = this.SubItems[index];
                clonedSubItems[index] = new ListViewSubItem(null, 
                                                            subItem.Text, 
                                                            subItem.ForeColor, 
                                                            subItem.BackColor,
                                                            subItem.Font);
                clonedSubItems[index].Tag = subItem.Tag;
            }
        
            Type clonedType = this.GetType();
            ListViewItem newItem = null;
            
            if (clonedType == typeof(ListViewItem)) {
                newItem = new ListViewItem(clonedSubItems, this.ImageIndexer.Index);
            }
            else { 
                // SECREVIEW : Late-binding does not represent a security thread, see bug#411899 for more info..
                //
                newItem = (ListViewItem)Activator.CreateInstance(clonedType);
            }
            newItem.subItems = clonedSubItems;
            newItem.ImageIndexer.Index = this.ImageIndexer.Index;
            newItem.SubItemCount = this.SubItemCount;
            newItem.Checked = this.Checked;
            newItem.UseItemStyleForSubItems = this.UseItemStyleForSubItems;
            newItem.Tag = this.Tag;

            // Only copy over the ImageKey if we're using it.
            if (!String.IsNullOrEmpty(this.ImageIndexer.Key)) {
                newItem.ImageIndexer.Key = this.ImageIndexer.Key;
            }

            newItem.indentCount = this.indentCount;
            newItem.StateImageIndex = this.StateImageIndex;
            newItem.toolTipText = this.toolTipText;
            newItem.BackColor = this.BackColor;
            newItem.ForeColor = this.ForeColor;
            newItem.Font = this.Font;
            newItem.Text = this.Text;
            newItem.Group = this.Group;
            
            return newItem;
        }
 public ListViewSubItem Add(string text)
 {
     ListViewSubItem item = new ListViewSubItem(owner, text);
     this.AddInternal(item);
     return item;
 }
예제 #48
0
        private void buildSubItemsFromRosterItem()
        {
            this.SubItems.Clear();
            this.Text = _rosterItem.Name;
            ListViewSubItem i1 = new ListViewSubItem(this, "Unknown");
            ListViewSubItem i2 = new ListViewSubItem(this, string.Empty);

            if (!object.Equals(_presence, null))
            {
                if (_presence is AvailableRequest)
                {
                    AvailableRequest avail = WConvert.ToAvailableRequest(_presence);
                    i1.Text = avail.Show.ToString();
                    i2.Text = avail.Status;
                }
                else if (_presence is UnavailableRequest)
                {
                    UnavailableRequest unavail = WConvert.ToUnavailableRequest(_presence);
                    i1.Text = "Unavailable";
                    i2.Text = unavail.Status;
                }
                else
                {
                    //*** Do nothing
                }
            }

            ListViewSubItem i3 = new ListViewSubItem(this, _rosterItem.Subscription.ToLower());
            this.SubItems.Add(i1);
            this.SubItems.Add(i2);
            this.SubItems.Add(i3);
        }
        public object Clone()
        {
            ListViewItem clone = new ListViewItem();

            clone.owner = this.owner;
            clone.selected = this.selected;

            foreach (ListViewSubItem subItem in this.subItems)
            {
                ListViewSubItem newItem = new ListViewSubItem();
                newItem.ListViewItem = subItem.ListViewItem;
                newItem.Name = subItem.Name;
                newItem.Tag = subItem.Tag;
                newItem.Text = subItem.Text;
                clone.subItems.Add(newItem);
            }

            return clone;
        }
            private void RemoveInternal(ListViewSubItem subItem)
            {
                this.subItems.Remove(subItem);
                if (this.subItems.Count == 0)
                {
                    this.subItems.Add(new ListViewSubItem(this.owner, ""));
                }

                ListView owner = this.owner.owner;
                if (owner != null)
                {
                    owner.RebuildHierarchy();
                }
            }
 private void AddInternal(ListViewSubItem subItem)
 {
     this.subItems.Add(subItem);
     ListView owner = this.owner.owner;
     if (owner != null)
     {
         owner.RebuildHierarchy();
     }
 }
 public void AddRange(ListViewSubItem[] items)
 {
     foreach (var item in items)
     {
         this.AddInternal(item);
     }
 }
	public ListViewItem(ListViewSubItem[] subItems, int imageIndex) {}
예제 #54
0
 /// <include file='doc\ListViewItem.uex' path='docs/doc[@for="ListViewItem.ListViewItem22"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public ListViewItem(ListViewSubItem[] subItems, string imageKey, ListViewGroup group) : this(subItems, imageKey) {
     this.Group = group;
 }
	public ListViewItem(ListViewSubItem[] subItems, string imageKey) {}
 public ListViewSubItem Add(ListViewSubItem item)
 {
     this.AddInternal(item);
     return item;
 }
	public ListViewItem(ListViewSubItem[] subItems, int imageIndex, ListViewGroup group) {}
예제 #58
0
 /// <devdoc>
 ///     Ensures that the sub item array has the given
 ///     capacity.  If it doesn't, it enlarges the
 ///     array until it does.  If index is -1, additional
 ///     space is tacked onto the end.  If it is a valid
 ///     insertion index into the array, this will move
 ///     the array data to accomodate the space.
 /// </devdoc>
 private void EnsureSubItemSpace(int size, int index) {
 
     // Range check subItems.
     if (owner.SubItemCount == ListViewItem.MAX_SUBITEMS) {
         throw new InvalidOperationException(SR.GetString(SR.ErrorCollectionFull));
     }
     
     if (owner.SubItemCount + size > owner.subItems.Length) {
     
         // must grow array.  Don't do it just by size, though;
         // chunk it for efficiency.
         
         if (owner.subItems == null) {
             int newSize = (size > 4) ? size : 4;
             owner.subItems = new ListViewSubItem[newSize];
         }
         else {
             int newSize = owner.subItems.Length * 2;
             while(newSize - owner.SubItemCount < size) {
                 newSize *= 2;
             }
             
             ListViewSubItem[] newItems = new ListViewSubItem[newSize];
             
             // Now, when copying to the member variable, use index
             // if it was provided.
             //
             if (index != -1) {
                 Array.Copy(owner.subItems, 0, newItems, 0, index);
                 Array.Copy(owner.subItems, index, newItems, index + size, owner.SubItemCount - index);
             }
             else {
                 Array.Copy(owner.subItems, newItems, owner.SubItemCount);
             }
             owner.subItems = newItems;
         }
     }
     else {
     
         // We had plenty of room.  Just move the items if we need to
         //
         if (index != -1) {
             for(int i = owner.SubItemCount - 1; i >= index; i--) {
                 owner.subItems[i + size] = owner.subItems[i];
             }
         }
     }
 }
	public ListViewItem(ListViewSubItem[] subItems, string imageKey, ListViewGroup group) {}
예제 #60
0
 /// <include file='doc\ListViewItem.uex' path='docs/doc[@for="ListViewItem.ListViewSubItemCollection.IndexOf"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public int IndexOf(ListViewSubItem subItem) {
     for(int index=0; index < Count; ++index) {
         if (owner.subItems[index] == subItem) {
             return index;
         }
     }    
     return -1;
 }