Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix location show form owner inside Search for packages #12540

Merged
merged 14 commits into from
Feb 24, 2022
25 changes: 25 additions & 0 deletions src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,31 @@ public static MessageBoxResult Show(string messageBoxText, string caption, Messa
dynamoMessageBox.ShowDialog();
return dynamoMessageBox.CustomDialogResult;
}
/// <summary>
/// Displays a dialog to the user and returns their choice as a MessageBoxResult.
/// </summary>
/// <param name="owner">owner window</param>
/// <param name="messageBoxText"></param>
/// <param name="caption"></param>
/// <param name="button"></param>
/// <param name="icon"></param>
/// <returns></returns>
public static MessageBoxResult Show(Window owner,string messageBoxText, string caption, MessageBoxButton button,
MessageBoxImage icon)
{
var dynamoMessageBox = new DynamoMessageBox
{
BodyText = messageBoxText,
TitleText = caption,
MessageBoxButton = button,
MessageBoxImage = icon,
Owner = owner
};

dynamoMessageBox.ConfigureButtons(button);
dynamoMessageBox.ShowDialog();
return dynamoMessageBox.CustomDialogResult;
}

/// <summary>
/// Displays a dialog to the user and returns their choice as a MessageBoxResult.
Expand Down
11 changes: 11 additions & 0 deletions src/DynamoCoreWpf/Utilities/MessageBoxUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ internal class MessageBoxService {
internal interface IMessageBox
{
MessageBoxResult Show(string msg, string title, MessageBoxButton button, MessageBoxImage img);
MessageBoxResult Show(Window owner,string msg, string title, MessageBoxButton button, MessageBoxImage img);
MessageBoxResult Show(string msg, string title, MessageBoxButton button, IEnumerable<string> buttonNames, MessageBoxImage img);
}

Expand All @@ -21,6 +22,12 @@ MessageBoxResult IMessageBox.Show(string msg, string title, MessageBoxButton but
{
return DynamoMessageBox.Show(msg, title, button, img);
}

public MessageBoxResult Show(Window owner, string msg, string title, MessageBoxButton button, MessageBoxImage img)
{
return DynamoMessageBox.Show(owner,msg, title, button, img);
}

MessageBoxResult IMessageBox.Show(string msg, string title, MessageBoxButton button, IEnumerable<string> buttonNames, MessageBoxImage img)
{
return DynamoMessageBox.Show(msg, title, button,buttonNames, img);
Expand All @@ -36,6 +43,10 @@ internal static MessageBoxResult Show(string msg, string title, MessageBoxButton
{
return (msg_box ?? (msg_box = new DefaultMessageBox())).Show(msg, title, button, img);
}
internal static MessageBoxResult Show(Window owner,string msg, string title, MessageBoxButton button, MessageBoxImage img)
{
return (msg_box ?? (msg_box = new DefaultMessageBox())).Show(owner,msg, title, button, img);
}
internal static MessageBoxResult Show(string msg, string title, MessageBoxButton button, IEnumerable<string> buttonNames, MessageBoxImage img)
{
return (msg_box ?? (msg_box = new DefaultMessageBox())).Show(msg, title, button, buttonNames, img);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ public class PackageManagerClientViewModel : NotificationObject, IPackageInstall

#region Properties/Fields

public PackageManagerSearchView Owner { get; set; }

ObservableCollection<PackageUploadHandle> _uploads = new ObservableCollection<PackageUploadHandle>();
public ObservableCollection<PackageUploadHandle> Uploads
{
Expand Down Expand Up @@ -675,7 +677,7 @@ internal async void ExecutePackageDownload(string name, PackageVersion package,
String.Format(Resources.MessageConfirmToInstallPackage, name, package.version) :
String.Format(Resources.MessageConfirmToInstallPackageToFolder, name, package.version, installPath);

var result = MessageBoxService.Show(msg,
var result = MessageBoxService.Show(Owner, msg,
Resources.PackageDownloadConfirmMessageBoxTitle,
MessageBoxButton.OKCancel, MessageBoxImage.Question);

Expand Down Expand Up @@ -792,7 +794,7 @@ internal async void ExecutePackageDownload(string name, PackageVersion package,
// if any do, notify user and allow cancellation
if (containsBinariesOrPythonScripts)
{
var res = MessageBoxService.Show(Resources.MessagePackageContainPythonScript,
var res = MessageBoxService.Show(Owner, Resources.MessagePackageContainPythonScript,
Resources.PackageDownloadMessageBoxTitle,
MessageBoxButton.OKCancel, MessageBoxImage.Exclamation);

Expand Down
Loading