/// <summary> /// Открываем форму редактирования выделенных объектов /// </summary> private void ItemEditButton_Click(object sender, EventArgs e) { Type editType = null; ListView listView = null; WebPanelOptionData.IOptionData options = AccountManager.SelectAccount.WebPanelAPIOptions.Clone() as WebPanelOptionData.IOptionData; if (sender.Equals(this.IDomainEditButton)) { editType = typeof(WebPanelItems.DomainItem); listView = this.DomainListView; } else if (sender.Equals(this.ISubDomainEditButton)) { editType = typeof(WebPanelItems.SubDomainItem); listView = this.SubDomainListView; } WebPanelItems.WebPanelItemCollection remCollection = WebPanelAccount.AccountManager.SelectAccount.PanelItems[editType].SelectRange(listView.SelectedIndices.Cast <int>().Select(item => item)); ActionsTaskForm editForm = new ActionsTaskForm(remCollection, options); editForm.FormClosedEvent += new EventHandler <BatchDomainTools.WebPanelCommons.SimpleEventArgs>((_sender, _e) => { if ((bool)_e.EventArg) { ItemListUpdButton_Click(editType, e); } }); editForm.ShowDialog(); }
/// <summary> /// Открываем форму добавления объектов /// TODO: Объединить часть кода получения типа объектов с ItemRemoveButton_Click, ItemEditButton_Click, ItemListUpdButton_Click в один метод /// </summary> private void ItemAdd_Click(object sender, EventArgs e) { WebPanelOptionData.IOptionData options = AccountManager.SelectAccount.WebPanelAPIOptions.Clone() as WebPanelOptionData.IOptionData; Type addType = null; if (sender.Equals(this.IDomainAddButton)) { addType = typeof(WebPanelItems.DomainItem); } else if (sender.Equals(this.ISubDomainAddButton)) { addType = typeof(WebPanelItems.SubDomainItem); } ActionsTaskForm addForm = new ActionsTaskForm(addType, options); addForm.FormClosedEvent += new EventHandler <BatchDomainTools.WebPanelCommons.SimpleEventArgs>((_sender, _e) => { if ((bool)_e.EventArg) { ItemListUpdButton_Click(addType, e); } }); addForm.ShowDialog(); }