Exemplo n.º 1
0
        private void childWindowOpenedHandler(ChildWindowBase window)
        {
            ToolStripMenuItem newMenuItem = new ToolStripMenuItem()
            {
                Text = window.Text,
                Tag  = window
            };

            newMenuItem.Click += windowsMenuItemClickHandler;
            windowsMenu.DropDownItems.Add(newMenuItem);
        }
Exemplo n.º 2
0
        private void childWindowClosedHandler(ChildWindowBase window)
        {
            ToolStripItemCollection items = windowsMenu.DropDownItems;
            int elementCount = items.Count;

            for (int i = elementCount - 1; i >= 0; i--)
            {
                if (items[i].Tag == window)
                {
                    items.RemoveAt(i);
                }
            }
        }
Exemplo n.º 3
0
        protected CustomDataGridViewColumnDescriptorBuilder <TModelBasetype> editButtonColumnCreator <TModelBasetype>(CustomDataGridView <TModelBasetype> table, ItemListFormBaseManager <TModelBasetype> .ColumnDescriptorBuilderGetterDelegate builderGetterMethod)
            where TModelBasetype : class, IModel, INotifyPropertyChanged
        {
            CustomDataGridViewColumnDescriptorBuilder <TModelBasetype> builder = builderGetterMethod();

            builder.Type(DataGridViewColumnType.Button);
            builder.Header("Edit");
            builder.Width(70);
            builder.ButtonText("Edit");
            builder.CellContentClickHandlerMethod((item, cell, e) => {
                ChildWindowBase editWindow = null;
                if (EditorFormTypeRegister != null)
                {
                    ModelEditorFormTypeRegister <TModelBasetype> typeRegisterCasted = EditorFormTypeRegister as ModelEditorFormTypeRegister <TModelBasetype>;
                    editWindow = typeRegisterCasted?.GetFormForModel(item) as ChildWindowBase;
                }
                else if (ModelEditorForm != null)
                {
                    editWindow = ModelEditorForm.GetInstance(item) as ChildWindowBase;
                }
                editWindow?.ShowAsChild();
            });
            return(builder);
        }