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

Skip to content
Snippets Groups Projects
Commit 441a15a3 authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

vecto3 gui: handle missing files in joblist

parent 91a068ae
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,11 @@ namespace VECTO3GUI.Model
for (int i = 0; i < jobEntries.Count; i++)
{
JobList.Add
(
( jobEntries[i].Missing ? new JobListEntry() {
JobFilePath = jobEntries[i].JobEntryFilePath,
IsSelected = false,
JobTypeName = JobType.Unknown.GetLabel(),
}:
new JobListEntry
{
JobTypeName = jobEntries[i].Header.JobType.GetLabel(),
......@@ -81,6 +85,13 @@ namespace VECTO3GUI.Model
for (int i = 0; i < JobList.Count; i++)
{
if (!File.Exists(JobList[i].JobFilePath)) {
jobEntries.Add(new JobEntry() {
JobEntryFilePath = JobList[i].JobFilePath,
Missing = true
});
continue;
}
var jobType = JobTypeHelper.Parse(JobList[i].JobTypeName);
JobEntry jobEntry;
......
......@@ -73,11 +73,12 @@ namespace VECTO3GUI.ViewModel.Impl
private JobBody _body;
private bool _selected;
private string _jobEntryFilePath;
private bool _missing;
[JsonIgnore]
public bool Selected
{
get { return _selected; }
get { return !Missing && _selected; }
set { SetProperty(ref _selected, value); }
}
......@@ -99,6 +100,12 @@ namespace VECTO3GUI.ViewModel.Impl
set { SetProperty(ref _body, value); }
}
public bool Missing
{
get { return _missing; }
set { SetProperty(ref _missing, value); }
}
public string GetAbsoluteFilePath(string propertyFilePath)
{
if (IsFileName(propertyFilePath)) {
......
......@@ -412,7 +412,7 @@ namespace VECTO3GUI.ViewModel.Impl
}
private bool CanEditCompletedFile(JobEntry jobEntry)
{
return jobEntry != null &&
return jobEntry != null && !jobEntry.Missing &&
(IsJobEntry(jobEntry) || jobEntry.Header.JobType == JobType.CompletedXml);
}
......@@ -777,8 +777,8 @@ namespace VECTO3GUI.ViewModel.Impl
private bool IsJobEntry(JobEntry jobEntry)
{
return jobEntry.Header.JobType == JobType.CompletedBusJob ||
jobEntry.Header.JobType == JobType.SingleBusJob;
return !jobEntry.Missing && (jobEntry.Header.JobType == JobType.CompletedBusJob ||
jobEntry.Header.JobType == JobType.SingleBusJob);
}
private bool IsXmlFile(string filePath)
......
......@@ -152,6 +152,15 @@
</DataGridTextColumn>
</DataGrid.Columns>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Style.Triggers>
<DataTrigger Binding="{Binding Missing}" Value="True">
<Setter Property="Foreground" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
</DataGrid>
</Grid>
......
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