Gestione lista parcheggi come UserControl

This commit is contained in:
Nicola Pievani
2025-01-14 14:29:23 +01:00
parent 1df823cdec
commit ac67a14fea
6 changed files with 59 additions and 36 deletions
+11 -12
View File
@@ -12,7 +12,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="12*"/>
</Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="8*"/>
@@ -164,17 +164,16 @@
</Grid>
<!--LowerButtonGrid-->
<Grid Grid.Column="2" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="2" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
</Grid>
</Grid>
</Grid>
</Grid>
</UserControl>
+11 -5
View File
@@ -3106,16 +3106,20 @@ Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
If ParkIndBtn.IsChecked Then
If IsNothing(m_SelParkInd) Then
m_SelParkInd = New SelParkIndWD(m_MainWindow)
m_SelParkInd.Show()
Else
m_SelParkInd.Show()
End If
'm_SelParkInd.Show()
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectSceneHost.SetValue(Grid.ColumnSpanProperty, 1)
m_SelParkInd.SetValue(Grid.ColumnProperty, 1)
m_MainWindow.m_CurrentProjectPageUC.SceneHostGrid.Children.Add(m_SelParkInd)
Else
If Not IsNothing(m_SelParkInd) Then
m_SelParkInd.Close()
'm_SelParkInd.Close()
m_MainWindow.m_CurrentProjectPageUC.SceneHostGrid.Children.Remove(m_SelParkInd)
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectSceneHost.SetValue(Grid.ColumnSpanProperty, 2)
m_SelParkInd = Nothing
End If
End If
EgtZoom(ZM.ALL)
End Sub
Public Sub ReloadListParkInd()
@@ -3250,7 +3254,9 @@ Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
Private Sub NestPage_Unloaded(sender As Object, e As RoutedEventArgs)
' se esiste l'elenco dei parcheggi lo nascondo
If Not IsNothing(m_SelParkInd) Then
m_SelParkInd.Close()
' m_SelParkInd.Close()
m_MainWindow.m_CurrentProjectPageUC.SceneHostGrid.Children.Remove(m_SelParkInd)
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectSceneHost.SetValue(Grid.ColumnSpanProperty, 2)
m_SelParkInd = Nothing
End If
m_bActive = False
+3 -5
View File
@@ -1,10 +1,8 @@
<Window x:Class="SelParkIndWD"
<UserControl x:Class="SelParkIndWD"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib"
FontFamily="{DynamicResource OmagCut_Font}"
Title="Selection park" Height="382.6" Width="155.6" WindowStyle="None"
ResizeMode="NoResize" ShowInTaskbar="False" AllowsTransparency="True"
Background="Transparent">
<Border Style="{DynamicResource OmagCut_Border}">
@@ -32,7 +30,7 @@
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<UniformGrid Columns="2">
<UniformGrid Columns="2" Visibility="{Binding TitleVisibility}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding ImgTab}" Height="20" Stretch="Uniform"/>
<TextBlock Text="{Binding CountInTab}" Height="20" Width="30">
@@ -93,4 +91,4 @@
</Grid>
</Border>
</Window>
</UserControl>
+18 -8
View File
@@ -6,9 +6,10 @@ Imports OmagCUT.NestPageUC
Public Class SelParkIndWD
Private Shared m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
Private m_ParkIndList As New List(Of ParkInd)
Public Const nIndAllOff As Integer = 999
Sub New(Owner As Window)
Me.Owner = Owner
'Me.Owner = Owner
InitializeComponent()
End Sub
@@ -17,9 +18,9 @@ Public Class SelParkIndWD
Dim x As Integer = m_MainWindow.m_CurrentProjectPageUC.ActualWidth
Dim y As Integer = m_MainWindow.m_CurrentProjectPageUC.ActualHeight
Dim Button_y As Integer = 67
Me.Top = Owner.Top + Owner.Height - y + Button_y + 1
Me.Left = Owner.Left + x - 156
Me.Height = y - (Owner.Top + Owner.Height - y + Button_y)
'Me.Top = Owner.Top + Owner.Height - y + Button_y + 1
'Me.Left = Owner.Left + x - 156
'Me.Height = y - (Owner.Top + Owner.Height - y + Button_y)
' Definizione del collegamento tra ItemList e ListBox1
FilePathTxBl.Text = "Select park"
End Sub
@@ -69,7 +70,7 @@ Public Class SelParkIndWD
' Se l'elemento selezionato è attivo allora esco (perchè altrimenti lo spegnerei)
If localParkInd.IsStatusON Then Return
Dim bFound As Boolean = False
If localParkInd.Ind = 999 Then
If localParkInd.Ind = nIndAllOff Then
localParkInd.Status = GDB_ST.ON_
bFound = True
End If
@@ -194,7 +195,7 @@ Public Class SelParkIndWD
Public Shared Sub LoadParkInd(P_List As List(Of ParkInd))
If IsNothing(P_List) Then Return
P_List.Clear()
P_List.Add(New ParkInd(999, "All off", 0))
P_List.Add(New ParkInd(nIndAllOff, "All off", 0))
' recupero il contesto corrente
Dim CurrCtx As Integer = EgtGetCurrentContext()
' recupero il contesto del progetto
@@ -288,7 +289,7 @@ Public Class SelParkIndWD
#End Region ' Metodi Shared
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
Me.Close()
' Me.Close()
End Sub
End Class
@@ -397,6 +398,12 @@ Public Class ParkInd
End Get
End Property
Public ReadOnly Property TitleVisibility As Visibility
Get
Return If(m_Ind = 999, Visibility.Collapsed, Visibility.Visible)
End Get
End Property
Sub New(Ind As Integer, Name As String, Stat As Integer)
m_Ind = Ind
m_Name = Name
@@ -404,7 +411,10 @@ Public Class ParkInd
' Costruisco il percorso immagine
If m_Ind = 0 Then
' Se Ind=0 allora applico il default: C:\EgtData\OmagCUT\Resources\MachineButtonsImage\NewIcons
m_Img = DirectCast(Application.Current.MainWindow, MainWindow).GetResourcesDir() & "\MachineButtonsImage\NewIcons\Park.png"
m_Img = DirectCast(Application.Current.MainWindow, MainWindow).GetResourcesDir() & "\MachineButtonsImage\NewIcons\Park_On.png"
ElseIf m_Ind = 999 Then
' Se Ind=0 allora applico il default: C:\EgtData\OmagCUT\Resources\MachineButtonsImage\NewIcons
m_Img = DirectCast(Application.Current.MainWindow, MainWindow).GetResourcesDir() & "\MachineButtonsImage\NewIcons\Park_Off.png"
Else
m_Img = SelParkIndWD.GetPathCurrProj() & m_Ind.ToString & ".png"
End If
+9 -2
View File
@@ -26,7 +26,6 @@
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="7*"/>
</Grid.ColumnDefinitions>
</Grid>
<!-- Definizione della Grid laterale -->
@@ -72,7 +71,8 @@
</Border>
<ProgressBar Name="PhotoProgress" Grid.Row="2" Height="50" Margin="10,0,10,0" Minimum="0" Maximum="100"/>
<ProgressBar Name="PhotoProgress" Grid.Row="2" Height="50" Margin="10,0,10,0" Minimum="0" Maximum="100"/>
<Border Name="OutMessageBrd" Grid.Row="2" >
<TextBlock Name="OutMessageTxBl" TextAlignment="Center"
@@ -81,6 +81,13 @@
</Grid>
<Grid Name="SceneHostGrid" Grid.Row="1" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="1.2*"/>
</Grid.ColumnDefinitions>
</Grid>
</Grid>
</UserControl>
+7 -4
View File
@@ -20,7 +20,8 @@ Public Class CurrentProjectPageUC
Private m_bFirst As Boolean = True
' Dichiarazione Scene
Friend WithEvents CurrentProjectScene As New Scene
Private CurrentProjectSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
' Nella pagina Nest gestisco la dimensione della scena per visualizzare la lista dei parcheggi
Public CurrentProjectSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
' Identificativo progetto corrente
Private m_nCurrProj As Integer = 0
' Dati del grezzo
@@ -56,9 +57,11 @@ Public Class CurrentProjectPageUC
'Assegnazione scena all'host e posizionamento nella PlacePageGrid
CurrentProjectSceneHost.Child = CurrentProjectScene
CurrentProjectSceneHost.SetValue(Grid.ColumnProperty, 1)
CurrentProjectSceneHost.SetValue(Grid.RowProperty, 1)
Me.CurrentProjectPageGrid.Children.Add(CurrentProjectSceneHost)
CurrentProjectSceneHost.SetValue(Grid.ColumnProperty, 0)
CurrentProjectSceneHost.SetValue(Grid.ColumnSpanProperty, 2)
' CurrentProjectSceneHost.SetValue(Grid.RowProperty, 1)
'Me.CurrentProjectPageGrid.Children.Add(CurrentProjectSceneHost)
Me.SceneHostGrid.Children.Add(CurrentProjectSceneHost)
'Imposto i messaggi letti dal file dei messaggi
MaterialTxBl.ToolTip = EgtMsg(MSG_RAWPARTPAGEUC + 9) 'Material - Materiale