public void _UpdateMovieProfileInList(MovieProfile mProfile) { ListViewItem lvi = new ListViewItem(new string[] { mProfile.FileConnect, mProfile.Code, mProfile.Country, "+" + mProfile.Rating.ToString(), mProfile.Type, mProfile.Title, mProfile.Actress, mProfile.Tag }); lvi.Tag = mProfile; for (int i = 0; i < TheList.Items.Count; i++) { if (TheList.Items[i].Tag == mProfile) { TheList.BeginUpdate(); TheList.Items[i] = lvi; TheList.EndUpdate(); break; } } }
public void RefreshMovieList(List <MovieProfile> listMovie, string descMovie) { TheList.BeginUpdate(); _ClearMovieList(); for (int i = 0; i < TheList.Columns.Count; i++) { TheList.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); } TheList.EndUpdate(); this.Refresh(); for (int i = 0; i < TheList.Columns.Count; i++) { TheList.Columns[i].Tag = TheList.Columns[i].Width; } TheList.BeginUpdate(); for (int i = 0; i < listMovie.Count; i++) { _PutMovieProfileToList(listMovie[i]); } TheList.Columns["colFileconnect"].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); TheList.Columns["colCode"].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); TheList.Columns["colCountry"].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); TheList.Columns["colRating"].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); TheList.Columns["colType"].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); TheList.Columns["colTitle"].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); TheList.Columns["colActress"].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); TheList.Columns["colTag"].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); // ReSize ColumnHeaderAgain with Check Header & Content for (int i = 0; i < TheList.Columns.Count; i++) { if (((int)TheList.Columns[i].Tag) > TheList.Columns[i].Width) { TheList.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); } } TheList.EndUpdate(); TheStatus.Items[0].Text = "Total " + listMovie.Count.ToString("#,0") + " profile(s)"; TheStatus.Items[1].Text = descMovie; this.Refresh(); }