Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAddSerivce_Click(object sender, EventArgs e)
        {
            var item = Items.First(tmp => tmp.Nickname == CbItems.Text);
            var form = new InputForm(@"请输入项目名称", string.Empty)
            {
                InputAction = s =>
                {
                    LbServices.Items.Add(s);
                    item.Services.Add(s);
                }
            };
            var result = form.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }
            BtnEditService.Enabled = true;
            BtnDelService.Enabled  = true;
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnEditService_Click(object sender, EventArgs e)
        {
            var selected = LbServices.SelectedItem;
            var service  = (string)LbServices.SelectedItem;
            var item     = Items.First(tmp => tmp.Nickname == CbItems.Text);
            var form     = new InputForm(@"请输入项目名称", string.Empty)
            {
                InputAction = s =>
                {
                    LbServices.Items.Add(s);
                    item.Services.Add(s);
                }
            };
            var result = form.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }
            LbServices.Items.Remove(service);
            item.Services.Remove((string)selected);
        }