コード例 #1
0
        void NewExplorer(Explorer explorer)
        {
            var wrapper = new ExplorerWrapper(explorer);
            wrapper.Closed += ExplorerClosed;

            var newViewEventArgs = new NewViewEventArgs(explorer, explorer, OutlookRibbonType.OutlookExplorer.GetEnumDescription());
            NewView(this, newViewEventArgs);

            if (!newViewEventArgs.Handled)
                explorer.ReleaseComObject();
        }
コード例 #2
0
        void NewInspector(Inspector inspector)
        {
            var wrapper = new InspectorWrapper(inspector);
            wrapper.Closed += InspectorClosed;

            var ribbonType = InspectorToRibbonTypeConverter.Convert(inspector);
            var newViewEventArgs = new NewViewEventArgs(inspector, wrapper.CurrentContext, ribbonType.GetEnumDescription());
            NewView(this, newViewEventArgs);

            if (!newViewEventArgs.Handled)
                inspector.ReleaseComObject();
        }
コード例 #3
0
        public void new_window_with_different_context_does_not_create_new_viewmodel()
        {
            // arrange
            ribbonFactoryUnderTest.ClearCurrent();
            testAddInBase.TestAddin.OnStartup();
            //Open new view to create a viewmodel for view
            var viewInstance = new TestWindow { Context = new TestWindowContext() };
            var view2Instance = new TestWindow { Context = new TestWindowContext() };

            // act
            var newViewEventArgs = new NewViewEventArgs(viewInstance, viewInstance.Context,
                TestRibbonTypes.RibbonType1.GetEnumDescription());
            var viewEventArgs = new NewViewEventArgs(view2Instance, view2Instance.Context,
                TestRibbonTypes.RibbonType1.GetEnumDescription());
            viewProvider.NewView += Raise.EventWith(viewProvider, newViewEventArgs);
            viewProvider.NewView += Raise.EventWith(viewProvider, viewEventArgs);

            // assert
            Assert.Equal(2, viewModelFactory.ViewModels.Count);
        }