/// <summary> /// Updates ListView column "Server Path". /// </summary> /// <param name="itm">The itm.</param> private void EditServerPath(ListViewItemTag itm) { if (itm == null) { return; } string res = Microsoft.VisualBasic.Interaction.InputBox("Enter new value for Source Path", Utilities.AppTitle, itm.sourcePath); if (string.IsNullOrWhiteSpace(res)) { return; } while (res.EndsWith("/")) { res = res.Substring(0, res.Length - 1); } while (res.EndsWith("\\")) { res = res.Substring(0, res.Length - 1); } SuppressEvents = true; foreach (ListViewItem item in listView1.SelectedItems) { item.SubItems[7].Text = res; (item.Tag as ListViewItemTag).sourcePath = res; } UpdateRelatedBranchesCombo(); SuppressEvents = false; SetMergeTypes(); }
/// <summary> /// Handles the MouseClick event of the listView1 control. /// Shows ListView context menu, see <see cref="ctxMenuChangesets_ItemClicked"/>. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param> private void listView1_MouseClick(object sender, MouseEventArgs e) { ClickedItem = listView1.GetItemAt(e.X, e.Y).Tag as ListViewItemTag; if (e.Button == MouseButtons.Right) { ctxMenuChangesets.Show(sender as Control, e.Location); } }
/// <summary> /// Handles the SelectedIndexChanged event of the listView1 control. /// Updates <see cref="ClickedItem"/> object to currently selected ListView item. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 0) { ClickedItem = null; } else { ClickedItem = listView1.SelectedItems[0].Tag as ListViewItemTag; } }
/// <summary> /// Handles the MouseClick event of the listView1 control. /// Shows ListView context menu, see <see cref="ctxMenuChangesets_ItemClicked"/>. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param> private void listView1_MouseClick(object sender, MouseEventArgs e) { ClickedItem = listView1.GetItemAt(e.X, e.Y).Tag as ListViewItemTag; if (e.Button == MouseButtons.Right) { ctxMenuChangesets.Show(sender as Control,e.Location); } }
/// <summary> /// Updates ListView column "Server Path". /// </summary> /// <param name="itm">The itm.</param> private void EditServerPath(ListViewItemTag itm) { if (itm == null) return; string res = Microsoft.VisualBasic.Interaction.InputBox("Enter new value for Source Path", Utilities.AppTitle, itm.sourcePath); if (string.IsNullOrWhiteSpace(res)) return; while (res.EndsWith("/")) res = res.Substring(0, res.Length - 1); while (res.EndsWith("\\")) res = res.Substring(0, res.Length - 1); SuppressEvents = true; foreach (ListViewItem item in listView1.SelectedItems) { item.SubItems[7].Text = res; (item.Tag as ListViewItemTag).sourcePath = res; } UpdateRelatedBranchesCombo(); SuppressEvents = false; SetMergeTypes(); }
/// <summary> /// Creates the new ListView item. /// </summary> /// <param name="wiID">The Work Item ID.</param> /// <param name="chID">The Chengeset ID.</param> /// <param name="chDate">The Changeset check-in date.</param> /// <param name="chOwner">The Changeset creator.</param> /// <param name="sourcePath">The Changeset root server path.</param> /// <param name="chchanges">The Changes types comma separated list.</param> /// <param name="chcomment">The Changeset comment.</param> /// <param name="tag">The ListView item Tag object, see <see cref="ListViewItemTag"/>.</param> /// <returns></returns> public ListViewItem AddNewGridItem(string wiID, string chID, string chDate, string chOwner, string sourcePath, string chchanges, string chcomment, ListViewItemTag tag) { ListViewItem lvitem; if (!listView1.Items.ContainsKey(chID)) { lvitem = new ListViewItem(new string[] { "", wiID, chID, chDate, chOwner, chchanges, "none", sourcePath, chcomment }); lvitem.Name = chID; lvitem.Checked = true; lvitem.Tag = tag; listView1.Items.Add(lvitem); } else { lvitem = listView1.Items[chID]; lvitem.SubItems[1].Text += ","+wiID; } return lvitem; }
/// <summary> /// Creates the new ListView item. /// </summary> /// <param name="wiID">The Work Item ID.</param> /// <param name="chID">The Chengeset ID.</param> /// <param name="chDate">The Changeset check-in date.</param> /// <param name="chOwner">The Changeset creator.</param> /// <param name="sourcePath">The Changeset root server path.</param> /// <param name="chchanges">The Changes types comma separated list.</param> /// <param name="chcomment">The Changeset comment.</param> /// <param name="tag">The ListView item Tag object, see <see cref="ListViewItemTag"/>.</param> /// <returns></returns> public ListViewItem AddNewGridItem(string wiID, string chID, string chDate, string chOwner, string sourcePath, string chchanges, string chcomment, ListViewItemTag tag) { ListViewItem lvitem; if (!listView1.Items.ContainsKey(chID)) { lvitem = new ListViewItem(new string[] { "", wiID, chID, chDate, chOwner, chchanges, "none", sourcePath, chcomment }); lvitem.Name = chID; lvitem.Checked = true; lvitem.Tag = tag; listView1.Items.Add(lvitem); } else { lvitem = listView1.Items[chID]; lvitem.SubItems[1].Text += "," + wiID; } return(lvitem); }