Exemplo n.º 1
0
        public void ListViewEx_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            Point        objDrawingPoint = new Point();
            ListViewItem objListViewItem = default(ListViewItem);

            objDrawingPoint = ListViewEx.PointToClient(Cursor.Position);

            //// Check to see if an item has been selected.
            if (!ReferenceEquals(objDrawingPoint, null))
            {
                objListViewItem = ListViewEx.GetItemAt(objDrawingPoint.X, objDrawingPoint.Y);

                //// If an item has been selected, then enable toolstrip buttons.
                if (!ReferenceEquals(objListViewItem, null))
                {
                    btnResume.Enabled = true;
                    btnPause.Enabled  = true;
                    btnRemove.Enabled = true;
                }
                else                 //// Else disable them.
                {
                    btnResume.Enabled = false;
                    btnPause.Enabled  = false;
                    btnRemove.Enabled = false;
                }
            }
        }
Exemplo n.º 2
0
        private void lvwInfactoryBatch_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListViewEx lvw = sender as ListViewEx;

            if (lvw != null)
            {
                ListViewItem item = lvw.GetItemAt(e.X, e.Y);
            }
        }
Exemplo n.º 3
0
        private void M_lvUsers_MouseClick(object sender, MouseEventArgs e)
        {
            if (m_lvUsers.FocusedItem.Bounds.Contains(e.Location))
            {
                m_Item = m_lvUsers.GetItemAt(e.X, e.Y);
                if (m_Item != null)
                {
                    Peer Pair = Peers.Find(x => x.CallSign == m_Item.Text);
                    if ((e.Button == MouseButtons.Right) && (Pair != null))
                    {
                        ContextMenu contextMenu = new ContextMenu();
                        if (Pair.Spawned >= 3)
                        {
                            MenuItem ResolMenuItem = new MenuItem("Remplacement AI");
                            ResolMenuItem.Click += ResolMenuItem_Click;
                            contextMenu.MenuItems.Add(ResolMenuItem);
#if DEBUG
                            MenuItem BlockDataItem = new MenuItem("Bloquer les données");
                            BlockDataItem.Click += BlockDataItem_Click;
                            if (Pair.BlockData)
                            {
                                BlockDataItem.Checked = true;
                            }
                            contextMenu.MenuItems.Add(BlockDataItem);
#endif
                        }
                        MenuItem UserMenuItem = new MenuItem("Masquer");
                        if (Properties.Settings.Default.P2PBlackList.Contains(m_Item.Text))
                        {
                            UserMenuItem.Checked = true;
                        }
                        UserMenuItem.Click += UserMenuItem_Click;
                        contextMenu.MenuItems.Add(UserMenuItem);
                        m_lvUsers.ContextMenu = contextMenu;
                    }
                }
            }
        }
Exemplo n.º 4
0
        private TabPage CreateListViewTabPage(string categoryname, TabControl tabcontrol, Search search)
        {
            for (int i = 0; i < tabcontrol.TabPages.Count; i++) {
                var tabpage = tabcontrol.TabPages[i];
                var lw = GetTabListViewControl(tabpage);
                if (lw.search == search) {
                    lw.DataItems = category.Filter(getSelectedCategory(), search.getSearch());
                    return tabpage;
                }
            }

            var listview = new ListViewEx(category.Filter(categoryname, search.getSearch()));
            var page = listview.DataItems.Count / config.ShowNum;
            listview.Page = listview.DataItems.Count % config.ShowNum == 0 ? page : page + 1;

            if (categoryname == Category.Trust) {
                listview.MultiSelect = true;
            }
            listview.search = search;
            listview.ContextMenuStrip = TabListViewContextMenuStrip;

            listview.MouseUp += (sender, e) => {
                var item = listview.GetItemAt(e.X, e.Y);
                if (item == null && listview.FocusedItem !=null) {
                    listview.FocusedItem.Selected = true;
                }
            };

            listview.ItemSelectionChanged += (sender, e) => {
                if (e.IsSelected) {
                    var d = listview.DataItems[e.ItemIndex];
                    this.EditItem(d.ID, false, false);
                }
            };

            listview.DoubleClick += (sender, e) => {
                if (listview.SelectedIndices.Count == 1) {
                    var selindex = listview.SelectedIndices[0];
                    var id = listview.DataItems[selindex].ID;
                    this.Moves(id);
                }
            };

            listview.ItemDrag += (s, e) => {
                if (listview.SelectedIndices.Count > 0) {
                    var index = listview.SelectedIndices[0];
                    var data = listview.DataItems[index];
                    listview.DoDragDrop(data, DragDropEffects.Move);
                }
            };

            listview.Dock = DockStyle.Fill;

            var t = new TabPage(search.Pattern);
            t.Controls.Add(listview);
            return t;
        }