public IDialogWindow CreateDialog <TView>() where TView : IDialogWindow, new() { return(ThreadHelper.Generic.Invoke(() => { var dialog = new TView(); var dialogWindow = dialog as Window; if (dialogWindow != null) { dialogWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; dialogWindow.ShowInTaskbar = false; dialogWindow.Owner = uiShell.GetMainWindow(); } return CreateDialogCallBack(dialog); })); }
/// <summary> /// Creates a <see cref="Window"/> dialog as child of the main Visual Studio window. /// </summary> /// <typeparam name="T">The type of the window to create.</typeparam> /// <param name="shell">The UI shell service.</param> /// <param name="dataContext">The data context.</param> /// <returns> /// The created <see cref="Window"/> dialog. /// </returns> public static T CreateDialog <T>(this IVsUIShell shell, object dataContext) where T : IDialogWindow, new() { var dialog = new T { DataContext = dataContext }; //// Note that we are not using Window as a constraint in order to not add all WPF references in all the assemblies that reference this assembly var dialogWindow = dialog as Window; if (dialogWindow != null) { dialogWindow.Owner = shell.GetMainWindow(); } return(dialog); }
public MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button) { return(MessageBox.Show(uiShell.GetMainWindow(), messageBoxText, caption, button)); }