コード例 #1
0
        private void FormManager_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (childWindow != null)
            {
                childWindow = null;
            }

            if (uiTransactionManager != null)
            {
                uiTransactionManager = null;
            }

            if (uiMasterTableManager != null)
            {
                uiMasterTableManager = null;
            }

            if (uiMenuManager != null)
            {
                uiMenuManager = null;
            }
        }
コード例 #2
0
        public void ShowWindow()
        {
            if (childWindow == null)
            {
                childWindow = SystemHandler.GeneralChildWindow.GetNewInstance();
            }

            childWindow.BorderStyle              = VBRUN.FormBorderStyleConstants.vbSizable;
            childWindow.Caption                  = "Menu";
            childWindow.IDFieldCaption           = "Artigo:";
            childWindow.SearchButtonVisible      = false;
            childWindow.NavigationButtonsVisible = false;
            childWindow.IDFieldVisible           = false;

            if (uiTransactionManager == null)
            {
                uiTransactionManager = SystemHandler.GeneralUITransaction;
            }

            if (uiMasterTableManager == null)
            {
                uiMasterTableManager = SystemHandler.GeneralUIMasterTable;
            }

            if (uiMenuManager == null)
            {
                uiMenuManager = SystemHandler.GeneralUIMenu;
            }
            //
            // Construir menus da janela
            // 1. Botões
            var xternderMenuItems = new ExtenderMenuItems();
            var m = xternderMenuItems.Add("xAction1", "Acção 1");

            m.ActionType = ExtenderActionType.ExtenderActionPrimary;

            m            = xternderMenuItems.Add("xAction2", "Acção 2");
            m.ActionType = ExtenderActionType.ExtenderActionSecondary;

            //
            //2. Opções
            m            = xternderMenuItems.Add("xOpcoes", "Opções");
            m.GroupType  = ExtenderGroupType.ExtenderGroupTypeExtraOptions;
            m.BeginGroup = true;
            m.ChildItems.Add("xOpcoes1", "Opção 1");
            m.ChildItems.Add("xOpcoes2", "Opção 2");
            childWindow.MenuItems = xternderMenuItems;

            childWindow.Init(this);

            //Translate to twips
            childWindow.SetClientArea(this.Width * 15, this.Height * 15);
            childWindow.CenterOnScreen();


            this.Visible = true;
            childWindow.Show();

            //childWindow.WindowState = VBRUN.FormWindowStateConstants.vbMaximized;


            //Enable panel
            if (childWindow.EditState == EditStateType.esNull)
            {
                childWindow.EditState = EditStateType.esNew;
            }
        }
コード例 #3
0
ファイル: SystemHandler.cs プロジェクト: fcvmv/50c-API
        private void MyEvents_OnStartup(object Sender, ExtenderEventArgs e)
        {
            ExtendedPropertyList properties = null;;
            ExtenderMenuItems    menuItem;

            //APIEngine.SystemSettings.WorkstationInfo.Touch.CompanyLogoPosition = 1;

            properties = (ExtendedPropertyList)e.get_data();

            //this property will only be available in the backoffice
            if (properties.PropertyExists("ChildWindow"))
            {
                generalChildWindow = (IChildWindow2)properties.get_Value("ChildWindow");
            }

            //this property will only be available in the backoffice
            if (properties.PropertyExists("WorkspaceWindow"))
            {
                generalWorkspaceWindow = (IWorkspaceWindow)properties.get_Value("WorkspaceWindow");
            }
            //this property will be available in both backoffice and frontoffice
            if (properties.PropertyExists("DialogWindow"))
            {
                generalDialogWindow = (IDialogWindow)properties.get_Value("DialogWindow");
            }

            //this property will be available in both backoffice and frontoffice
            if (properties.PropertyExists("UITransactionManager"))
            {
                generalUITransactionManager = (IUITransaction)properties.get_Value("UITransactionManager");
            }

            //this property will be available in both backoffice and frontoffice
            if (properties.PropertyExists("UIMasterTableManager"))
            {
                generalUIMasterTableManager = (IUIMasterTable)properties.get_Value("UIMasterTableManager");
            }

            if (properties.PropertyExists("UIMenuManager"))
            {
                generalUIMenuManager = (IUIMenu)properties.get_Value("UIMenuManager");
            }

            // CUSTOM MENUS
            // Definir os menus
            // Botão simples
            menuItem = new ExtenderMenuItems();
            var simpleButton = menuItem.Add("miSimpleButton", "Exemplo de janela");

            // Colocar o caminho para o icone.
            // Não usar os nomes de ficheiro da Sage em:
            //      TARGETDIR\Icons50c
            //      TARGETDIR\Images
            var myTargetDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

            myTargetDir = System.IO.Path.Combine(myTargetDir, "Icons");
            simpleButton.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-01.png");
            var simpleButton2 = menuItem.Add("miSimpleButton1", "Exemplo 2 de janela");

            simpleButton2.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-02.png");

            // Botão com submenu
            var parentButton = menuItem.Add("miComplexButton", "Grupo");
            var parentBtn1   = parentButton.ChildItems.Add("miComplexButtonItem1", "Clique aqui para ver uma mensagem do Grupo!");

            parentBtn1.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-03.png");
            //menuItem.Add("miItemView", "Alterar Artigos");

            var parentButton2 = menuItem.Add("miComplexButton2", "Grupo");
            var child1        = parentButton2.ChildItems.Add("miComplexButtonItem2", "SubGrupo");
            var childItem1    = child1.ChildItems.Add("miComplexButtonItem3", "Clique aqui para ver uma mensagem do SubGrupo!", "miComplexButtonItem3");

            childItem1.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-03.png");
            var childItem2 = child1.ChildItems.Add("miComplexButtonItem4", "Clique aqui para ver outra mensagem do SubGrupo!", "miComplexButtonItem3");

            childItem2.PictureName = System.IO.Path.Combine(myTargetDir, "icon-save.ico");

            // Custom Functions
            // Remember, all functions declared here will not recorded on physical base
            AddMyFunction("XFunctionA", "PTG");
            AddMyFunction("XPosDisplay", "PTG");

            //
            // COM mandatories
            object oMenuItem = menuItem;

            properties.set_Value("ExtenderMenuItems", ref oMenuItem);

            //Change RibbonTab Title
            object oRibbonCaption = "My caption";

            properties.set_Value("RibbonCaption", ref oRibbonCaption);

            //Use this property if you want Sage Retail to rebuild the permissions tree...
            //object rebuildPermissionsTree = true;
            //properties.set_Value("RebuildPermissionsTree", rebuildPermissionsTree);

            object oProps = properties;

            e.result.set_data(ref oProps);

            menuItem = null;
        }