/// <summary> /// Adds the <paramref name="element" /> to ListView. /// </summary> /// <param name="element">The element.</param> /// <returns>The added item.</returns> /// <exception cref="ArgumentNullException">element</exception> private void AddElementToListView(RotationElement element) { if (element == null) { throw new ArgumentNullException("element"); } var item = new ListViewItem(element.GameMode.Name) { Tag = element }; item.SubItems.Add(element.Map.Name); rotationListView.Items.Add(item); }
private void rotationListView_SelectedIndexChanged(object sender, EventArgs e) { RotationElement newElement = rotationListView.SelectedItems.Count == 0 ? null : rotationListView.SelectedItems[0].Tag as RotationElement; if (SelectedElement == newElement) { return; } SelectedElement = newElement; OnSelectedElementChanged(EventArgs.Empty); }
private void upButton_Click(object sender, EventArgs e) { if (MapRotation == null) { return; } RotationElement element = SelectedElement; if (element == null) { return; } MapRotation.MoveUp(SelectedElement); }
/// <summary> /// Adds the <paramref name="element" /> to ListView at the specified <paramref name="index" />. /// </summary> /// <param name="element">The element.</param> /// <param name="index">The index.</param> /// <returns>The added item.</returns> /// <exception cref="ArgumentNullException">element</exception> private ListViewItem AddElementToListView(RotationElement element, int index) { if (element == null) { throw new ArgumentNullException("element"); } var item = new ListViewItem(element.GameMode.Name) { Tag = element }; item.SubItems.Add(element.Map.Name); rotationListView.Items.Insert(index, item); return(item); }
/// <summary> /// Initializes a new instance of the <see cref="RotationElementEventArgs" /> class. /// </summary> /// <param name="element">The element.</param> /// <param name="index">The index.</param> public RotationElementEventArgs(RotationElement element, int index) { Element = element; Index = index; }
/// <summary> /// Initializes a new instance of the <see cref="RotationElementsSwappedEventArgs" /> class. /// </summary> /// <param name="leftElement">Element on the left.</param> /// <param name="rightElement">Element on the right.</param> public RotationElementsSwappedEventArgs(RotationElement leftElement, RotationElement rightElement) { LeftElement = leftElement; RightElement = rightElement; }
/// <summary> /// Gets the item of element. /// </summary> /// <param name="element">The element.</param> /// <returns></returns> private ListViewItem GetItemOfElement(RotationElement element) { return(rotationListView.Items.OfType <ListViewItem>().FirstOrDefault(i => i.Tag == element)); }