mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-15 22:16:37 +08:00
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using System.Windows;
|
|
using AIStudio.Wpf.DiagramDesigner.Controls;
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner.Services
|
|
{
|
|
public class WPFUIVisualizerService : IUIVisualizerService
|
|
{
|
|
|
|
#region Public Methods
|
|
/// <summary>
|
|
/// This method displays a modal dialog associated with the given key.
|
|
/// </summary>
|
|
/// <param name="dataContextForPopup">Object state to associate with the dialog</param>
|
|
/// <returns>True/False if UI is displayed.</returns>
|
|
public bool? ShowDialog(object dataContextForPopup)
|
|
{
|
|
Window win = new PopupWindow();
|
|
win.DataContext = dataContextForPopup;
|
|
win.Owner = Application.Current.MainWindow;
|
|
if (win != null)
|
|
return win.ShowDialog();
|
|
|
|
return false;
|
|
}
|
|
|
|
public bool? ShowDialog(object dataContextForPopup, double width, double height)
|
|
{
|
|
PopupWindow win = new PopupWindow();
|
|
win.SizeToContent = SizeToContent.Manual;
|
|
win.Width = width;
|
|
win.Height = height;
|
|
win.DataContext = dataContextForPopup;
|
|
win.Owner = Application.Current.MainWindow;
|
|
if (win != null)
|
|
return win.ShowDialog();
|
|
|
|
return false;
|
|
}
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|