示例#1
0
        public BlockDialog()
        {
            TitleLabel.Text = "Block List";

            HasFooter = false;

            SetClientSize(new Size(200, 200));

            ListBox = new DXListBox
            {
                Parent   = this,
                Location = ClientArea.Location,
                Size     = new Size(ClientArea.Width, ClientArea.Height - 25)
            };

            DXButton addButton = new DXButton
            {
                Label      = { Text = "Add" },
                Parent     = this,
                Location   = new Point(ClientArea.X, ClientArea.Bottom - 20),
                Size       = new Size(80, SmallButtonHeight),
                ButtonType = ButtonType.SmallButton,
            };

            addButton.MouseClick += (o, e) =>
            {
                DXInputWindow window = new DXInputWindow("Please enter the name of the person you wish to Block.", "Block Player")
                {
                    ConfirmButton = { Enabled = false },
                    Modal         = true
                };
                window.ValueTextBox.TextBox.TextChanged += (o1, e1) =>
                {
                    window.ConfirmButton.Enabled = Globals.CharacterReg.IsMatch(window.ValueTextBox.TextBox.Text);
                };
                window.ConfirmButton.MouseClick += (o1, e1) =>
                {
                    CEnvir.Enqueue(new C.BlockAdd {
                        Name = window.Value
                    });
                };
            };

            DXButton removeButton = new DXButton
            {
                Label      = { Text = "Remove" },
                Parent     = this,
                Location   = new Point(ClientArea.Right - 80, ClientArea.Bottom - 20),
                Size       = new Size(80, SmallButtonHeight),
                ButtonType = ButtonType.SmallButton,
                Enabled    = false,
            };

            removeButton.MouseClick += (o, e) =>
            {
                if (ListBox.SelectedItem == null)
                {
                    return;
                }

                DXMessageBox box = new DXMessageBox($"Are you sure you want to Un-Block {ListBox.SelectedItem.Label.Text}?", "Un-Block Player", DXMessageBoxButtons.YesNo);

                box.YesButton.MouseClick += (o1, e1) =>
                {
                    CEnvir.Enqueue(new C.BlockRemove {
                        Index = (int)ListBox.SelectedItem.Item
                    });
                };
            };

            ListBox.selectedItemChanged += (o, e) =>
            {
                removeButton.Enabled = ListBox.SelectedItem != null;
            };

            RefreshList();
        }
示例#2
0
        public BlockDialog()
        {
            TitleLabel.Text = "黑名单";

            HasFooter = false;

            SetClientSize(new Size(200, 200));

            ListBox = new DXListBox
            {
                Parent   = this,
                Location = ClientArea.Location,
                Size     = new Size(ClientArea.Width, ClientArea.Height - 25)
            };

            DXButton addButton = new DXButton
            {
                Label      = { Text = "添加" },
                Parent     = this,
                Location   = new Point(ClientArea.X, ClientArea.Bottom - 20),
                Size       = new Size(80, SmallButtonHeight),
                ButtonType = ButtonType.SmallButton,
            };

            addButton.MouseClick += (o, e) =>
            {
                DXInputWindow window = new DXInputWindow("请输入您要屏蔽的玩家角色名.", "屏蔽玩家")
                {
                    ConfirmButton = { Enabled = false },
                    Modal         = true
                };
                window.ValueTextBox.TextBox.TextChanged += (o1, e1) =>
                {
                    window.ConfirmButton.Enabled = Globals.CharacterReg.IsMatch(window.ValueTextBox.TextBox.Text);
                };
                window.ConfirmButton.MouseClick += (o1, e1) =>
                {
                    CEnvir.Enqueue(new C.BlockAdd {
                        Name = window.Value
                    });
                };
            };

            DXButton removeButton = new DXButton
            {
                Label      = { Text = "移除" },
                Parent     = this,
                Location   = new Point(ClientArea.Right - 80, ClientArea.Bottom - 20),
                Size       = new Size(80, SmallButtonHeight),
                ButtonType = ButtonType.SmallButton,
                Enabled    = false,
            };

            removeButton.MouseClick += (o, e) =>
            {
                if (ListBox.SelectedItem == null)
                {
                    return;
                }

                DXMessageBox box = new DXMessageBox($"您确认对玩家 {ListBox.SelectedItem.Label.Text} 解除屏蔽?", "解除屏蔽", DXMessageBoxButtons.YesNo);

                box.YesButton.MouseClick += (o1, e1) =>
                {
                    CEnvir.Enqueue(new C.BlockRemove {
                        Index = (int)ListBox.SelectedItem.Item
                    });
                };
            };

            ListBox.selectedItemChanged += (o, e) =>
            {
                removeButton.Enabled = ListBox.SelectedItem != null;
            };

            RefreshList();
        }