Esempio n. 1
0
        private void SelectAccountForm_Load(object sender, EventArgs e)
        {
            BringToFront();

            WindowState = FormWindowState.Minimized;
            Show();
            WindowState = FormWindowState.Normal;

            lvAcc.BeginUpdate();
            using (var db = new AccountConfigContext())
            {
                foreach (var item in db.Account)
                {
                    EXListViewItem lvItem = new EXListViewItem(item.AuthType.ToString());
                    lvItem.SubItems.Add(new EXControlListViewSubItem()
                    {
                        Text = item.Username
                    });
                    lvItem.SubItems.Add(new EXControlListViewSubItem()
                    {
                        Text = item.GetRuntime()
                    });
                    lvItem.SubItems.Add(new EXControlListViewSubItem()
                    {
                        Text = ""
                    });

                    EXControlListViewSubItem cs = new EXControlListViewSubItem()
                    {
                    };
                    Button b = new Button()
                    {
                        Text   = "START",
                        Height = 55
                    };
                    b.Click += SelectBot_Click;
                    b.Tag    = item;
                    lvItem.SubItems.Add(cs);
                    lvAcc.AddControlToSubItem(b, cs);
                    lvAcc.Items.Add(lvItem);
                }
            }
            lvAcc.EndUpdate();
        }
Esempio n. 2
0
        private void This_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            e.DrawBackground();
            if (e.ColumnIndex == _sortcol)
            {
                e.Graphics.FillRectangle(_sortcolbrush, e.Bounds);
            }
            if ((e.ItemState & ListViewItemStates.Selected) != 0)
            {
                e.Graphics.FillRectangle(_highlightbrush, e.Bounds);
            }
            int fonty = e.Bounds.Y + ((int)(e.Bounds.Height / 2)) - ((int)(e.SubItem.Font.Height / 2));
            int x     = e.Bounds.X + 2;

            if (e.ColumnIndex == 0)
            {
                EXListViewItem item = (EXListViewItem)e.Item;
                if (item.GetType() == typeof(EXImageListViewItem))
                {
                    EXImageListViewItem imageitem = (EXImageListViewItem)item;
                    if (imageitem.MyImage != null)
                    {
                        Image img  = imageitem.MyImage;
                        int   imgy = e.Bounds.Y + ((int)(e.Bounds.Height / 2)) - ((int)(img.Height / 2));
                        e.Graphics.DrawImage(img, x, imgy, img.Width, img.Height);
                        x += img.Width + 2;
                    }
                }
                e.Graphics.DrawString(e.SubItem.Text, e.SubItem.Font, new SolidBrush(e.SubItem.ForeColor), x, fonty);
                return;
            }
            EXListViewSubItemAB subitem = e.SubItem as EXListViewSubItemAB;

            if (subitem == null)
            {
                e.DrawDefault = true;
            }
            else
            {
                x = subitem.DoDraw(e, x, Columns[e.ColumnIndex] as EXColumnHeader);
                e.Graphics.DrawString(e.SubItem.Text, e.SubItem.Font, new SolidBrush(e.SubItem.ForeColor), x, fonty);
            }
        }
Esempio n. 3
0
        private void SelectAccountForm_Load(object sender, EventArgs e)
        {
            BringToFront();

            WindowState = FormWindowState.Minimized;
            Show();
            WindowState = FormWindowState.Normal;

            lvAcc.BeginUpdate();
            var accManager = TinyIoC.TinyIoCContainer.Current.Resolve <MultiAccountManager>();

            foreach (var item in accManager.Accounts)
            {
                EXListViewItem lvItem = new EXListViewItem(item.AuthType.ToString());
                lvItem.SubItems.Add(new EXControlListViewSubItem()
                {
                    Text = item.Username
                });
                lvItem.SubItems.Add(new EXControlListViewSubItem()
                {
                    Text = item.GetRuntime()
                });
                lvItem.SubItems.Add(new EXControlListViewSubItem()
                {
                    Text = ""
                });

                EXControlListViewSubItem cs = new EXControlListViewSubItem()
                {
                };
                Button b = new Button()
                {
                    Text   = "START",
                    Height = 55
                };
                b.Click += SelectBot_Click;
                b.Tag    = item;
                lvItem.SubItems.Add(cs);
                lvAcc.AddControlToSubItem(b, cs);
                lvAcc.Items.Add(lvItem);
            }
            lvAcc.EndUpdate();
        }
Esempio n. 4
0
        private void This_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            EXListViewItem lstvItem = GetItemAt(e.X, e.Y) as EXListViewItem;

            if (lstvItem == null)
            {
                return;
            }
            _clickeditem = lstvItem;
            int x = lstvItem.Bounds.Left;
            int i;

            for (i = 0; i < Columns.Count; i++)
            {
                x = x + Columns[i].Width;
                if (x > e.X)
                {
                    x = x - Columns[i].Width;
                    _clickedsubitem = lstvItem.SubItems[i];
                    _col            = i;
                    break;
                }
            }
            if (!(Columns[i] is EXColumnHeader))
            {
                return;
            }
            EXColumnHeader col = (EXColumnHeader)Columns[i];

            if (col.GetType() == typeof(EXEditableColumnHeader))
            {
                EXEditableColumnHeader editcol = (EXEditableColumnHeader)col;
                if (editcol.MyControl != null)
                {
                    Control c = editcol.MyControl;
                    if (c.Tag != null)
                    {
                        Controls.Add(c);
                        c.Tag = null;
                        if (c is ComboBox)
                        {
                            ((ComboBox)c).SelectedValueChanged += new EventHandler(Cmbx_SelectedValueChanged);
                        }
                        c.Leave += new EventHandler(C_Leave);
                    }
                    c.Location = new Point(x, GetItemRect(Items.IndexOf(lstvItem)).Y);
                    c.Width    = Columns[i].Width;
                    if (c.Width > Width)
                    {
                        c.Width = ClientRectangle.Width;
                    }
                    c.Text    = _clickedsubitem.Text;
                    c.Visible = true;
                    c.BringToFront();
                    c.Focus();
                }
                else
                {
                    txtbx.Location = new Point(x, GetItemRect(Items.IndexOf(lstvItem)).Y);
                    txtbx.Width    = Columns[i].Width;
                    if (txtbx.Width > Width)
                    {
                        txtbx.Width = ClientRectangle.Width;
                    }
                    txtbx.Text    = _clickedsubitem.Text;
                    txtbx.Visible = true;
                    txtbx.BringToFront();
                    txtbx.Focus();
                }
            }
            else if (col.GetType() == typeof(EXBoolColumnHeader))
            {
                EXBoolColumnHeader boolcol = (EXBoolColumnHeader)col;
                if (boolcol.Editable)
                {
                    EXBoolListViewSubItem boolsubitem = (EXBoolListViewSubItem)_clickedsubitem;
                    if (boolsubitem.BoolValue == true)
                    {
                        boolsubitem.BoolValue = false;
                    }
                    else
                    {
                        boolsubitem.BoolValue = true;
                    }
                    Invalidate(boolsubitem.Bounds);
                }
            }
        }