예제 #1
0
        private void fillAutocomplete()
        {
            if (!RepresentationModel.CanEntryFastSelect)
            {
                return;
            }

            logger.Info("Запрос данных для автодополнения...");
            completionListStore = new ListStore(typeof(string), typeof(object));

            if (RepresentationModel.ItemsList == null)
            {
                RepresentationModel.UpdateNodes();
            }

            foreach (var item in RepresentationModel.ItemsList)
            {
                completionListStore.AppendValues(
                    (item as INodeWithEntryFastSelect).EntityTitle,
                    item
                    );
            }
            entryObject.Completion.Model = completionListStore;
            logger.Debug("Получено {0} строк автодополения...", completionListStore.IterNChildren());
        }
예제 #2
0
 void ConfigureDlg()
 {
     Mode = JournalSelectMode.None;
     ConfigureActions();
     TreeView.Selection.Changed  += TreeViewSelection_Changed;
     TreeView.ButtonReleaseEvent += OnOrmtableviewButtonReleaseEvent;
     RepresentationModel.UpdateNodes();
 }
예제 #3
0
        public override void Execute()
        {
            int selectedId = DomainHelper.GetId(dialog.SelectedNodes.First());

            if (DeleteHelper.DeleteEntity(EntityClass, selectedId))
            {
                RepresentationModel.UpdateNodes();
            }
        }
예제 #4
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();
        }
        protected void OnButtonDeleteClicked(object sender, EventArgs e)
        {
            var node       = ormtableview.GetSelectedObjects() [0];
            int selectedId = DomainHelper.GetId(node);

            if (OrmMain.DeleteObject(objectType, selectedId))
            {
                RepresentationModel.UpdateNodes();
            }
        }
예제 #6
0
 protected void OnButtonRefreshClicked(object sender, EventArgs e)
 {
     RepresentationModel.UpdateNodes();
 }