コード例 #1
0
        private void BindEvent(
            Button btnSelectAll,
            Button btnSelectInvert,
            Button btnSelectNone,
            Button btnDeleteSelected,
            Button btnRefreshSelected)
        {
            btnSelectAll.Click +=
                (s, a) => LoopThroughFlyContentItems(
                    (b) => b.Select(true));
            btnSelectNone.Click +=
                (s, a) => LoopThroughFlyContentItems(
                    (b) => b.Select(false));
            btnSelectInvert.Click +=
                (s, a) => LoopThroughFlyContentItems(
                    (b) => b.InvertSelection());
            btnDeleteSelected.Click +=
                (s, a) => LoopThroughFlyContentItems(
                    (b) =>
            {
                if (b.isSelected)
                {
                    flyContent.Controls.Remove(b);
                }
            });
            btnRefreshSelected.Click += (s, a) =>
            {
                var list = settings.GetAllServersList();
                LoopThroughFlyContentItems(b =>
                {
                    var bean = b.GetBean();
                    var c    = list.FirstOrDefault(t => t.GetCoreStates().GetUid() == bean.uid);
                    if (c == null)
                    {
                        flyContent.Controls.Remove(b);
                        return;
                    }

                    var coreStates = c.GetCoreStates();
                    b.SetStatus(coreStates.GetStatus());
                    b.SetTitle(coreStates.GetTitle());
                });
            };
        }