private void ConnectPpl() { const int waitTime = 3000; int retryCount = 5; while (retryCount > 0) { // if already connected, break if (PplFeatures != null && PpOperations != null && WindowStackManager != null) { break; } // otherwise keep trying to connect for some times try { IPowerPointLabsFT ftInstance = (IPowerPointLabsFT)Activator.GetObject(typeof(IPowerPointLabsFT), "ipc://PowerPointLabsFT/PowerPointLabsFT"); PplFeatures = ftInstance.GetFeatures(); PpOperations = ftInstance.GetOperations(); WindowStackManager = ftInstance.GetWindowStackManager(); WindowStackManager.Setup(); break; } catch (RemotingException) { retryCount--; ThreadUtil.WaitFor(waitTime); } } if (PplFeatures == null || PpOperations == null) { Assert.Fail("Failed to connect to PowerPointLabs add-in. You can try to increase retryCount."); } PpOperations.EnterFunctionalTest(); // activate the thread of presentation window // Sometimes it takes very long for message box to pop up MessageBoxUtil.ExpectMessageBoxWillPopUp( "PowerPointLabs FT", "{*}", PpOperations.ActivatePresentation, null, 5, 10000); IntPtr window = Gethwnd(); PPLClipboard.Init(window, true); }
private void ConnectPpl() { const int waitTime = 3000; int retryCount = 5; while (retryCount > 0) { // if already connected, break if (PplFeatures != null && PpOperations != null) { break; } // otherwise keep trying to connect for some times try { IPowerPointLabsFT ftInstance = (IPowerPointLabsFT)Activator.GetObject(typeof(IPowerPointLabsFT), "ipc://PowerPointLabsFT/PowerPointLabsFT"); PplFeatures = ftInstance.GetFeatures(); PpOperations = ftInstance.GetOperations(); break; } catch (RemotingException) { retryCount--; ThreadUtil.WaitFor(waitTime); } } if (PplFeatures == null || PpOperations == null) { Assert.Fail("Failed to connect to PowerPointLabs add-in. You can try to increase retryCount."); } PpOperations.EnterFunctionalTest(); // activate the thread of presentation window ThreadUtil.WaitFor(1500); MessageBoxUtil.ExpectMessageBoxWillPopUp( "PowerPointLabs FT", "{*}", PpOperations.ActivatePresentation); }