EgtWPFLib :

- Migliorie varie.
This commit is contained in:
Emmanuele Sassi
2016-11-18 17:47:34 +00:00
parent e0f0080df3
commit 5cba597600
3 changed files with 50 additions and 44 deletions
+42 -42
View File
@@ -31,65 +31,65 @@ Public Class EgtPopup
Public Sub New()
' Chiamata richiesta dal Wpf
InitializeComponent()
AddHandler Me.Loaded, AddressOf OnPopupLoaded
AddHandler Me.Unloaded, AddressOf OnPopupUnloaded
'AddHandler Me.Loaded, AddressOf OnPopupLoaded
'AddHandler Me.Unloaded, AddressOf OnPopupUnloaded
End Sub
Private Sub OnPopupLoaded(sender As Object, e As RoutedEventArgs)
If _alreadyLoaded Then
Return
End If
'Private Sub OnPopupLoaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
' If _alreadyLoaded Then
' Return
' End If
_alreadyLoaded = True
' _alreadyLoaded = True
If Child IsNot Nothing Then
Child.[AddHandler](PreviewMouseLeftButtonDownEvent, New MouseButtonEventHandler(AddressOf OnChildPreviewMouseLeftButtonDown), True)
End If
' If Child IsNot Nothing Then
' Child.[AddHandler](PreviewMouseLeftButtonDownEvent, New MouseButtonEventHandler(AddressOf OnChildPreviewMouseLeftButtonDown), True)
' End If
_parentWindow = Window.GetWindow(Me)
' _parentWindow = Window.GetWindow(Me)
If _parentWindow Is Nothing Then
Return
End If
' If _parentWindow Is Nothing Then
' Return
' End If
AddHandler _parentWindow.Activated, AddressOf OnParentWindowActivated
AddHandler _parentWindow.Deactivated, AddressOf OnParentWindowDeactivated
' AddHandler _parentWindow.Activated, AddressOf OnParentWindowActivated
' AddHandler _parentWindow.Deactivated, AddressOf OnParentWindowDeactivated
End Sub
'End Sub
Private Sub OnPopupUnloaded(sender As Object, e As RoutedEventArgs)
If _parentWindow Is Nothing Then
Return
End If
RemoveHandler _parentWindow.Activated, AddressOf OnParentWindowActivated
RemoveHandler _parentWindow.Deactivated, AddressOf OnParentWindowDeactivated
'Private Sub OnPopupUnloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
' If _parentWindow Is Nothing Then
' Return
' End If
' RemoveHandler _parentWindow.Activated, AddressOf OnParentWindowActivated
' RemoveHandler _parentWindow.Deactivated, AddressOf OnParentWindowDeactivated
End Sub
'End Sub
Private Sub OnParentWindowActivated(sender As Object, e As EventArgs)
Debug.WriteLine("Parent Window Activated")
SetTopmostState(True)
End Sub
'Private Sub OnParentWindowActivated(sender As Object, e As EventArgs)
' Debug.WriteLine("Parent Window Activated")
' SetTopmostState(True)
'End Sub
Private Sub OnParentWindowDeactivated(sender As Object, e As EventArgs)
Debug.WriteLine("Parent Window Deactivated")
'Private Sub OnParentWindowDeactivated(sender As Object, e As EventArgs)
' Debug.WriteLine("Parent Window Deactivated")
If IsTopmost = False Then
SetTopmostState(IsTopmost)
End If
End Sub
' If IsTopmost = False Then
' SetTopmostState(IsTopmost)
' End If
'End Sub
Private Sub OnChildPreviewMouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs)
Debug.WriteLine("Child Mouse Left Button Down")
'Private Sub OnChildPreviewMouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs)
' Debug.WriteLine("Child Mouse Left Button Down")
SetTopmostState(True)
' SetTopmostState(True)
If Not _parentWindow.IsActive AndAlso IsTopmost = False Then
_parentWindow.Activate()
Debug.WriteLine("Activating Parent from child Left Button Down")
End If
End Sub
' If Not _parentWindow.IsActive AndAlso IsTopmost = False Then
' _parentWindow.Activate()
' Debug.WriteLine("Activating Parent from child Left Button Down")
' End If
'End Sub
Private Shared Sub OnIsTopmostChanged(obj As DependencyObject, e As DependencyPropertyChangedEventArgs)
Dim thisobj = DirectCast(obj, EgtPopup)
+6
View File
@@ -220,4 +220,10 @@ Public Class EgtTextBox
RaiseEvent EgtClosed(sender, e)
End Sub
Private Sub m_KeyboardPopUp_KeyDown(sender As Object, e As Windows.Input.KeyEventArgs) Handles m_KeyboardPopUp.KeyDown
If e.Key = Key.F4 Then
e.Handled = True
End If
End Sub
End Class
+2 -2
View File
@@ -61,5 +61,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.6.22.1")>
<Assembly: AssemblyFileVersion("1.6.22.1")>
<Assembly: AssemblyVersion("1.6.23.4")>
<Assembly: AssemblyFileVersion("1.6.23.4")>