Finestra selezione di avvio
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Imports System.Windows.Interop
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class CurrentProjectPageUC
|
||||
' Dichiarazione eventi
|
||||
@@ -31,6 +32,8 @@ Public Class CurrentProjectPageUC
|
||||
FLATS = 1
|
||||
FRAMES = 2
|
||||
End Enum
|
||||
' elenco dei file di recente apertura
|
||||
Friend m_MruFiles As New MruList
|
||||
|
||||
Private Sub CurrentProjectPage_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
@@ -64,6 +67,8 @@ Public Class CurrentProjectPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub CurrentProjectPage_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
' Impostazioni MruLists: carico la lista degli ultimi file caricati/aperti
|
||||
m_MruFiles.Init(S_MRUFILES, 8)
|
||||
If m_bFirst Then
|
||||
' imposto colore di default
|
||||
Dim DefColor As New Color3d(0, 0, 0)
|
||||
@@ -167,20 +172,30 @@ Public Class CurrentProjectPageUC
|
||||
' Inizializzo gestore lavorazioni
|
||||
EgtInitMachMgr(m_MainWindow.GetMachinesRootDir(), m_MainWindow.GetToolMakersDir())
|
||||
m_bFirst = False
|
||||
|
||||
' ------------------ SELEZIONE AVVIO -----------------------------
|
||||
'' apro la finstra di selezione di avvio del programma
|
||||
'StartProgram()
|
||||
' ------------------ SELEZIONE AVVIO -----------------------------
|
||||
|
||||
' Se richiesto, carico ultimo progetto
|
||||
Dim bAutoLoadLast As Boolean = GetPrivateProfileInt(S_GENERAL, K_AUTOLOADLASTPROJ, 0, m_MainWindow.GetIniFile()) <> 0
|
||||
If bAutoLoadLast Then
|
||||
m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile())
|
||||
Dim sPath As String = m_MainWindow.GetSaveDir() & "\" & m_nCurrProj.ToString("D4") & ".nge"
|
||||
If Not LoadProject(sPath, False) Then
|
||||
NewProject()
|
||||
End If
|
||||
EgtResetModified()
|
||||
' Altrimenti ne imposto uno nuovo
|
||||
Else
|
||||
m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile())
|
||||
NewProject()
|
||||
End If
|
||||
'If bAutoLoadLast Then
|
||||
' m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile())
|
||||
' Dim sPath As String = m_MainWindow.GetSaveDir() & "\" & m_nCurrProj.ToString("D4") & ".nge"
|
||||
' If Not LoadProject(sPath, False) Then
|
||||
' NewProject()
|
||||
' End If
|
||||
' EgtResetModified()
|
||||
' Altrimenti ne imposto uno nuovo
|
||||
'Else
|
||||
' m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile())
|
||||
' NewProject()
|
||||
'End If
|
||||
|
||||
' creo nuovo progetto
|
||||
NewProject()
|
||||
|
||||
' Nascondo progress per fotografia
|
||||
PhotoProgress.Visibility = Windows.Visibility.Hidden
|
||||
' Carico sottopagina opportuna
|
||||
@@ -193,9 +208,11 @@ Public Class CurrentProjectPageUC
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.FrameCut
|
||||
m_MainWindow.FrameCutBtn.IsChecked = True
|
||||
End If
|
||||
|
||||
Else
|
||||
EgtSetCurrentContext(CurrentProjectScene.GetCtx())
|
||||
End If
|
||||
|
||||
' inibisco selezione diretta da Scene
|
||||
CurrentProjectScene.SetStatusNull()
|
||||
' Imposto dati progetto
|
||||
@@ -207,7 +224,60 @@ Public Class CurrentProjectPageUC
|
||||
' Visualizzo lama e lavorazione correnti
|
||||
ToolTxBx.Text = m_MainWindow.m_CurrentMachine.sCurrSaw
|
||||
MachiningTxBx.Text = m_MainWindow.m_CurrentMachine.sCurrSawing
|
||||
End Sub
|
||||
|
||||
Public Sub StartProgram()
|
||||
Dim MyStartLancherWD As New StartLauncherWD(m_MainWindow)
|
||||
MyStartLancherWD.ShowDialog()
|
||||
|
||||
' Se richiesto, carico ultimo progetto
|
||||
Dim bAutoLoadLast As Boolean = GetPrivateProfileInt(S_GENERAL, K_AUTOLOADLASTPROJ, 0, m_MainWindow.GetIniFile()) <> 0
|
||||
m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile())
|
||||
' se ultimo progetto
|
||||
If MyStartLancherWD.CurrSelection = 2 Then
|
||||
bAutoLoadLast = True
|
||||
|
||||
' Stampo il numero di progetto con 4 decimali: 12 -> "0012"
|
||||
Dim sPath As String = m_MainWindow.GetSaveDir() & "\" & m_nCurrProj.ToString("D4") & ".nge"
|
||||
' provo ad aprire l'ultimo progetto modificato
|
||||
If Not LoadProject(sPath, False) Then
|
||||
' altrimenti apro un nuovo progetto
|
||||
NewProject()
|
||||
Else
|
||||
' salvo il nome del file caricato
|
||||
m_MruFiles.Add(sPath)
|
||||
End If
|
||||
EgtResetModified()
|
||||
|
||||
' apro il file selezionato all'avvio
|
||||
ElseIf MyStartLancherWD.CurrSelection = 3 Then
|
||||
If Not LoadProject(MyStartLancherWD.SelPath, False) Then
|
||||
' altrimenti apro un nuovo progetto
|
||||
NewProject()
|
||||
Else
|
||||
' salvo il nome del file caricato
|
||||
m_MruFiles.Add(MyStartLancherWD.SelPath)
|
||||
End If
|
||||
EgtResetModified()
|
||||
|
||||
' se nuovo progetto o naviga direttorio
|
||||
ElseIf MyStartLancherWD.CurrSelection = 1 Or MyStartLancherWD.CurrSelection = 0 Then
|
||||
bAutoLoadLast = False
|
||||
NewProject()
|
||||
End If
|
||||
|
||||
'' Nascondo progress per fotografia
|
||||
'PhotoProgress.Visibility = Windows.Visibility.Hidden
|
||||
'' Carico sottopagina opportuna
|
||||
'If GetProjectType() <> PRJ_TYPE.FRAMES Then
|
||||
' CurrentProjectPageGrid.Children.Add(m_MainWindow.m_CadCutPageUC)
|
||||
' m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
|
||||
' m_MainWindow.CadCutBtn.IsChecked = True
|
||||
'Else
|
||||
' CurrentProjectPageGrid.Children.Add(m_MainWindow.m_FrameCutPageUC)
|
||||
' m_MainWindow.m_ActivePage = MainWindow.Pages.FrameCut
|
||||
' m_MainWindow.FrameCutBtn.IsChecked = True
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Private Sub OnMyMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CurrentProjectScene.OnMouseDownScene
|
||||
@@ -247,6 +317,7 @@ Public Class CurrentProjectPageUC
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' apri nuovo progetto
|
||||
Friend Function NewProject(Optional nTabInd As Integer = 1,
|
||||
Optional bRetainParkedParts As Boolean = False) As Boolean
|
||||
' Salvo l'area totale dei pezzi
|
||||
@@ -369,6 +440,7 @@ Public Class CurrentProjectPageUC
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' carica ultimo progetto
|
||||
Friend Function LoadProject(ByVal sPath As String, Optional ByVal bUpdateIndex As Boolean = True) As Boolean
|
||||
' Se richiesto, imposto nuovo indice di progetto
|
||||
If bUpdateIndex Then
|
||||
@@ -464,6 +536,7 @@ Public Class CurrentProjectPageUC
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' salva progetto
|
||||
Friend Function SaveProject() As Boolean
|
||||
' Determino nome del progetto
|
||||
m_nCurrProj = Math.Abs(m_nCurrProj)
|
||||
|
||||
@@ -36,6 +36,7 @@ Public Class ProjectMgrUC
|
||||
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
|
||||
m_CurrMachine = m_MainWindow.m_CurrentMachine
|
||||
m_CurrNcComm = m_MainWindow.m_CNCommunication
|
||||
|
||||
' Se richiesto carico finestra per VeinMatching e ultimo intarsio
|
||||
If m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.MAN_PHOTO) And
|
||||
GetPrivateProfileInt(S_VEINMATCHING, K_VEINMA_ENABLE, 0, m_MainWindow.GetIniFile()) <> 0 And
|
||||
@@ -155,6 +156,7 @@ Public Class ProjectMgrUC
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
If Not m_CurrProjPage.LoadProject(sCurrDir & "\" & sCurrFile) Then
|
||||
m_CurrProjPage.NewProject()
|
||||
m_CurrProjPage.m_MruFiles.Remove(sCurrDir & "\" & sCurrFile)
|
||||
Else
|
||||
' Verifico se file salvato con nome guardando il nome della cartella in cui si trova
|
||||
Dim sSaveNameDir As String = String.Empty
|
||||
@@ -171,6 +173,7 @@ Public Class ProjectMgrUC
|
||||
If sCurrDir <> m_MainWindow.GetSaveDir() And sCurrDir <> sSaveNameDir Then
|
||||
m_CurrProjPage.SetLoadPath(sCurrDir & "\" & sCurrFile)
|
||||
End If
|
||||
m_CurrProjPage.m_MruFiles.Add(sCurrDir & "\" & sCurrFile)
|
||||
End If
|
||||
' Verifico se andare nel CadCut o nel FrameCut
|
||||
Dim nPrjType As Integer = m_CurrProjPage.GetCurrentProjectType()
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
<Window x:Class="StartLauncherWD"
|
||||
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}"
|
||||
ResizeMode="NoResize" WindowStyle="None" AllowsTransparency="True" Background="Transparent"
|
||||
Title="SaveNameWD" Height="300" Width="426.5" ShowInTaskbar="False">
|
||||
<!--Definizione della pagina di scelta del nome con cui salvare il progetto-->
|
||||
<Border Style="{DynamicResource OmagCut_Border}">
|
||||
<Grid x:Name="SaveNameGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.5*"/>
|
||||
<ColumnDefinition Width="4*"/>
|
||||
<ColumnDefinition Width="0.5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.2*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.2*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="0.2*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="0.2*"/>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--Messaggio di tipo di avvio-->
|
||||
<TextBlock Name="SlectLauncherTxbl" Grid.Column="1" Grid.Row="1"
|
||||
Style="{DynamicResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
|
||||
<Grid Name="ButtonsGrid" Grid.Column="1" Grid.Row="3" Grid.RowSpan="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="0.2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="0.2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--apri folder progetti-->
|
||||
<Button Name="OpenFolder" Grid.Column="0" Style="{DynamicResource OmagCut_GradientBlueIconButton}"
|
||||
ToolTip="OpenFolder">
|
||||
<Image Source="{DynamicResource ZoomWinImg}" Style="{StaticResource OmagCut_ButtonIcon}"/>
|
||||
</Button>
|
||||
<!--nuovo progetto-->
|
||||
<Button Name="NewProject" Grid.Column="2" Style="{DynamicResource OmagCut_GradientBlueIconButton}"
|
||||
ToolTip="New Project">
|
||||
<Image Source="{DynamicResource CsvNewImg}" Style="{StaticResource OmagCut_ButtonIcon}"/>
|
||||
</Button>
|
||||
<!--ultimo progetto-->
|
||||
<Button Name="LastProject" Grid.Column="4" Style="{DynamicResource OmagCut_GradientBlueIconButton}"
|
||||
ToolTip="LastProject">
|
||||
<Image Source="{DynamicResource CsvOpenImg}" Style="{StaticResource OmagCut_ButtonIcon}"/>
|
||||
</Button>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!--lista degli ultimi file aperti-->
|
||||
<ListBox Name="FilesLsBx" Grid.Column="1" Grid.Row="5"
|
||||
SelectionMode="Extended">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
</ListBox>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
</Window>
|
||||
@@ -0,0 +1,77 @@
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib
|
||||
Public Class StartLauncherWD
|
||||
|
||||
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
||||
|
||||
Public Enum MODE_LAUNCHER As Integer
|
||||
OpenFolder = 0
|
||||
NewProject = 1
|
||||
LastProject = 2
|
||||
SelectedProject = 3
|
||||
End Enum
|
||||
|
||||
Private m_CurrSelection As MODE_LAUNCHER
|
||||
Public ReadOnly Property CurrSelection As MODE_LAUNCHER
|
||||
Get
|
||||
Return m_CurrSelection
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelPath As String = String.Empty
|
||||
Public ReadOnly Property SelPath As String
|
||||
Get
|
||||
Return m_SelPath
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub New(Owner As Window)
|
||||
Me.Owner = Owner
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
|
||||
' inizializzo la finestra
|
||||
Private Sub StartLauncherWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
' carico la liste dei file recenti
|
||||
FilesLsBx.ItemsSource = m_MainWindow.m_CurrentProjectPageUC.m_MruFiles.FileNames
|
||||
' posiziono la fistra in centro alla pagina
|
||||
Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2
|
||||
Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2
|
||||
' imopposto il messaggio di avvio
|
||||
SlectLauncherTxbl.Text = "Seleziona modalità di avvio"
|
||||
End Sub
|
||||
|
||||
' lancio l'apertura della pagina dei progetti
|
||||
Private Sub OpenFolder_Click(sender As Object, e As RoutedEventArgs) Handles OpenFolder.Click
|
||||
m_CurrSelection = MODE_LAUNCHER.OpenFolder
|
||||
m_MainWindow.m_PrevActivePage = m_MainWindow.m_ActivePage
|
||||
' Passo alla pagina di apertura con preview
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_OpenPage)
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.Open
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
' creo un progetto nuovo
|
||||
Private Sub NewProject_Click(sender As Object, e As RoutedEventArgs) Handles NewProject.Click
|
||||
m_CurrSelection = MODE_LAUNCHER.NewProject
|
||||
EgtZoom(ZM.ALL)
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
' Ultimo progetto
|
||||
Private Sub LastProject_Click(sender As Object, e As RoutedEventArgs) Handles LastProject.Click
|
||||
m_CurrSelection = MODE_LAUNCHER.LastProject
|
||||
EgtZoom(ZM.ALL)
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
' quando viene rilasciato il mouse
|
||||
Private Sub SelectProject_MouseUp(sender As Object, e As RoutedEventArgs) Handles FilesLsBx.MouseDoubleClick, FilesLsBx.TouchUp
|
||||
m_SelPath = FilesLsBx.SelectedItem
|
||||
m_CurrSelection = MODE_LAUNCHER.SelectedProject
|
||||
EgtZoom(ZM.ALL)
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user