init
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace DTS.Common.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ConfirmationWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ConfirmationWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// The content template to use when showing <see cref="DTS.Common.Interactivity.InteractionRequest.Confirmation"/> data.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ConfirmationTemplateProperty =
|
||||
DependencyProperty.Register(
|
||||
"ConfirmationTemplate",
|
||||
typeof(DataTemplate),
|
||||
typeof(ConfirmationWindow),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of ConfirmationChildWindow.
|
||||
/// </summary>
|
||||
public ConfirmationWindow()
|
||||
{
|
||||
// Hook the SourceInitialized event and then using the SetWindowLong function to strip off the WS_SYSMENU bit.
|
||||
SourceInitialized += ConfirmationWindow_SourceInitialized;
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The content template to use when showing <see cref="DTS.Common.Interactivity.InteractionRequest.Confirmation"/> data.
|
||||
/// </summary>
|
||||
public DataTemplate ConfirmationTemplate
|
||||
{
|
||||
get => (DataTemplate)GetValue(ConfirmationTemplateProperty);
|
||||
set => SetValue(ConfirmationTemplateProperty, value);
|
||||
}
|
||||
|
||||
private void ConfirmationWindow_SourceInitialized(object sender, EventArgs e)
|
||||
{
|
||||
// Removing the Close Button on a WPF window.
|
||||
// The key here is hooking the SourceInitialized event and then using the SetWindowLong function to strip off the WS_SYSMENU bit.
|
||||
var wih = new WindowInteropHelper(this);
|
||||
var style = GetWindowLong(wih.Handle, GWL_STYLE);
|
||||
SetWindowLong(wih.Handle, GWL_STYLE, style & ~WS_SYSMENU);
|
||||
}
|
||||
|
||||
private const int GWL_STYLE = -16;
|
||||
private const int WS_SYSMENU = 0x00080000;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int SetWindowLong(IntPtr hwnd, int index, int value);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int GetWindowLong(IntPtr hwnd, int index);
|
||||
|
||||
public void Connect(int connectionId, object target)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user