コード例 #1
0
        public ExchangeSnapInHelper(NamespaceSnapInBase snapIn, IExchangeSnapIn exchangeSnapIn)
        {
            this.snapIn                   = snapIn;
            this.exchangeSnapIn           = exchangeSnapIn;
            Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;
            Application.EnableVisualStyles();
            this.snapInName = this.snapIn.GetType().Name;
            try
            {
                Thread.CurrentThread.Name = this.snapInName;
            }
            catch (InvalidOperationException)
            {
            }
            SynchronizationContext synchronizationContext = new SynchronizeInvokeSynchronizationContext(this.snapIn);

            SynchronizationContext.SetSynchronizationContext(synchronizationContext);
            ManagementGUICommon.RegisterAssembly(0, "Microsoft.Exchange.ManagementGUI, Version=15.00.0000.000, Culture=neutral, PublicKeyToken=31bf3856ad364e35", "ObjectPickerSchema.xml");
            ManagementGUICommon.RegisterAssembly(1, "Microsoft.Exchange.ManagementGUI, Version=15.00.0000.000, Culture=neutral, PublicKeyToken=31bf3856ad364e35", "ResultPaneSchema.xml");
            ManagementGUICommon.RegisterAssembly(2, "Microsoft.Exchange.ManagementGUI, Version=15.00.0000.000, Culture=neutral, PublicKeyToken=31bf3856ad364e35", "StrongTypeEditorSchema.xml");
            Assembly assembly = Assembly.Load("Microsoft.Exchange.ManagementGUI, Version=15.00.0000.000, Culture=neutral, PublicKeyToken=31bf3856ad364e35");

            ManagementGUICommon.RegisterResourcesAssembly(ExchangeResourceManager.GetResourceManager("Microsoft.Exchange.ManagementGUI.Resources.Strings", assembly), ExchangeResourceManager.GetResourceManager("Microsoft.Exchange.ManagementGUI.Resources.Icons", assembly));
            this.uiService        = new UIService(null);
            this.settingsProvider = new ExchangeSettingsProvider();
            this.services         = new ServiceContainer();
            this.services.AddService(typeof(IUIService), this.uiService);
            this.services.AddService(typeof(SynchronizationContext), synchronizationContext);
            this.services.AddService(typeof(ISettingsProviderService), this.settingsProvider);
            this.components = new ServicedContainer(this.services);
            this.LoadTestStub();
        }
コード例 #2
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);
 }
コード例 #3
0
 public CommandsActionsAdapter(IServiceProvider serviceProvider, ActionsPaneItemCollection actions, CommandCollection commands, bool showGroupsAsRegions, IExchangeSnapIn snapIn, ExchangeFormView view) : this(serviceProvider, actions, commands, showGroupsAsRegions, snapIn, view, false)
 {
 }
コード例 #4
0
        public CommandsActionsAdapter(IServiceProvider serviceProvider, ActionsPaneItemCollection actions, CommandCollection commands, bool showGroupsAsRegions, IExchangeSnapIn snapIn, ExchangeFormView view, bool createActionsAtBottom)
        {
            this.snapIn                = snapIn;
            this.serviceProvider       = serviceProvider;
            this.actions               = actions;
            this.commands              = commands;
            this.adapters              = new List <CommandActionAdapter>(commands.Count);
            this.showGroupsAsRegions   = showGroupsAsRegions;
            this.createActionsAtBottom = createActionsAtBottom;
            this.view = view;
            this.commands.CommandAdded   += new CommandEventHandler(this.commands_CommandAdded);
            this.commands.CommandRemoved += new CommandEventHandler(this.commands_CommandRemoved);
            ActionsPaneItemCollection actionsPaneItemCollection = new ActionsPaneItemCollection();

            for (int i = 0; i < this.commands.Count; i++)
            {
                CommandActionAdapter commandActionAdapter = this.CreateAdapter(this.commands[i]);
                this.adapters.Add(commandActionAdapter);
                if (commandActionAdapter.Command.Visible)
                {
                    actionsPaneItemCollection.Add(commandActionAdapter.ActionItem);
                }
            }
            this.actions.AddRange(actionsPaneItemCollection.ToArray());
        }
コード例 #5
0
 public CommandActionAdapter(IServiceProvider serviceProvider, Command command, bool treatCommandAsGroup, IExchangeSnapIn snapIn, ExchangeFormView view)
 {
     this.serviceProvider = serviceProvider;
     this.command         = command;
     if (this.command.Name == "-")
     {
         this.actionItem = new ActionSeparator();
     }
     else
     {
         if (this.command.HasCommands || this.command.Style == 4 || treatCommandAsGroup)
         {
             ActionGroup actionGroup = new ActionGroup();
             actionGroup.RenderAsRegion = true;
             this.actionItem            = actionGroup;
             this.groupItemsAdapter     = new CommandsActionsAdapter(this.serviceProvider, actionGroup.Items, this.Command.Commands, false, snapIn, view);
         }
         else
         {
             Action action = new Action();
             this.actionItem              = action;
             action.Triggered            += new Action.ActionEventHandler(this.action_Triggered);
             this.Command.EnabledChanged += this.command_EnabledChanged;
             this.command_EnabledChanged(this.Command, EventArgs.Empty);
             this.Command.CheckedChanged += this.command_CheckedChanged;
             this.command_CheckedChanged(this.Command, EventArgs.Empty);
         }
         this.Command.TextChanged += this.command_TextChanged;
         this.command_TextChanged(this.Command, EventArgs.Empty);
         this.Command.DescriptionChanged += this.command_DescriptionChanged;
         this.command_DescriptionChanged(this.Command, EventArgs.Empty);
         if (snapIn != null)
         {
             (this.ActionItem as ActionsPaneExtendedItem).ImageIndex = snapIn.RegisterIcon(this.Command.Name, this.Command.Icon);
         }
         (this.ActionItem as ActionsPaneExtendedItem).LanguageIndependentName = this.ActionItem.GetHashCode().ToString();
     }
     this.ActionItem.Tag = this;
 }