private void ShowItem(DBItem item) { if (item is UserGroup group) { if (!(GuiService.Main.DockPanel.Find(PermissionEditor.GetName(group)) is PermissionEditor editor)) { editor = new PermissionEditor() { Group = group } } ; GuiService.Main.DockPanel.Put(editor, DockType.Content); } else if (item is User user) { if (item == GuiEnvironment.User && !user.Super.Value) { MessageDialog.ShowMessage(ParentWindow, "Unable edit current user!", "Access"); return; } var editor = new UserEditor { User = user }; editor.ShowWindow(this); } else if (item is Template template) { var editor = new TemplateEditor { Template = template }; editor.ShowWindow(this); } else if (item is Work work) { var editor = new WorkEditor { Work = work }; editor.ShowWindow(this); } else if (item is Stage stage) { var editor = new StageEditor { Stage = stage }; editor.ShowWindow(this); } else if (item != null) { se.DataSource = item; se.List.EditState = item.Attached ? EditListState.Edit : EditListState.EditAny; ose.Title = $"{item.Table} ({item})"; ose.Mode = ToolShowMode.Dialog; ose.Show(this, new Point(0, 0)); } }
//private TableEditor parameters; public WorkEditor() { var groupBox = new GroupBox( new GroupBoxItem { Name = "Attributes", Column = 0, Row = 0, Width = 400, FillHeight = true, Widget = attribures = new ListEditor { AccessVisible = true } }, new GroupBoxItem { Name = "Stages", Column = 1, Row = 0, FillWidth = true, FillHeight = true, Widget = stages = new TableEditor { TableView = new DBTableView <Stage>((QParam)null, DBViewKeys.Empty), OwnerColumn = Stage.DBTable.ParseProperty(nameof(Stage.WorkId)), OpenMode = TableEditorMode.Referencing } }, new GroupBoxItem { Name = "Stage Parameters", Column = 0, Row = 1, FillWidth = true, FillHeight = true, Widget = stageEditor = new StageEditor() }) { Name = "GroupBox" }; stages.SelectionChanged += StagesSelectionChanged; PackStart(groupBox, true, true); }