Imports EgtWPFLib5.EgtFloating Public Class ProjectView Private m_bDoors As Boolean = False Private m_bGunStock As Boolean = False Private m_bSpecial As Boolean = False Private Sub UserControl_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized DoorsPanel.Visibility = Visibility.Collapsed SpecialPanel.Visibility = Visibility.Collapsed MachGroupPanel.Visibility = Visibility.Collapsed GunStockPanel.Visibility = Visibility.Collapsed End Sub 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 DbPanel.IsFloating = False ExecutePanel.IsFloating = False SpecialPanel.IsFloating = False DoorsPanel.IsFloating = False DrawPanel.IsFloating = False OptionPanel.IsFloating = False MachGroupPanel.IsFloating = False GunStockPanel.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, "GunStockPanel", 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 ' carico Special Panel m_bSpecial = IniFile.IsActiveSpecialPanel() m_bDoors = IniFile.IsActiveDoors() m_bGunStock = IniFile.IsActiveGunStock() Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub() 'ShowPanel.Visibility = Visibility.Visible ViewPanel.Visibility = Visibility.Visible 'InstrumentPanel.Visibility = Visibility.Visible GridPanel.Visibility = Visibility.Visible DbPanel.Visibility = If(IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW, Visibility.Collapsed, Visibility.Visible) ExecutePanel.Visibility = Visibility.Visible SpecialPanel.Visibility = If(m_bSpecial, Visibility.Visible, Visibility.Collapsed) DoorsPanel.Visibility = If(m_bDoors, Visibility.Visible, Visibility.Collapsed) GunStockPanel.Visibility = If(m_bGunStock, Visibility.Visible, Visibility.Collapsed) DrawPanel.Visibility = Visibility.Visible OptionPanel.Visibility = Visibility.Visible MachGroupPanel.Visibility = Visibility.Collapsed 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 DbPanel.Visibility = Visibility.Visible ExecutePanel.Visibility = Visibility.Collapsed SpecialPanel.Visibility = Visibility.Collapsed DoorsPanel.Visibility = Visibility.Collapsed GunStockPanel.Visibility = Visibility.Collapsed DrawPanel.Visibility = Visibility.Collapsed OptionPanel.Visibility = Visibility.Visible MachGroupPanel.Visibility = If(IniFile.m_bMachiningGroup, Visibility.Visible, Visibility.Collapsed) 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