Пример #1
0
        /// <summary>初始化数据(InitializeCustomCode中调用该方法)</summary>
        /// <param name="csm1">接受从Epicor中传过来的CustomScriptManager对象</param>
        public void Initialize(Ice.Lib.Customization.CustomScriptManager csm1)
        {
            csm = csm1;
            //((Ice.Core.Session)(csm.GetGlobalInstance("oTrans")));//(Ice.Core.Session)(csm.GetGlobalInstance("oTrans"));//
            oTrans  = ((Erp.UI.App.POEntry.Transaction)(csm.GetGlobalInstance("oTrans")));
            session = (Ice.Core.Session)(oTrans.Session);
            edvUD01 = ((EpiDataView)(oTrans.EpiDataViews["POHeader"]));
            //oTrans.AdapterList[""];
            poAdapter           = new POAdapter(oTrans);
            baseToolbarsManager = ((UltraToolbarsManager)(csm.GetGlobalInstance("baseToolbarsManager")));
            standardTools       = baseToolbarsManager.Toolbars["Standard Tools"];
            TForm           = ((Erp.UI.App.POEntry.POEntryForm)(this.csm.GetGlobalInstance("POEntryForm")));
            epiBtNew        = GetControlByName <EpiButton>(TForm, "eb_sendPO");//获取UI界面的控件
            epiBtNew.Click += EpiBtNew_Click;

            ds_po       = oTrans.POData;
            dt_poheder  = ds_po.POHeader;
            dt_podetail = ds_po.PODetail;
        }
        private bool mGetMenuInfoStack(UltraToolbar objToolBar, string strMenuInfo, ref List<object> lstStack)
        {
            Logger.logBegin(string.Format("mGetMenuInfoStack {0}", MarsUFTAddins.IMars.tiger.ReflectorForCSharp.MarsTigerUtility.CombinePara("MenuInfo", strMenuInfo)));
            if (objToolBar == null) return false;
            if (lstStack == null) lstStack = new List<object>();

            for (int i = 0; i < (objToolBar == null ? -1 : objToolBar.Tools.Count); i++)
            {
                ToolBase objToolItem = objToolBar.Tools[i];
                if (!(objToolItem is PopupMenuTool)) continue;

                PopupMenuTool objMenu = (PopupMenuTool)objToolItem;

                ToolBase objMenuItem = objMenu.Tools[0];
                //objMenuItem.OwningToolbar

                if (string.Compare(objToolItem.Key, strMenuInfo, true) == 0)
                {
                    //find
                    lstStack.Add(objToolItem);
                    return true;
                }
                //if (objToolItem.)
            }

            Logger.logEnd("mGetMenuInfoStack");
            return false;
        }
        // Constructors

        internal MacroEditorFormMenuCommandbar(UltraToolbar ultraToolbar) : base(ultraToolbar)
        {
        }
Пример #4
0
        protected virtual void WfIniToolBarUI()
        {
            ImageList ilLarge = new ImageList();
            string    buttonKey;

            try
            {
                UtbmMain.Style = GetStyleLibrary.UltraWinToolBarDiplayStyle;

                UtbmMain.UseAppStyling             = false;
                UtbmMain.Office2007UICompatibility = false;
                UtbmMain.UseOsThemes = DefaultableBoolean.True;
                UtbmMain.Style       = ToolbarStyle.Office2013;
                UtbmMain.Ribbon.QuickAccessToolbar.Visible = false;

                UtbmMain.Ribbon.FileMenuStyle = FileMenuStyle.None;
                UtbmMain.Ribbon.CaptionAreaAppearance.BackColor            = Color.FromArgb(210, 210, 210);
                UtbmMain.Ribbon.FileMenuButtonAppearance.BackColor         = Color.FromArgb(67, 168, 152);
                UtbmMain.Ribbon.FileMenuButtonAppearance.BackGradientStyle = GradientStyle.None;

                UtbmMain.Ribbon.GroupSettings.CaptionAppearance.FontData.SizeInPoints = 8.5f;
                UtbmMain.Ribbon.GroupSettings.CaptionAppearance.ForeColor             = Color.White;

                UtbmMain.Ribbon.GroupSettings.HotTrackAppearance.BackColor         = Color.FromArgb(66, 126, 123);
                UtbmMain.Ribbon.GroupSettings.HotTrackAppearance.BackGradientStyle = GradientStyle.None;
                UtbmMain.Ribbon.GroupSettings.HotTrackAppearance.BorderAlpha       = Alpha.Opaque;
                UtbmMain.Ribbon.GroupSettings.HotTrackAppearance.BorderColor       = Color.FromArgb(67, 168, 152);
                UtbmMain.Ribbon.GroupSettings.HotTrackAppearance.ForeColor         = Color.White;
                UtbmMain.Ribbon.GroupSettings.ToolAppearance.ForeColor             = Color.FromArgb(179, 187, 191);

                UtbmMain.Ribbon.TabAreaAppearance.BackColor = Color.FromArgb(67, 168, 152);

                UtbmMain.Ribbon.TabSettings.Appearance.BackColor         = Color.FromArgb(66, 84, 94);
                UtbmMain.Ribbon.TabSettings.Appearance.BackGradientStyle = GradientStyle.None;
                UtbmMain.Ribbon.TabSettings.Appearance.BorderAlpha       = Alpha.Transparent;
                UtbmMain.Ribbon.TabSettings.Appearance.ForeColor         = Color.White;

                UtbmMain.Ribbon.TabSettings.SelectedAppearance.BackColor   = Color.FromArgb(66, 84, 94);
                UtbmMain.Ribbon.TabSettings.SelectedAppearance.BorderAlpha = Alpha.Transparent;

                UtbmMain.Ribbon.TabSettings.TabItemAppearance.BackColor = Color.FromArgb(67, 168, 152);


                UtbmMain.MdiMergeable = false;

                ilLarge = GlobalPictuer.LoadToolBarImage();
                if (ilLarge == null)
                {
                    return;
                }
                UtbmMain.ImageListLarge = ilLarge;
                UltraToolbar mainMenuBar = UtbmMain.Toolbars.AddToolbar("MainMenuBar");

                buttonKey = "BtPrint";
                var BtPrint = new ButtonTool(buttonKey);
                UtbmMain.Tools.Add(BtPrint);
                mainMenuBar.Tools.AddTool(buttonKey);
                mainMenuBar.Tools[buttonKey].InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Default;
                //BtPrint.SharedProps.AppearancesSmall.Appearance.Image = ilLarge.Images[GlobalPictuer.TOOLBAR_INSERT];
                //BtPrint.SharedPropsInternal.Shortcut = Shortcut.CtrlI;
                BtPrint.SharedProps.Caption      = "列 印";
                BtPrint.SharedProps.DisplayStyle = ToolDisplayStyle.ImageAndText;

                buttonKey = "BtExportPdf";
                var BtExportPdf = new ButtonTool(buttonKey);
                UtbmMain.Tools.Add(BtExportPdf);
                mainMenuBar.Tools.AddTool(buttonKey);
                mainMenuBar.Tools[buttonKey].InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Default;
                //BtPrint.SharedProps.AppearancesSmall.Appearance.Image = ilLarge.Images[GlobalPictuer.TOOLBAR_INSERT];
                //BtExportPdf.SharedPropsInternal.Shortcut = Shortcut.CtrlI;
                BtExportPdf.SharedProps.Caption      = "匯 出";
                BtExportPdf.SharedProps.DisplayStyle = ToolDisplayStyle.ImageAndText;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #5
0
        public static void LoadItems(DataView dv, UltraToolbarsManager toolbar, PopupMenuTool popupMenuTool)
        {
            string id;
            string Shortcut = "";



            foreach (DataRowView drv in dv)
            {
                if (IsAvaible(drv))
                {
                    long IdHerramienta = ( long )drv["IdHerramienta"];
                    id = ( string )drv["id"];
                    System.Console.WriteLine(IdHerramienta);
                    System.Console.WriteLine(id);


                    if (HasChilds(dv.Table, IdHerramienta) || drv["IdHerramientaPadre"] == System.DBNull.Value)
                    {
                        PopupMenuTool newPopupMenuTool = new PopupMenuTool(id);

                        newPopupMenuTool.SharedProps.Caption = GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta);


                        UltraToolbar mainMenuBar = toolbar.Toolbars["Menú principal"];

                        toolbar.Tools.Add(newPopupMenuTool);

                        bool visible = Convert.ToBoolean(drv["Visible"]);
                        newPopupMenuTool.SharedProps.Visible = visible;

                        //German 20110329 - Tarea 0000093
                        newPopupMenuTool.DropDownArrowStyle = DropDownArrowStyle.None;
                        //Fin German 20110329 - Tarea 0000093

                        if (drv["IdHerramientaPadre"] == System.DBNull.Value)
                        {
                            mainMenuBar.Tools.Add(newPopupMenuTool);
                            //German 20110328 - Tarea 0000093
                            //newPopupMenuTool.SharedProps.DisplayStyle = ToolDisplayStyle.TextOnlyInMenus;

                            //Fin German 20110328 - Tarea 0000093
                        }
                        else
                        {
                            if (GetRecurso(ID_TIPO_RECURSO_SEPARATOR, IdHerramienta) != string.Empty)
                            {
                                newPopupMenuTool.InstanceProps.IsFirstInGroup = true;
                            }

                            popupMenuTool.Tools.Add(newPopupMenuTool);
                        }

                        LoadItems(new DataView(dv.Table, string.Format("IdHerramientaPadre = {0}", drv["IdHerramienta"]), null, DataViewRowState.OriginalRows), toolbar, newPopupMenuTool);
                    }
                    else
                    {
                        //Debería tomar de herramientas recursos idiomas
                        //ButtonTool newButtonTool = new ButtonTool( GetRecurso( ID_TIPO_RECURSO_TITULO, IdHerramienta ) );

                        ButtonTool newButtonTool = new ButtonTool(id);


                        newButtonTool.SharedProps.Caption = GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta);

                        if (drv["Shortcut"] != System.DBNull.Value)
                        {
                            Shortcut = (string )drv["Shortcut"];
                            newButtonTool.SharedProps.Shortcut = (System.Windows.Forms.Shortcut)Enum.Parse(typeof(System.Windows.Forms.Shortcut), Shortcut, true);
                        }
                        if (GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta) != string.Empty)
                        {
                            //German 20110329 - Tarea 0000093
                            ImageList ilSmall = toolbar.ImageListSmall;
                            string    prueba  =
                                string.Format(
                                    mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" +
                                    GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "16");
                            Image image1 = null;
                            try
                            {
                                System.Drawing.Icon c = new Icon(prueba);
                                image1 = c.ToBitmap();
                            }
                            catch (Exception e)
                            {
                                image1 = Image.FromFile(prueba);
                                //int smallIndexImage = ilSmall.Images.Add( Image.FromFile(  prueba), System.Drawing.Color.Magenta );
                            }
                            int smallIndexImage = ilSmall.Images.Add(image1, System.Drawing.Color.Magenta);

                            ImageList ilLarge = toolbar.ImageListLarge;
                            prueba =
                                string.Format(
                                    mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" +
                                    GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "24");
                            //int largeIndexImage = ilLarge.Images.Add(Image.FromFile(prueba), System.Drawing.Color.Magenta);
                            try
                            {
                                System.Drawing.Icon c = new Icon(prueba);
                                image1 = c.ToBitmap();
                            }
                            catch (Exception e)
                            {
                                image1 = Image.FromFile(prueba);
                                //int smallIndexImage = ilSmall.Images.Add( Image.FromFile(  prueba), System.Drawing.Color.Magenta );
                            }
                            int largeIndexImage = ilLarge.Images.Add(image1, System.Drawing.Color.Magenta);

                            //Fin German 20110329 - Tarea 0000093
                            newButtonTool.SharedProps.AppearancesSmall.Appearance.Image = smallIndexImage;
                            newButtonTool.SharedProps.AppearancesLarge.Appearance.Image = largeIndexImage;
                        }

                        newButtonTool.SharedProps.DisplayStyle = ToolDisplayStyle.ImageAndText;
                        string SepKey  = GetRecurso(ID_TIPO_RECURSO_SEPARATOR, IdHerramienta);
                        bool   visible = Convert.ToBoolean(drv["Visible"]);


                        toolbar.Tools.Add(newButtonTool);

                        try
                        {
                            popupMenuTool.Tools.Add(newButtonTool);
                            if (SepKey != string.Empty)
                            {
                                popupMenuTool.Tools[id].InstanceProps.IsFirstInGroup = true;
                                //newButtonTool.InstanceProps.IsFirstInGroup = true;
                            }
                            if (!visible)
                            {
                                popupMenuTool.Tools[id].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.Message);
                        }
                    }
                }
            }
        }
Пример #6
0
        public static void LoadItems(DataView dv, UltraToolbarsManager toolbar)
        {
            long IdHerPadre = long.MinValue;

            foreach (DataRowView drv in dv)
            {
                if (IsAvaible(drv))
                {
                    long IdHerramienta = ( long )drv["IdHerramienta"];


                    ToolBase buttonTool;

                    string id = ( string )drv["id"];
                    System.Console.WriteLine(IdHerramienta);
                    System.Console.WriteLine(id);

                    if (toolbar.Tools.Exists(id))
                    {
                        buttonTool = toolbar.Tools[id];
                        //Cristian Tarea 881
                        buttonTool.SharedProps.ToolTipText = GetRecurso(ID_TIPO_RECURSO_TOOLTIP, IdHerramienta);
                        //Fin Tarea 881
                    }
                    else
                    {
                        buttonTool = new ButtonTool(id);
                        buttonTool.SharedProps.ToolTipText = GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta);


                        if (GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta) != string.Empty)
                        {
                            //German 20110329 - Tarea 0000093
                            ImageList ilSmall = toolbar.ImageListSmall;
                            string    prueba  =
                                string.Format(
                                    mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" +
                                    GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "16");
                            Image image1 = null;
                            try
                            {
                                System.Drawing.Icon c = new Icon(prueba);
                                image1 = c.ToBitmap();
                            }
                            catch (Exception e)
                            {
                                image1 = Image.FromFile(prueba);
                                //int smallIndexImage = ilSmall.Images.Add( Image.FromFile(  prueba), System.Drawing.Color.Magenta );
                            }
                            int smallIndexImage = ilSmall.Images.Add(image1, System.Drawing.Color.Magenta);

                            ImageList ilLarge = toolbar.ImageListLarge;
                            prueba =
                                string.Format(
                                    mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" +
                                    GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "24");
                            //int largeIndexImage = ilLarge.Images.Add(Image.FromFile(prueba), System.Drawing.Color.Magenta);
                            try
                            {
                                System.Drawing.Icon c = new Icon(prueba);
                                image1 = c.ToBitmap();
                            }
                            catch (Exception e)
                            {
                                image1 = Image.FromFile(prueba);
                                //int smallIndexImage = ilSmall.Images.Add( Image.FromFile(  prueba), System.Drawing.Color.Magenta );
                            }
                            int largeIndexImage = ilLarge.Images.Add(image1, System.Drawing.Color.Magenta);
                            //Fin German 20110329 - Tarea 0000093


                            buttonTool.SharedProps.AppearancesSmall.Appearance.Image = smallIndexImage;
                            buttonTool.SharedProps.AppearancesLarge.Appearance.Image = largeIndexImage;
                        }

                        toolbar.Tools.Add(buttonTool);
                    }

                    buttonTool.SharedProps.DisplayStyle = ToolDisplayStyle.ImageOnlyOnToolbars;

                    UltraToolbar standarBar = toolbar.Toolbars["Estándar"];


                    standarBar.Tools.AddTool(id);
                    if (!((long)drv["IdHerramientaPadre"]).Equals(IdHerPadre))


                    {
                        IdHerPadre = (long)drv["IdHerramientaPadre"];
                        standarBar.Tools[id].InstanceProps.IsFirstInGroup = true;
                    }
                }
            }
        }
 protected internal MacroEditorFormCommandbar(UltraToolbar toolbar) : base(toolbar)
 {
 }