Ejemplo n.º 1
0
        protected void loadPlugins()
        {
            if (_unitaImmobiliare.ID != 0)
            {
                // ===========================================================================================
                // Tab plugins
                // ===========================================================================================
                _pluginManager = Windows.Forms.PluginManager.PluginManager.Instance;
                if (_pluginManager != null)
                {
                    _listPlugin = new SortedList<int, Windows.Forms.ProgramInterfaces.ITabUnitaImmobiliari<UnitaImmobiliareDTO>>();
                    var attributePluginList = new Dictionary<Windows.Forms.ProgramInterfaces.ITabUnitaImmobiliari<UnitaImmobiliareDTO>, Windows.Forms.PluginManager.PluginAttribute>();
                    foreach (var plugin in _pluginManager.GetPluginListForInterface(INTERFACE_NAME))
                    {
                        var pluginInstance = _pluginManager.CreateInstance<Windows.Forms.ProgramInterfaces.ITabUnitaImmobiliari<UnitaImmobiliareDTO>>(plugin);
                        _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,
                            //Appearance = {Image = pluginInstance.Icon}
                        };

                        mainTabControl.Tabs.Add(ultraTabPlugin);

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

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

                        pluginInstance.LoadAsync(_unitaImmobiliare, this);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected void loadPlugins()
        {
            if (Fornitore.ID != 0)
            {
                try
                {
                    // ===========================================================================================
                    // Tab plugins
                    // ===========================================================================================
                    _pluginManager = Windows.Forms.PluginManager.PluginManager.Instance;
                    if (_pluginManager != null)
                    {
                        _listPlugin = new SortedList<int, ITabFornitori<FornitoreDTO>>();
                        var attributePluginList = new Dictionary<ITabFornitori<FornitoreDTO>, Windows.Forms.PluginManager.PluginAttribute>();
                        foreach (var plugin in _pluginManager.GetPluginListForInterface(INTERFACE_NAME))
                        {
                            var pluginInstance = _pluginManager.CreateInstance<ITabFornitori<FornitoreDTO>>(plugin);
                            _listPlugin.Add(pluginInstance.Order, pluginInstance);
                            attributePluginList.Add(pluginInstance, plugin);
                        }

                        for (var i = 0; i < _listPlugin.Count; i++)
                        {
                            try
                            {
                                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,
                                    //Appearance = { Image = pluginInstance.Icon }
                                };

                                if(!mainTabControl.Tabs.Exists(ultraTabPlugin.Key))
                                {
                                    mainTabControl.Tabs.Add(ultraTabPlugin);

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

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

                                pluginInstance.LoadAsync(Fornitore, this);

                            }
                            catch (Exception ex)
                            {
                                _log.ErrorFormat("Errore inaspettato durante il caricamento dei plugins - SINGOLO PLUGIN - {0} - plugin:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), attributePluginList[_listPlugin.Values[i]].Name, Security.Login.Instance.CurrentLogin().Azienda); 
                            }
                        }
                    }

                }
                catch (Exception ex)
                {
                    _log.ErrorFormat("Errore inaspettato durante il caricamento dei plugins - {0} - azienda:{1}", ex, Utility.GetMethodDescription(), Security.Login.Instance.CurrentLogin().Azienda); 
                    throw;
                }
            }
        }
        new void loadPlugins()
        {
            if (Fornitore.ID != 0)
            {
                // ===========================================================================================
                // Tab plugins
                // ===========================================================================================
                _pluginManager = Windows.Forms.PluginManager.PluginManager.Instance;
                if (_pluginManager != null)
                {
                    _listPlugin = new SortedList<int, Windows.Forms.ProgramInterfaces.ITabAssicuratori<AgenziaAssicurativaDTO>>();
                    var attributePluginList = new Dictionary<Windows.Forms.ProgramInterfaces.ITabAssicuratori<AgenziaAssicurativaDTO>, Windows.Forms.PluginManager.PluginAttribute>();
                    foreach (Windows.Forms.PluginManager.PluginAttribute plugin in _pluginManager.GetPluginListForInterface(INTERFACE_NAME))
                    {
                        var pluginInstance = _pluginManager.CreateInstance<Windows.Forms.ProgramInterfaces.ITabAssicuratori<AgenziaAssicurativaDTO>>(plugin);
                        _listPlugin.Add(pluginInstance.Order, pluginInstance);
                        attributePluginList.Add(pluginInstance, plugin);
                    }

                    for (int i = 0; i < _listPlugin.Count; i++)
                    {
                        Windows.Forms.ProgramInterfaces.ITabAssicuratori<AgenziaAssicurativaDTO> pluginInstance = _listPlugin.Values[i];
                        Windows.Forms.PluginManager.PluginAttribute 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,
                            //Appearance = {Image = pluginInstance.Icon}
                        };

                        mainTabControl.Tabs.Add(ultraTabPlugin);

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

                        UserControl control = pluginInstance.GetTabControl((AgenziaAssicurativaDTO)Fornitore, this);
                        control.Name = "UC_" + plugin.Name;
                        control.Dock = DockStyle.Fill;
                        control.TabIndex = 0;
                        pluginTab.Controls.Add(control);
                        ultraTabPlugin.Reposition(mainTabControl.Tabs["note"], Infragistics.Win.RelativePosition.Before);
                    }
                }
            }
        }
Ejemplo n.º 4
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);
                    }

                }
            }
        }
Ejemplo n.º 5
0
        private void loadPlugins()
        {
            try
            {
                _pluginManager = Windows.Forms.PluginManager.PluginManager.Instance;
                if (_pluginManager != null)
                {
                    _listPlugin = new SortedList<int, ITabPersone<PersonaDTO>>();
                    var attributePluginList = new Dictionary<ITabPersone<PersonaDTO>, Windows.Forms.PluginManager.PluginAttribute>();
                    foreach (var plugin in _pluginManager.GetPluginListForInterface(INTERFACE_NAME))
                    {
                        var pluginInstance = _pluginManager.CreateInstance<ITabPersone<PersonaDTO>>(plugin);
                        _listPlugin.Add(pluginInstance.Order, pluginInstance);
                        attributePluginList.Add(pluginInstance, plugin);
                    }

                    for (int 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
                        {
                            Tag = pluginInstance,
                            Key = plugin.Name,
                            TabPage = pluginTab,
                            Text = pluginInstance.Caption,
                            //Appearance = { Image = pluginInstance.Icon }
                        };

                        mainTabControl.Tabs.Add(ultraTabPlugin);

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

                        var control = pluginInstance.GetTabControl(_persona, this);
                        control.Name = "UC_" + plugin.Name;
                        control.Dock = DockStyle.Fill;
                        control.TabIndex = 0;
                        pluginTab.Controls.Add(control);
                        ultraTabPlugin.Reposition(mainTabControl.Tabs["note"], Infragistics.Win.RelativePosition.Before);

                        pluginInstance.LoadAsync(_persona, this);
                    }
                }

            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Errore nel caricamento dei plugins - {0} - persona:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), Security.Login.Instance.CurrentLogin().Azienda);
                throw;
            }
        }