Exemplo n.º 1
0
        public void Dispose()
        {
            lock (syncRoot)
            {
                if (!disposed)
                {
                    disposed = true;
                    viewsBySheet?.Values.Where(l => l != null)
                    .SelectMany(v => v)
                    .Where(v => v != null)
                    .ToList()
                    .ForEach(v => {
                        v.ViewSheet.Change            -= OnSheetChange;
                        v.ViewSheet.SelectionChange   -= OnSelectionChange;
                        v.ViewSheet.BeforeDoubleClick -= OnBeforeBoubleClick;
                        //v.Dispose();
                    });

                    contextualMenuManager.OnContextualMenusRequested -= ManageViewsContextualMenu;

                    //@@if (templateContextualMenuManager != null)
                    //{
                    //    templateContextualMenuManager.Dispose();
                    //    templateContextualMenuManager = null;
                    //}

                    if (ExcelNotifyPropertyManager != null)
                    {
                        ExcelNotifyPropertyManager.Dispose();
                        ExcelNotifyPropertyManager = null;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public ExcelTemplateManager([Import] ExcelApplication excelApplication,
                                    [Import] ContextualMenuManager contextualMenuManager,
                                    [Import] ExcelDecoratorsManager excelDecoratorsManager,
                                    [Import] EventExcelCallbacksManager eventCallbacksManager,
                                    [Import] BindingTemplateManager bindingTemplateManager)
        {
            if (excelApplication == null)
            {
                throw new EtkException("'ExcelBindingTemplateManager' initialization: the 'application' parameter is mandatory");
            }

            ExcelApplication            = excelApplication;
            CallbacksManager            = eventCallbacksManager;
            this.excelDecoratorsManager = excelDecoratorsManager;
            this.contextualMenuManager  = contextualMenuManager;
            this.bindingTemplateManager = bindingTemplateManager;

            // Create the notify property manager .
            ExcelNotifyPropertyManager = new ExcelNotifyPropertyManager(ExcelApplication);
            // Create the template contextual menus manager.
            //@@templateContextualMenuManager = new TemplateContextualMenuManager(contextualMenuManager);
            // Declare the contextual menus activators for the template views.
            contextualMenuManager.OnContextualMenusRequested += ManageViewsContextualMenu;

            sortSearchAndFilterMenuManager = new SortSearchAndFilterMenuManager();

            eventCallbacksManager.RegisterSpecificCallBack();
        }