How can my Outlook Plugin (VSTO) detect when Outlook is fully loaded? - outlook

Thanks for looking.
I am developing an Outlook plugin that needs to prompt the user to log in upon loading of Outlook. I am currently accomplishing this by hooking into the Startup event of ThisAddIn.
Problem
Unfortunately, the log in dialog is displaying before Outlook is fully loaded so it appears to the user as if Outlook is not loading and they are being forced to log in for the plugin.
Question
Is there an event that can be subscribed to from within my plugin code that will only fire after Outlook has fully loaded and is being displayed to the user?
Related links
Ready event in Microsoft Outlook 2010? (The answer regarding use of StartupComplete event via IDTExtensibility2 looks promising but I am not sure how to implement it. Any advice there is appreciated as well.)
I have tried. . .
I have tried the following but this causes the dialog to launch too soon:
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
//Fire 3rd party code to launch log-in dialog here
}

Check if Application.Explorers.Count > 0. If yes, proceed. Otherwise subscribe to the Explorers.NewExplorer event and run your code in that event handler when an Explorer is shown.

Related

How to raise event from one VSTO outlook addin project and subscribe in another VSTO outlook addin Project

Can someone please please provide the link or code snippet to raise an event from the click of the oulook ribbion button and we are able to subscribe it from the another project on the click of another button and get the data passed in it.
You can't directly - ribbon control events are only passed to the addin that created the ribbon controls in question. You can of course call any external code (including through Addin.Object) from the addin processing the event.
You can handle clicks on the built-in controls on the ribbon. Read more about that in the Temporarily Repurpose Commands on the Office Fluent Ribbon article.
But for the custom ribbon UI you need to ask for any public interface which can be consumed by others, so instead of trying to repurpose controls you could directly call the method or function in the add-in.

White/TestStack UI Automation - clicks app button opens a browser, how do I check the url?

I am currently using White/TestStack to test a windows app.
There are scenarios that requires user to click on links to open pages on browser. How do I check the hyperlink is working?
Old question but in case somebody else looking for an answer:
If you check in the White GitHub repository and you browse the UITests and the control tests, you will find the Hyperlink control test. In the sourcecode, you will find several tests according the type of framework used.
The simplest one:
var hyperlink = MainWindow.Get<Hyperlink>("LinkLabel");
hyperlink.Click(10, 10);
Assert.That(hyperlink.HelpText, Is.EqualTo("Hyperlink Clicked"));
The test is based on the used of code-behind for the MainWindow:
private void Hyperlink_OnClick(object sender, RoutedEventArgs e)
{
AutomationProperties.SetHelpText(LinkLabel, "Hyperlink Clicked");
}
XAML code of the hyperlink in the MainWindow
<TextBlock x:Name="LinkLabelContainer">
<Hyperlink x:Name="LinkLabel" Click="Hyperlink_OnClick">Link Text</Hyperlink>
</TextBlock>
So you can used the same method.
TL;DR
You can link the Click() event of your hyperlinks to a method in code behind which update the automation property HelpText of the hyperlink with a specific value for the clicked event.
So in your tests, you will just have to perform the click and then check the automation property value.

How to make a button on a application open a register page in Visual Studio

I'm making an application group chat in Visual Studio learn a bit more, all is good so far, so I've made my design and coded most of what I need, I have added a Button and called it Register now what I want is when people click it it will open another page or some type of menu where people can type there information in to register, I thought somthing like this or is this so wrong.
private void RegisterButton_Click(object sender, RoutedEventArgs e)
{
//what gose here
}
You can use Response.Redirect inside the button click to do this.
Refer to these articles:-
https://msdn.microsoft.com/en-us/library/a8wa7sdt(v=vs.110).aspx
https://support.microsoft.com/en-sg/kb/307903

Infragistics grid in win desk top application, design view is not available for viewing

I have a weird situation with Infragistics grid in desktop windows application. It is Visual Studio 2010.
I have several grids placed in one form control. It worked fine and I was able to see both Code Behind view and Designer view to make modifications. Then several other developers worked with the same control. It still runs fine, no problem. I still can see and modify code behind. But I can not access and view design view for some reason. It just gives me the error message :
Key already exists Parameter name: Key
Here is call stack:
at Infragistics.Shared.KeyedSubObjectsCollectionBase.ValidateKeyDoesNotExist(String key, IKeyedSubObject ignoreObject)
at Infragistics.Shared.KeyedSubObjectsCollectionBase.ValidateKey(String key, IKeyedSubObject ignoreObject)
at Infragistics.Shared.KeyedSubObjectsCollectionBase.InternalAdd(IKeyedSubObject obj)
at Infragistics.Win.UltraWinGrid.ColumnsCollection.InternalAdd(UltraGridColumn column)
at Infragistics.Win.UltraWinGrid.UltraGridBand.InitColumns(UltraGridBand[] oldBands)
at Infragistics.Win.UltraWinGrid.UltraGridBand.InitListManager(BindingManagerBase bindingManager, String dataMember, UltraGridBand[] oldBands)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated(BindingManagerBase bindingManager)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated()
at Infragistics.Win.UltraWinGrid.UltraGridBase.Set_ListManager(Object newDataSource, String newDataMember)
at Infragistics.Win.UltraWinGrid.UltraGridBase.VerifyDataSourceAttached()
at Infragistics.Win.UltraWinGrid.UltraGridBase.DesignTimeDataSourceInitialization()
at Infragistics.Win.UltraWinGrid.UltraGridBase.OnDesignerHostLoadComplete(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.ComponentModel.Design.DesignerHost.OnLoadComplete(EventArgs e)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.Serialization.IDesignerLoaderHost.EndLoad(String rootClassName, Boolean successful, ICollection errorCollection)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.OnEndLoad(Boolean successful, ICollection errors)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.OnEndLoad(Boolean successful, ICollection errors)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.System.ComponentModel.Design.Serialization.IDesignerLoaderService.DependentLoadComplete(Boolean successful, ICollection errorCollection)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
at System.ComponentModel.Design.DesignerHost.BeginLoad(DesignerLoader loader)
I really need to see and modify design view of the control.
I would highly appreciate if anybody can advise how to solve this.
Thanks!
Seems like I was able to pinpoint the issue. It was one of the data source objects that was added drag and drop way. I opened the file ..Designer.cs and manually commented all lines with it. The design view started working again.
Thanks to everyone who was considering to assist.

Windows Form -- behavior of buttons?

First time I've used the windows form so I'm not very familiar with the interface. But how do I set behaviors when I add buttons? For example, if I want to click "Button 1" and have it open up a new window to enter information in different fields, how is this done?
Thank you.
edit: Sorry, I forgot to include the language. It's in C#, and I'm using MS Visual Studios. I've never really programed in C#.
Another question that just popped up: could I do this Windows Form in other languages such as C++?
Yes the comment above is key but, if your are using the UI designer on a windows form then under the properties tab on the side of visueal studios, you can view 'events'. from here double click the event you want, probably 'onclick'. This will create a method stub with the event handler automatically set up.
Look something like:
public void Button1_OnClick(Object sender, EventArgs e){
// open the other window for input
Form whateverForm = new Form();
whateverForm.show();
}
Hope this helps. Sorry im not sure about any c++
[Edit]
tutorial not great but take a look:
http://www.ehow.com/how_7241167_tutorial-microsoft-visual-studio.html

Resources