public void DeleteItem(ConfigItem deleted) { if (deleted.GetType().Name == "ConfigFlow") { this.designer.Client.Children.Remove(deleted.GetShowItem()); (deleted as ConfigFlow).Start.DetachFlow((ConfigFlow)deleted); (deleted as ConfigFlow).End.DetachFlow((ConfigFlow)deleted); wf_itmes.Remove(deleted); } else if (deleted.GetType().Name == "ConfigEvent" || deleted.GetType().Name == "ConfigSubEvent") { List <ConfigFlow> flows = deleted.GetAttachFolws(); foreach (ConfigFlow cf in flows) { this.designer.Client.Children.Remove(cf.GetShowItem()); wf_itmes.Remove(deleted); } flows.Clear(); this.designer.Client.Children.Remove(deleted.GetShowItem()); wf_itmes.Remove(deleted); } }