- Gestito progetto modificato all'interno del programma

This commit is contained in:
Emmanuele Sassi
2023-10-04 10:18:53 +02:00
parent f959cb157c
commit 37abbd79d5
4 changed files with 44 additions and 23 deletions
+16 -14
View File
@@ -23,6 +23,7 @@ Public Class EgtMessageBoxVM
End Property
Private m_Button As MessageBoxButton
Private m_Icon As MessageBoxImage
Public ReadOnly Property sIconSource As String
Get
@@ -165,6 +166,7 @@ Public Class EgtMsgBoxButton
Friend Sub SetIsDefault(bValue As Boolean)
m_bIsDefault = bValue
End Sub
' Definizione comandi
Private m_cmdCommand As ICommand
@@ -176,26 +178,26 @@ Public Class EgtMsgBoxButton
m_Type = Type
Select Case m_Type
Case Types.OK
m_sMessage = EgtMsg(35001)
Case Types.CANCEL
m_sMessage = EgtMsg(35002)
Case Types.YES
m_sMessage = EgtMsg(35003)
Case Types.NO
m_sMessage = EgtMsg(35004)
End Select
m_sMessage = EgtMsg(35001)
Case Types.CANCEL
m_sMessage = EgtMsg(35002)
Case Types.YES
m_sMessage = EgtMsg(35003)
Case Types.NO
m_sMessage = EgtMsg(35004)
End Select
End Sub
Sub New(Type As Types, bIsDefault As Boolean)
MyClass.New(Type)
m_bIsDefault = bIsDefault
End Sub
Sub New(Type As Types, bIsDefault As Boolean)
MyClass.New(Type)
m_bIsDefault = bIsDefault
End Sub
#End Region ' CONTRUCTORS
#Region "METHODS"
Friend Shared Sub SetOwner(value As EgtMessageBoxVM)
Friend Shared Sub SetOwner(value As EgtMessageBoxVM)
Owner = value
End Sub
@@ -227,7 +229,7 @@ Public Class EgtMsgBoxButton
End Select
End Sub
#End Region ' Ok
#End Region ' Command
#End Region ' COMMANDS
+1 -8
View File
@@ -166,14 +166,7 @@ Public Class MainWindowVM
If Map.refRightPanelVM.SelPanel = RightPanelVM.Panels.SIMULATION AndAlso Not IsNothing(Map.refSimulationPanelVM) Then
Map.refSimulationPanelVM.MySimul.ResetSimulation()
End If
' Gestisco eventuale file corrente modificato
Dim bOk As Boolean = True
'bOk = ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ)
' se salvataggio annullato, rimango
If Not bOk Then Return
Dim bAllowClose As Boolean = Map.refSceneHostVM.MainController.ManageModified()
' Salvo impostazione macchina corrente
'Map.refMachinePanelVM.SaveCurrentMachine()
Dim bAllowClose As Boolean = Map.refSceneHostVM.ManageModified()
' Se non confermata chiusura, esco
If Not bAllowClose Then Return
' salvo modo di visualizzazione
+27
View File
@@ -726,6 +726,33 @@ Public Class MySceneHostVM
Return bOk
End Function
Public Function ManageModified() As Boolean
' se non modificato, procedo normalmente
If Not EgtGetModified() Then
Return True
End If
' chiedo cosa fare
Dim sMsg As String = "Save changes"
Dim sCurrFile = ""
EgtGetCurrFilePath(sCurrFile)
sCurrFile = Path.GetFileName(sCurrFile)
If Not String.IsNullOrEmpty(sCurrFile) Then
sMsg = String.Format("Save changes to {0}?", sCurrFile)
Else
sMsg = "Save changes?"
End If
Dim nRes = EgtMessageBoxV.Show(Application.Current.MainWindow, sMsg, "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
Select Case nRes
Case Windows.Forms.DialogResult.Yes
SaveProject()
Return True
Case Windows.Forms.DialogResult.No
Return True
Case Else
Return False
End Select
End Function
#End Region ' ProjectManager
#Region "SCENE EVENTS"
-1
View File
@@ -3,7 +3,6 @@
xmlns:PrintApp="clr-namespace:Icarus"
xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtWPFLib48="clr-namespace:EgtWPFLib48;assembly=EgtWPFLib48"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
>