private void ServiceTree_MouseDoubleClick(object sender, MouseEventArgs e) { TreeListHitInfo info = ServiceTree.CalcHitInfo(new Point(e.X, e.Y)); if (info.Node == null || info.HitInfoType == HitInfoType.Empty) return; ServiceTree serviceTree = GetServiceByNode(info.Node); ServiceTree parentNode = GetServiceByNode(info.Node.ParentNode); if (parentNode == null) return; using (ServiceDetailsForm form = new ServiceDetailsForm()) { form.ServiceTypes = GetServiceTypes(ServiceTree.Nodes); form.CurrentServiceType = new ServiceType { Name = parentNode.Name, ServiceTypeId = parentNode.ServiceId }; form.Service = new Service { Name = serviceTree.Name, ServiceId = serviceTree.ServiceId, ServiceTypeId = parentNode.ServiceId }; if (form.ShowDialog() == DialogResult.OK) { needRaseSelecttionChangedEvent = false; OnServiceUpdated(new ServiceUpdatedEventArgs(form.CurrentServiceType, form.Service)); OnDataSourceChanged(); ServiceTree.Selection.Clear(); needRaseSelecttionChangedEvent = true; Select(form.Service); } } }
private void MenuNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { using (ServiceDetailsForm form = new ServiceDetailsForm()) { form.ServiceTypes = GetServiceTypes(ServiceTree.Nodes); if (form.ShowDialog() == DialogResult.OK) { needRaseSelecttionChangedEvent = false; OnServiceUpdated(new ServiceUpdatedEventArgs(form.CurrentServiceType, form.Service)); OnDataSourceChanged(); ServiceTree.Selection.Clear(); needRaseSelecttionChangedEvent = true; Select(form.Service); } } }