/// <summary> /// Updates a list by getting current changelog version. /// </summary> private void UpdateListView() { listBox.Items.Clear(); changelog.SortXml(dateBox.CustomFormat); for (int i = 0; i < changelog.GetAmount(); i++) { ListViewItem lvi = new ListViewItem(); lvi.Text = changelog.GetDate(i); lvi.ToolTipText = changelog.GetText(i); lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, changelog.GetHeading(i))); listBox.Items.Add(lvi); } }
/// <summary> /// Updates a list by getting a new version of changelog. /// Hopefully its not too slowing for slow internet connection owners, feel free to comment its calling in listBox_ItemCheck event method. /// </summary> private void UpdateList() { changelog = new Changelog(); listBox.Items.Clear(); for (int i = 0; i < changelog.GetAmount(); i++) { ListViewItem lvi = new ListViewItem(); lvi.Text = changelog.GetDate(i); lvi.ToolTipText = changelog.GetText(i); lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, changelog.GetHeading(i))); listBox.Items.Add(lvi); } }
/// <summary> /// Displays detailed information about selected entry, if any entry is selected. /// </summary> private void listBox_SelectedIndexChanged(object sender, EventArgs e) { if (listBox.SelectedItems.Count == 1) { dateBox.Value = DateTime.ParseExact(changelog.GetDate(listBox.SelectedItems[0].Index), dateBox.CustomFormat, null); try { pictureBox.CancelAsync(); pictureBox.LoadAsync(changelog.GetPicture(listBox.SelectedItems[0].Index)); } catch { } descriptionBox.Text = changelog.GetText(listBox.SelectedItems[0].Index); headingBox.Text = changelog.GetHeading(listBox.SelectedItems[0].Index); } }