Automatak.Simulator.DNP3.Components.MasterScanControl.listViewScans_MouseDown C# (CSharp) Method

listViewScans_MouseDown() private method

private listViewScans_MouseDown ( object sender, MouseEventArgs e ) : void
sender object
e MouseEventArgs
return void
        private void listViewScans_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != System.Windows.Forms.MouseButtons.Right)
            {
                return;
            }

            ListViewItem choice = null;

            foreach (ListViewItem item in listViewScans.Items)
            {
                if (item.Bounds.Contains(new Point(e.X, e.Y)))
                {
                        choice = item;
                }
            }

            if (choice == null)
            {
                this.contextMenuStripAdd.Show(listViewScans, e.X, e.Y);
            }
            else
            {
                this.GetScanMenu(((IMasterScan)choice.Tag)).Show(listViewScans, e.X, e.Y);
            }
        }