Imports EgtWPFLib5.EgtFloating Public Class ProjectView Private Sub UserControl_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded ' Leggo posizioni Floating window Dim sState As String = String.Empty Dim nIndex As Integer = -1 Dim nLeft As Integer = -1 Dim nTop As Integer = -1 ShowPanel.IsFloating = False ViewPanel.IsFloating = False InstrumentPanel.IsFloating = False GridPanel.IsFloating = False DoorsPanel.IsFloating = False DrawPanel.IsFloating = False OptionPanel.IsFloating = False If GetPrivateProfileFloatingWinPos(S_GENERAL, "ShowPanel", sState, nIndex, nLeft, nTop) And Not String.IsNullOrEmpty(sState) Then PanelPositioning(ShowPanel, sState, nIndex, nLeft, nTop) End If If GetPrivateProfileFloatingWinPos(S_GENERAL, "ViewPanel", sState, nIndex, nLeft, nTop) And Not String.IsNullOrEmpty(sState) Then PanelPositioning(ViewPanel, sState, nIndex, nLeft, nTop) End If If GetPrivateProfileFloatingWinPos(S_GENERAL, "InstrumentPanel", sState, nIndex, nLeft, nTop) And Not String.IsNullOrEmpty(sState) Then PanelPositioning(InstrumentPanel, sState, nIndex, nLeft, nTop) End If If GetPrivateProfileFloatingWinPos(S_GENERAL, "GridPanel", sState, nIndex, nLeft, nTop) And Not String.IsNullOrEmpty(sState) Then PanelPositioning(GridPanel, sState, nIndex, nLeft, nTop) End If If GetPrivateProfileFloatingWinPos(S_GENERAL, "DoorsPanel", sState, nIndex, nLeft, nTop) And Not String.IsNullOrEmpty(sState) Then PanelPositioning(DoorsPanel, sState, nIndex, nLeft, nTop) End If If GetPrivateProfileFloatingWinPos(S_GENERAL, "DrawPanel", sState, nIndex, nLeft, nTop) And Not String.IsNullOrEmpty(sState) Then PanelPositioning(DrawPanel, sState, nIndex, nLeft, nTop) End If If GetPrivateProfileFloatingWinPos(S_GENERAL, "OptionPanel", sState, nIndex, nLeft, nTop) And Not String.IsNullOrEmpty(sState) Then PanelPositioning(OptionPanel, sState, nIndex, nLeft, nTop) End If Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub() ShowPanel.Visibility = Visibility.Visible ViewPanel.Visibility = Visibility.Visible InstrumentPanel.Visibility = Visibility.Visible GridPanel.Visibility = Visibility.Visible DoorsPanel.Visibility = Visibility.Visible DrawPanel.Visibility = Visibility.Visible OptionPanel.Visibility = Visibility.Visible End Sub) Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub() ShowPanel.Visibility = Visibility.Visible ViewPanel.Visibility = Visibility.Visible InstrumentPanel.Visibility = Visibility.Visible GridPanel.Visibility = Visibility.Visible DoorsPanel.Visibility = Visibility.Visible DrawPanel.Visibility = Visibility.Collapsed OptionPanel.Visibility = Visibility.Visible End Sub) End Sub Private Sub PanelPositioning(FloatingPanel As EgtFloatingPanel, sState As String, nIndex As Integer, nLeft As Integer, nTop As Integer) Select Case sState Case "TOP" FloatingPanel.ChangePosition(TOPTRAY) Case "BOTTOM" FloatingPanel.ChangePosition(BOTTOMTRAY) Case "LEFT" FloatingPanel.ChangePosition(LEFTTRAY) Case "RIGHT" FloatingPanel.ChangePosition(RIGHTTRAY) Case "FLOATING" FloatingPanel.ChangePosition(New Point(nLeft, nTop)) End Select End Sub Private Sub UserControl_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded ' Salvo le posizioni di tutti gli EgtPanel End Sub End Class