Exemplo n.º 1
0
        private void CreateAndInitializeButtons()
        {
            try
            {
                var addImage        = Properties.Resources.IE_UserAdd_24;
                var modifyImage     = Properties.Resources.IE_UserModify_24;
                var deleteImage     = Properties.Resources.IE_UserDelete_24;
                var propertiesImage = Properties.Resources.IE_UserProperties_24;
                var memberShipImage = Properties.Resources.IE_GroupManagement_24;
                var activateImage   = Properties.Resources.IE_UserActivate_24;
                var deactivateImage = Properties.Resources.IE_UserDeactivate_24;

                // Add ButtonItem
                AddButtonItem        = MenuGenerator.CreateButtonItem(addImage, nameof(AddButtonItem), "Add", false, null, true);
                ModifyButtonItem     = MenuGenerator.CreateButtonItem(modifyImage, nameof(ModifyButtonItem), "Modify", false, null, true);
                DeleteButtonItem     = MenuGenerator.CreateButtonItem(deleteImage, nameof(DeleteButtonItem), "Delete", false, null, true);
                PropertiesButtonItem = MenuGenerator.CreateButtonItem(propertiesImage, nameof(PropertiesButtonItem), "Properties", false, null, true);

                AddButtonItem.Click        += ButtonItemClick;
                ModifyButtonItem.Click     += ButtonItemClick;
                DeleteButtonItem.Click     += ButtonItemClick;
                PropertiesButtonItem.Click += ButtonItemClick;

                AddButtonItem.Visible        = true;
                ModifyButtonItem.Visible     = true;
                DeleteButtonItem.Visible     = true;
                PropertiesButtonItem.Visible = true;

                EnableDisableButtons();

                // Add RibbonBar
                var baseItems = new DevComponents.DotNetBar.BaseItem[] {
                    AddButtonItem,
                    ModifyButtonItem,
                    DeleteButtonItem,
                    PropertiesButtonItem
                };

                MaterialsRibbonBar = MenuGenerator.CreateRibbonBar(baseItems, nameof(MaterialsRibbonBar), Translations.General.Manage);
            }
            catch (Exception ex)
            {
                Trace.WriteError("", Trace.GetMethodName(), CLASSNAME, ex);
            }
        }