コード例 #1
0
ファイル: GestioneFax.cs プロジェクト: gipasoft/Sfera
        private void GestioneFax_Load(object sender, EventArgs e)
        {
            _cboFrameNo = (Infragistics.Win.UltraWinToolbars.ComboBoxTool)ultraToolbarsManagerStandard.Tools["PageNumbers"];
            _cboFrameNo.ValueList.ValueListItems.Clear();
            _cboFrameNo.ToolValueChanged += new Infragistics.Win.UltraWinToolbars.ToolEventHandler(_cboFrameNo_ToolValueChanged);

            if (_strFilePath == null)
            {
                ultraToolbarsManagerStandard.Tools["Delete"].SharedProps.Enabled = false;
                ultraToolbarsManagerStandard.Tools["PdfConvert"].SharedProps.Enabled = false;
                ultraToolbarsManagerStandard.Tools["Previous"].SharedProps.Enabled = false;
                ultraToolbarsManagerStandard.Tools["Next"].SharedProps.Enabled = false;
                ultraToolbarsManagerStandard.Tools["ZoomIn"].SharedProps.Enabled = false;
                ultraToolbarsManagerStandard.Tools["ZoomOut"].SharedProps.Enabled = false;
                ultraToolbarsManagerStandard.Tools["RotateLeft"].SharedProps.Enabled = false;
                ultraToolbarsManagerStandard.Tools["RotateRight"].SharedProps.Enabled = false;
            }
            else
            {
                ultraToolbarsManagerStandard.Tools["Delete"].SharedProps.Enabled = true;
                ultraToolbarsManagerStandard.Tools["PdfConvert"].SharedProps.Enabled = true;
                ultraToolbarsManagerStandard.Tools["Previous"].SharedProps.Enabled = true;
                ultraToolbarsManagerStandard.Tools["Next"].SharedProps.Enabled = true;
                ultraToolbarsManagerStandard.Tools["ZoomIn"].SharedProps.Enabled = true;
                ultraToolbarsManagerStandard.Tools["ZoomOut"].SharedProps.Enabled = true;
                ultraToolbarsManagerStandard.Tools["RotateLeft"].SharedProps.Enabled = true;
                ultraToolbarsManagerStandard.Tools["RotateRight"].SharedProps.Enabled = true;
            }

            ToolbarHelper toolBar = new ToolbarHelper(base.ultraToolbarsManagerStandard, "MainMenu");

            // PopUp Tabelle
            if (!IsLayoutLoaded)
            {
                base.ultraToolbarsManagerStandard.Toolbars["FaxToolBar"].Tools.Remove(base.ultraToolbarsManagerStandard.Toolbars["FaxToolBar"].Tools["ApriFax"]);
                toolBar.AddTool("&Gestione", ToolbarHelper.ToolbarType.PopUpMenu, 1);
                toolBar.AddTool("Delete", "&Cancella", ToolbarHelper.ToolbarType.Button, 1, "&Gestione", false);
                toolBar.AddTool("Previous", "&Precedente", ToolbarHelper.ToolbarType.Button, 2, "&Gestione", true);
                toolBar.AddTool("Next", "&Successivo", ToolbarHelper.ToolbarType.Button, 3, "&Gestione", false);
                toolBar.AddTool("ZoomIn", "&Ingrandisci", ToolbarHelper.ToolbarType.Button, 4, "&Gestione", true);
                toolBar.AddTool("ZoomOut", "&Rimpicciolisci", ToolbarHelper.ToolbarType.Button, 5, "&Gestione", false);
                toolBar.AddTool("RotateLeft", "Ruota &orario", ToolbarHelper.ToolbarType.Button, 6, "&Gestione", true);
                toolBar.AddTool("RotateRight", "Ruota &antiorario", ToolbarHelper.ToolbarType.Button, 7, "&Gestione", false);
                toolBar.AddTool("ApriFax", "Apri fax", ToolbarHelper.ToolbarType.Button, 0, "File", true);
                toolBar.AddTool("PdfConvert", "Esporta PDF", ToolbarHelper.ToolbarType.Button, 0, "File", false);

                ToolbarHelper toolBarFile = new ToolbarHelper(base.ultraToolbarsManagerStandard, "Generale");
                toolBarFile.AddTool("ApriFax", "Apri fax", ToolbarHelper.ToolbarType.Button, 1);
            }

            //==================================================================================
            // Plugins
            //==================================================================================
            try
            {
                _pluginManager = Gipasoft.Windows.Forms.PluginManager.PluginManager.Instance;
            }
            catch (System.Reflection.ReflectionTypeLoadException ex)
            {
                for (int i = 0; i < ex.LoaderExceptions.Length; i++)
                    MessageBox.Show(ex.LoaderExceptions[i].Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace);
                MessageBox.Show("InnerException:" + Environment.NewLine + ex.InnerException.Message + Environment.NewLine + ex.InnerException.StackTrace);
            }
            if (_pluginManager.Count > 0)
            {
                int index = 0;
                if (!IsLayoutLoaded)
                    _ultraMenuAttivita = toolBar.AddTool("&Attività", ToolbarHelper.ToolbarType.PopUpMenu, 2);
                else
                    _ultraMenuAttivita = ultraToolbarsManagerStandard.Tools["&Attività"];

                if (!IsLayoutLoaded)
                {
                    _ultraToolbarAttivita = new Infragistics.Win.UltraWinToolbars.UltraToolbar("Attivita");
                    _ultraToolbarAttivita.DockedColumn = 1;
                    _ultraToolbarAttivita.DockedRow = 1;
                    _ultraToolbarAttivita.FloatingSize = new System.Drawing.Size(289, 22);
                    _ultraToolbarAttivita.Text = "Attivita";
                    ultraToolbarsManagerStandard.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] { _ultraToolbarAttivita });
                }
                else
                    _ultraToolbarAttivita = ultraToolbarsManagerStandard.Toolbars["Attivita"];

                if (_strFilePath == null)
                {
                    _ultraToolbarAttivita.Visible = false;
                    _ultraMenuAttivita.SharedProps.Visible = false;
                }

                foreach (Gipasoft.Windows.Forms.PluginManager.PluginAttribute plugin in _pluginManager.GetPluginListForInterface(INTERFACE_NAME))
                {
                    index++;
                    Gipasoft.Windows.Forms.ProgramInterfaces.IFaxGest pluginInstance = _pluginManager.CreateInstance<Gipasoft.Windows.Forms.ProgramInterfaces.IFaxGest>(plugin);
                    
                    Infragistics.Win.UltraWinToolbars.ButtonTool pluginButton;
                    if (!IsLayoutLoaded)
                    {
                        pluginButton = new Infragistics.Win.UltraWinToolbars.ButtonTool(pluginInstance.Caption);
                        pluginButton.SharedProps.AppearancesSmall.Appearance.Image = pluginInstance.SmallIcon;
                        pluginButton.SharedProps.AppearancesLarge.Appearance.Image = pluginInstance.LargeIcon;
                        pluginButton.SharedProps.Caption = pluginInstance.Caption;
                        toolBar.AddTool(pluginButton, index, "&Attività", false);
                        _ultraToolbarAttivita.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { pluginButton });
                    }
                    else
                        pluginButton = (Infragistics.Win.UltraWinToolbars.ButtonTool)ultraToolbarsManagerStandard.Tools[pluginInstance.Caption];

                    _pluginList.Add(pluginInstance.Caption, pluginInstance);
                }
            }
        }
コード例 #2
0
        void loadPlugins()
        {
            if (_condominio.ID != 0)
            {
                // ===========================================================================================
                // Tab plugins
                // ===========================================================================================
                _pluginManager = Windows.Forms.PluginManager.PluginManager.Instance;
                if (_pluginManager != null)
                {
                    _listPlugin = new SortedList<int, ITabCondomini<CondominioDTO>>();
                    var attributePluginList = new Dictionary<ITabCondomini<CondominioDTO>, Windows.Forms.PluginManager.PluginAttribute>();
                    foreach (var plugin in _pluginManager.GetPluginListForInterface(INTERFACE_NAME))
                    {
                        var pluginInstance = _pluginManager.CreateInstance<ITabCondomini<CondominioDTO>>(plugin);
                        if (pluginInstance.Target == PluginTarget.Tutti || (_condominio.IsSupercondominio && pluginInstance.Target == PluginTarget.Supercondominio) || (!_condominio.IsSupercondominio && pluginInstance.Target == PluginTarget.Condominio))
                        {
                            var instance = pluginInstance as IUpdateCondominio;
                            if(instance != null)
                                instance.UpdateCondominio += dettaglioCondominioUIUpdateCondominio;
                            _listPlugin.Add(pluginInstance.Order, pluginInstance);
                            attributePluginList.Add(pluginInstance, plugin);
                        }
                    }

                    for (var i = 0; i < _listPlugin.Count; i++)
                    {
                        var pluginInstance = _listPlugin.Values[i];
                        var plugin = attributePluginList[pluginInstance];
                        var pluginTab = new Infragistics.Win.UltraWinTabControl.UltraTabPageControl();
                        var ultraTabPlugin = new Infragistics.Win.UltraWinTabControl.UltraTab {Key = plugin.Name, TabPage = pluginTab, Text = pluginInstance.Caption};

                        //ultraTabPlugin.Appearance.Image = pluginInstance.Icon;
                        mainTabContainer.Tabs.Add(ultraTabPlugin);

                        pluginTab.Location = new Point(-10000, -10000);
                        pluginTab.Name = "TabPage_" + plugin.Name;
                        pluginTab.Size = new Size(923, 415);
                        mainTabContainer.Controls.Add(pluginTab);

                        ultraTabPlugin.Tag = pluginInstance;
                        ultraTabPlugin.Reposition(mainTabContainer.Tabs["note"], Infragistics.Win.RelativePosition.Before);

                        if (_condominio != null && _condominio.ID > 0)
                            pluginInstance.LoadAsync(_condominio, this);
                    }
                }

                // ===========================================================================================
                // Contratto plugins
                // ===========================================================================================
                if (_pluginManager != null)
                {
                    _toolBar = new ToolbarHelper(ultraToolbarsManagerStandard, "home", "Contratti");
                    var pluginTools = new List<ToolBase>();
                    foreach (var plugin in _pluginManager.GetPluginListForInterface(INTERFACE_NAME_CONTRATTI))
                    {
                        if (plugin.TabPlugin)
                        {
                            var pluginInstance = _pluginManager.CreateInstance<IContrattoUI<CondominioDTO>>(plugin);

                            if (_condominio != null && (pluginInstance.Target == PluginTarget.Tutti || (_condominio.IsSupercondominio || pluginInstance.Target == PluginTarget.Supercondominio) || (!_condominio.IsSupercondominio && pluginInstance.Target == PluginTarget.Condominio)))
                            {
                                var pluginButton = ultraToolbarsManagerStandard.Tools.Exists(pluginInstance.CaptionNew) ? ultraToolbarsManagerStandard.Tools[pluginInstance.CaptionNew] : _toolBar.AddTool(pluginInstance.CaptionNew, pluginInstance.CaptionNew, ToolbarHelper.ToolbarType.RibbonTab, pluginInstance.OrderNew, "&Contratti", false, pluginInstance.SmallIconNew, pluginInstance.LargeIconNew);

                                pluginTools.Add(pluginButton);
                                _pluginContrattiList.Add(pluginInstance.CaptionNew, pluginInstance);
                            }
                        }
                    }

                    if (pluginTools.Count > 0)
                    {
                        ultraToolbarsManagerStandard.ToolClick += pluginContrattiButtonToolClick;
                        _toolBar.AddToolBar("Contratti", pluginTools, 2);
                    }

                }
            }
        }