Esempio n. 1
0
 protected override void OnInitialize(AsyncStatus status)
 {
     ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeFormView>(0L, "-->ExchangeFormView.OnInitialize: {0}", this);
     try
     {
         SynchronizationContext.SetSynchronizationContext(new SynchronizeInvokeSynchronizationContext(base.SnapIn));
         this.uiService        = new ViewUIService(this);
         this.selectionService = new Selection();
         this.services         = new ServiceContainer();
         this.settingsProvider = new ExchangeSettingsProvider();
         this.settingsProvider.Initialize(null, null);
         this.progressProvider = new ScopeNodeProgressProvider(base.ScopeNode);
         this.services.AddService(typeof(SynchronizationContext), SynchronizationContext.Current);
         this.services.AddService(typeof(IUIService), this.uiService);
         this.services.AddService(typeof(ISelectionService), this.selectionService);
         this.services.AddService(typeof(ISettingsProviderService), this.settingsProvider);
         this.services.AddService(typeof(IProgressProvider), this.progressProvider);
         this.services.AddService(typeof(INodeSelectionService), this);
         this.services.AddService(typeof(ISharedViewDataService), this);
         this.components = new ServicedContainer(this.services);
         this.components.Add(base.Control, base.Control.Name);
         IResultPaneControl resultPaneControl = base.Control as IResultPaneControl;
         ExchangeScopeNode  exchangeScopeNode = base.ScopeNode as ExchangeScopeNode;
         IExchangeSnapIn    exchangeSnapIn    = base.SnapIn as IExchangeSnapIn;
         if (resultPaneControl != null && exchangeSnapIn != null)
         {
             resultPaneControl.SharedSettings = exchangeSnapIn.Settings;
         }
         if (exchangeScopeNode != null)
         {
             exchangeScopeNode.Refreshing += this.exchangeScopeNode_Refreshing;
             status.EnableManualCompletion();
             exchangeScopeNode.InitializeView(base.Control, new StatusProgress(status, base.ScopeNode.SnapIn));
         }
         base.Control.Dock = DockStyle.Fill;
         bool showGroupsAsRegions = base.Control is WorkCenter;
         this.selectionCommandsAdapter  = new CommandsActionsAdapter(this.services, base.SelectionData.ActionsPaneItems, this.ResultPane.SelectionCommands, showGroupsAsRegions, exchangeSnapIn, this);
         this.resultPaneCommandsAdapter = new CommandsActionsAdapter(this.services, base.ActionsPaneItems, this.ResultPane.ResultPaneCommands, false, exchangeSnapIn, null);
         this.viewModeCommandsAdapter   = new CommandsActionsAdapter(this.services, base.ModeActionsPaneItems, this.ResultPane.ViewModeCommands, false, exchangeSnapIn, null);
         base.ActionsPaneItems.Add(new ActionSeparator());
         this.exportListCommandsAdapter          = new CommandsActionsAdapter(this.services, base.ActionsPaneItems, this.ResultPane.ExportListCommands, false, exchangeSnapIn, null, true);
         this.selectionService.SelectionChanged += this.selectionService_SelectionChanged;
         this.ResultPane.IsModifiedChanged      += this.ResultPane_IsModifiedChanged;
         this.ResultPane_IsModifiedChanged(this.ResultPane, EventArgs.Empty);
         this.ResultPane.HelpRequested += this.ResultPane_HelpRequested;
         base.OnInitialize(status);
     }
     catch (Exception ex)
     {
         if (ExceptionHelper.IsUICriticalException(ex))
         {
             throw;
         }
         base.Control.Enabled = false;
         this.uiService.ShowError(ex);
     }
     ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeFormView>(0L, "<--ExchangeFormView.OnInitialize: {0}", this);
 }
Esempio n. 2
0
 protected override void OnShutdown(SyncStatus status)
 {
     ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeFormView>(0L, "-->ExchangeFormView.OnShutdown: {0}", this);
     try
     {
         if (base.Control != null)
         {
             ExchangeScopeNode exchangeScopeNode = base.ScopeNode as ExchangeScopeNode;
             if (exchangeScopeNode != null)
             {
                 exchangeScopeNode.Refreshing -= this.exchangeScopeNode_Refreshing;
             }
             this.ResultPane.HelpRequested          -= this.ResultPane_HelpRequested;
             this.ResultPane.IsModifiedChanged      -= this.ResultPane_IsModifiedChanged;
             this.selectionService.SelectionChanged -= this.selectionService_SelectionChanged;
             if (this.exportListCommandsAdapter != null)
             {
                 this.exportListCommandsAdapter.Dispose();
             }
             this.exportListCommandsAdapter = null;
             if (this.viewModeCommandsAdapter != null)
             {
                 this.viewModeCommandsAdapter.Dispose();
             }
             this.viewModeCommandsAdapter = null;
             if (this.resultPaneCommandsAdapter != null)
             {
                 this.resultPaneCommandsAdapter.Dispose();
             }
             this.resultPaneCommandsAdapter = null;
             if (this.selectionCommandsAdapter != null)
             {
                 this.selectionCommandsAdapter.Dispose();
             }
             this.selectionCommandsAdapter = null;
             if (this.components != null)
             {
                 this.components.Dispose();
             }
             this.components       = null;
             this.uiService        = null;
             this.selectionService = null;
             if (this.services != null)
             {
                 this.services.Dispose();
             }
             this.services         = null;
             this.settingsProvider = null;
             this.progressProvider = null;
         }
         base.OnShutdown(status);
     }
     catch (Exception ex)
     {
         if (ExceptionHelper.IsUICriticalException(ex))
         {
             throw;
         }
         this.uiService.ShowError(ex);
     }
     ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeFormView>(0L, "<--ExchangeFormView.OnShutdown: {0}", this);
 }