public void Update_SessionList() { LV_Sessions.Items.Clear(); LV_Sessions.Columns.Clear(); LV_Sessions.Columns.Add("Name"); LV_Sessions.Columns.Add("Date"); foreach (CS_RecordSession oSession in oRecordEvent.Sessions) { ListViewItem It = LV_Sessions.Items.Add(oSession.Name); It.SubItems.Add(oSession.SessionDate.ToShortDateString()); for (int iInfo = 0; iInfo < oSession.UserInfos.Informations.Count; iInfo++) { if (LV_Sessions.Columns.Count < (iInfo + 3)) { LV_Sessions.Columns.Add("Info #" + (iInfo + 1).ToString()); } It.SubItems.Add(oSession.UserInfos.Informations[iInfo].Value); } int i = 0; if (Math.DivRem(LV_Sessions.Items.Count, 2, out i) == 1) { It.BackColor = SystemColors.GradientInactiveCaption; } } LV_Sessions.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); }
private void Add_EventToSessionListView(string FolderPath) { CS_RecordEvent oEvent = new CS_RecordEvent(); if (oEvent.Load_RecordEventInformationFile(FolderPath + "\\EventDetails.xml")) { ListViewGroup oEventGrp = new ListViewGroup(oEvent.Name + ": " + oEvent.StartingDate.ToShortDateString()); LV_Sessions.Groups.Add(oEventGrp); DirectoryInfo oEventDir = new DirectoryInfo(FolderPath); DirectoryInfo[] oEventSubDirs = oEventDir.GetDirectories(); foreach (DirectoryInfo oSessionDir in oEventSubDirs) { if (File.Exists(oSessionDir.FullName + "\\SessionDetails.xml")) { CS_RecordSession oSession = new CS_RecordSession(); oSession.Load_RecordSessionInformationFile(oSessionDir.FullName + "\\SessionDetails.xml"); ListViewItem oSessionItem = LV_Sessions.Items.Add(oSession.Name); foreach (CS_RecordUserInfo sInfo in oSession.UserInfos.Informations) { if (LV_Sessions.Columns.Count == oSessionItem.SubItems.Count) { LV_Sessions.Columns.Add("User info #" + oSessionItem.SubItems.Count.ToString()); } oSessionItem.SubItems.Add(sInfo.Title + ": " + sInfo.Value); } object[] SessionTag = new object[3]; SessionTag[0] = oSessionDir.FullName; SessionTag[1] = oSession; SessionTag[2] = oEvent; oSessionItem.Tag = SessionTag; oSessionItem.Group = oEventGrp; UpDate_FileList(oSessionDir.FullName, oSession, oEvent); } } LV_Sessions.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); } }
private void Show_Sessions() { this.Text = "Record session selection"; Lbl_Info.Text = "Record sessions list"; Cmd_CreateNew.Text = "New session"; LV_Sessions.Items.Clear(); LV_Sessions.Columns.Clear(); LV_Sessions.Columns.Add("Name"); LV_Sessions.Columns.Add("Date"); foreach (CS_RecordSession oSession in oEvent.Sessions) { ListViewItem It = LV_Sessions.Items.Add(oSession.Name); It.SubItems.Add(oSession.SessionDate.ToShortDateString()); for (int iInfo = 0; iInfo < oSession.UserInfos.Informations.Count; iInfo++) { if (LV_Sessions.Columns.Count < (iInfo + 3)) { LV_Sessions.Columns.Add("Info #" + (iInfo + 1).ToString()); } It.SubItems.Add(oSession.UserInfos.Informations[iInfo].Value); } int i = 0; if (Math.DivRem(LV_Sessions.Items.Count, 2, out i) == 1) { It.BackColor = SystemColors.GradientInactiveCaption; } } LV_Sessions.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); }