Example #1
0
        /// <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);
        }
Example #2
0
        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);
        }
Example #3
0
        private void upButton_Click(object sender, EventArgs e)
        {
            if (MapRotation == null)
            {
                return;
            }

            RotationElement element = SelectedElement;

            if (element == null)
            {
                return;
            }

            MapRotation.MoveUp(SelectedElement);
        }
Example #4
0
        /// <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);
        }
Example #5
0
 /// <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;
 }
Example #6
0
 /// <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;
 }
Example #7
0
 /// <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));
 }