Beispiel #1
0
 private void OpenDocument()
 {
     TabParent.OpenTab(DialogHelper.GenerateDialogHashName(RepresentationModel.GetEntityType(tableview.GetSelectedObject()), 0),
                       () => RepresentationModel.GetOpenEntityDlg(tableview.GetSelectedObject()),
                       this
                       );
 }
Beispiel #2
0
        private void ConfigureActions()
        {
            MenuButton addDocumentButton = new MenuButton();

            addDocumentButton.Label = "Добавить";
            Menu addDocumentActions = new Menu();

            foreach (var item in RepresentationModel.NewEntityActionsConfigs)
            {
                var menuItem = new MenuItem(item.Title);
                menuItem.Activated += (sender, e) => {
                    TabParent.OpenTab(DialogHelper.GenerateDialogHashName(item.EntityType, 0),
                                      item.GetNewEntityDlg,
                                      this
                                      );
                };
                SetCreateActionsSensitiveFunc(menuItem, item.EntityType);
                addDocumentActions.Add(menuItem);
            }
            addDocumentButton.Menu = addDocumentActions;
            addDocumentActions.ShowAll();
            hboxButtonActions.Add(addDocumentButton);
            Box.BoxChild addDocumentButtonBox = (Box.BoxChild)hboxButtonActions[addDocumentButton];
            addDocumentButtonBox.Expand = false;
            addDocumentButtonBox.Fill   = false;

            Button editDocumentbutton = new Button();

            editDocumentbutton.Label    = "Редактировать";
            editDocumentbutton.Clicked += (sender, e) => {
                OpenDocument();
            };
            SetOpenActionSensitiveFunc(editDocumentbutton);
            hboxButtonActions.Add(editDocumentbutton);
            Box.BoxChild editDocumentbuttonBox = (Box.BoxChild)hboxButtonActions[editDocumentbutton];
            editDocumentbuttonBox.Expand = false;
            editDocumentbuttonBox.Fill   = false;

            Button deleteDocumentbutton = new Button();

            deleteDocumentbutton.Label    = "Удалить";
            deleteDocumentbutton.Clicked += (sender, e) => {
                var selectedObject = tableview.GetSelectedObject();
                if (OrmMain.DeleteObject(RepresentationModel.GetEntityType(selectedObject), RepresentationModel.GetDocumentId(selectedObject)))
                {
                    RepresentationModel.UpdateNodes();
                }
            };
            SetDeleteActionSensitiveFunc(deleteDocumentbutton);
            hboxButtonActions.Add(deleteDocumentbutton);
            Box.BoxChild deleteDocumentbuttonBox = (Box.BoxChild)hboxButtonActions[deleteDocumentbutton];
            deleteDocumentbuttonBox.Expand = false;
            deleteDocumentbuttonBox.Fill   = false;

            hboxButtonActions.ShowAll();
        }