Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 2e15d1b2 authored by Franz KOBER josef's avatar Franz KOBER josef
Browse files

changed behavior saveTo XML

parent 77c2e135
No related branches found
No related tags found
No related merge requests found
...@@ -126,14 +126,14 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -126,14 +126,14 @@ namespace VECTO3GUI.ViewModel.Impl
_editJob = true; _editJob = true;
} }
private void Init(IKernel kernel, JobType jobType) private void Init(IKernel kernel, JobType jobType)
{ {
SecondLabelText = $"Select {JobFileType.CompletedBusFile.GetLable()}"; SecondLabelText = $"Select {JobFileType.CompletedBusFile.GetLable()}";
Settings = new SettingsModel(); Settings = new SettingsModel();
SetFileTypes(jobType); SetFileTypes(jobType);
Kernel = kernel; Kernel = kernel;
} }
private void SetFileTypes(JobType jobType) private void SetFileTypes(JobType jobType)
{ {
JobType = jobType; JobType = jobType;
...@@ -180,7 +180,7 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -180,7 +180,7 @@ namespace VECTO3GUI.ViewModel.Impl
{ {
SecondFilePath = OpenFileSelector(jobFileType, nameof(SecondFilePath)); SecondFilePath = OpenFileSelector(jobFileType, nameof(SecondFilePath));
} }
public ICommand CancelCommand public ICommand CancelCommand
{ {
get { return _cancelCommand ?? (_cancelCommand = new RelayCommand<Window>(DoCancelCommand)); } get { return _cancelCommand ?? (_cancelCommand = new RelayCommand<Window>(DoCancelCommand)); }
...@@ -201,9 +201,9 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -201,9 +201,9 @@ namespace VECTO3GUI.ViewModel.Impl
private void DoSaveCommand(Window window) private void DoSaveCommand(Window window)
{ {
window.DialogResult = true; window.DialogResult = true;
if (!_editJob) if (!_editJob)
SaveJob(window); SaveJob(window);
else else
UpdateJobData(); UpdateJobData();
} }
...@@ -212,19 +212,21 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -212,19 +212,21 @@ namespace VECTO3GUI.ViewModel.Impl
private void SaveJob(Window window) private void SaveJob(Window window)
{ {
var jobFilePath = FileDialogHelper.SaveJobFileToDialog(Settings.XmlFilePathFolder); var jobFilePath = FileDialogHelper.SaveJobFileToDialog(Settings.XmlFilePathFolder);
if (jobFilePath != null) { if (jobFilePath == null)
return;
var job = new JobEntry {
JobEntryFilePath = jobFilePath, var job = new JobEntry
FirstFilePath = FirstFilePath, {
SecondFilePath = SecondFilePath, JobEntryFilePath = jobFilePath,
JobType = JobType FirstFilePath = FirstFilePath,
}; SecondFilePath = SecondFilePath,
JobType = JobType
SerializeHelper.SerializeToFile(jobFilePath, job); };
SavedJobEntry = job;
DoCancelCommand(window); SerializeHelper.SerializeToFile(jobFilePath, job);
} SavedJobEntry = job;
DoCancelCommand(window);
} }
private void UpdateJobData() private void UpdateJobData()
...@@ -232,7 +234,7 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -232,7 +234,7 @@ namespace VECTO3GUI.ViewModel.Impl
SavedJobEntry.FirstFilePath = FirstFilePath; SavedJobEntry.FirstFilePath = FirstFilePath;
SavedJobEntry.SecondFilePath = SecondFilePath; SavedJobEntry.SecondFilePath = SecondFilePath;
} }
private string OpenFileSelector(JobFileType jobFileType, string textPropertyName) private string OpenFileSelector(JobFileType jobFileType, string textPropertyName)
{ {
......
...@@ -94,6 +94,8 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -94,6 +94,8 @@ namespace VECTO3GUI.ViewModel.Impl
protected override void DoSaveToJob(Window window) protected override void DoSaveToJob(Window window)
{ {
var filePath = FileDialogHelper.SaveXmlFileToDialog(SettingsModel.XmlFilePathFolder); var filePath = FileDialogHelper.SaveXmlFileToDialog(SettingsModel.XmlFilePathFolder);
if(filePath == null)
return;
SetCurrentDataToSave(); SetCurrentDataToSave();
var xDocument = _xmlCompletedBus.GenerateCompletedBusDocument(CompleteVehicleBusData); var xDocument = _xmlCompletedBus.GenerateCompletedBusDocument(CompleteVehicleBusData);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment