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

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

changed and added additional Menu and ContextMenu options

parent 63078a3a
No related branches found
No related tags found
No related merge requests found
......@@ -13,17 +13,25 @@ namespace VECTO3GUI.Helper
{
public static class FileDialogHelper
{
private const string XMLFilter = "XML Files (*.xml)|*.xml|All Files (*.*)|*.*";
private const string JobFilter = "Job Files (*.vectojob|*.vectojob|All Files (*.*)|*.*";
public const string XMLFilter = "XML Files (*.xml)|*.xml|All Files (*.*)|*.*";
public const string JobFilter = "Job Files (*.vectojob|*.vectojob|All Files (*.*)|*.*";
public static string[] ShowSelectFilesDialog(bool multiselect, string initialDirectory = null)
public static string[] ShowSelectFilesDialog(bool multiselect)
{
return ShowSelectFilesDialog(multiselect, XMLFilter);
}
public static string[] ShowSelectFilesDialog(bool multiselect, string filter = XMLFilter, string initialDirectory = null)
{
using (var openFileDialog = new OpenFileDialog())
{
openFileDialog.InitialDirectory = initialDirectory;
openFileDialog.Multiselect = multiselect;
openFileDialog.Filter = XMLFilter;
openFileDialog.Filter = filter;
var result = openFileDialog.ShowDialog();
if (result == DialogResult.OK)
......
......@@ -8,6 +8,7 @@
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:impl="clr-namespace:VECTO3GUI.ViewModel.Impl"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:views="clr-namespace:VECTO3GUI.Views"
mc:Ignorable="d"
Title="{Binding Version}" Height="515.36" Width="972.48" WindowStartupLocation="CenterScreen"
d:DataContext="{d:DesignInstance Type=impl:MainWindowViewModel, IsDesignTimeCreatable=False}">
......@@ -24,13 +25,14 @@
<Menu IsMainMenu="True" Style="{DynamicResource MetroMenu}">
<MenuItem Header="File" VerticalAlignment="Center">
<MenuItem Header="New" Style="{DynamicResource MetroMenuItem}" Margin="0"
Command="{Binding CurrentViewModel.CreateNewJob}"/>
<MenuItem Header="Edit" Style="{DynamicResource MetroMenuItem}" Margin="0"
Command="{Binding CurrentViewModel.EditJob}"/>
<Separator HorizontalAlignment="Stretch" Background="Gray"/>
<MenuItem Header="Open" Command="{Binding CurrentViewModel.AddJob}"/>
<MenuItem Header="Open Folder"/>
<MenuItem Header="Add Job" Command="{Binding CurrentViewModel.AddJob}"/>
<MenuItem Header="Edit Job"
Command="{Binding CurrentViewModel.EditJob}"
CommandParameter="{Binding CurrentViewModel.SelectedJobEntry}"/>
<MenuItem Header="Remove Job"
Command="{Binding CurrentViewModel.RemoveJob}"
CommandParameter="{Binding CurrentViewModel.SelectedJobEntry}"/>
<Separator HorizontalAlignment="Stretch" Background="Gray"/>
<MenuItem Header="Exit" Command="{Binding CurrentViewModel.ExitMainCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/>
......@@ -42,21 +44,20 @@
<!--<MenuItem.Icon>
<iconPacks:PackIconModern Width="15" Height="15" Kind="Tools" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Green" />
</MenuItem.Icon>-->
<MenuItem Header="Single Bus Job"
<MenuItem Header="Create Single Bus Job"
Command="{Binding CurrentViewModel.AddBusJob}" CommandParameter="{Binding Source={x:Static impl:JobType.SingleBusJob}}"/>
<MenuItem Header="Completed Bus Job"
<MenuItem Header="Create Completed Bus Job"
Command="{Binding CurrentViewModel.AddBusJob}" CommandParameter="{Binding Source={x:Static impl:JobType.CompletedBusJob}}"/>
<MenuItem Header="New Completed XML"/>
<MenuItem Header="Create Completed XML"
Command="{Binding CurrentViewModel.CreateNewJob}"/>
<Separator HorizontalAlignment="Stretch" Background="Gray"/>
<MenuItem Header="Default Settings"
<MenuItem Header="Settings"
Command="{Binding CurrentViewModel.OpenSettings}"/>
</MenuItem>
<MenuItem Header="Help" VerticalAlignment="Center">
<MenuItem Header="User Manual"/>
<MenuItem Header="About Vecto"/>
<MenuItem Header="Relase Notes"/>
</MenuItem>
</Menu>
......
......@@ -53,7 +53,7 @@ namespace VECTO3GUI.Model
private void SetJobList(IList<JobEntry> jobEntries)
{
if (jobEntries.IsNullOrEmpty())
if (jobEntries == null)
return;
JobList = new List<JobListEntry>();
......
......@@ -236,7 +236,7 @@ namespace VECTO3GUI.ViewModel.Impl
private string OpenFileSelector(JobFileType jobFileType, string textPropertyName)
{
var dialogResult = FileDialogHelper.ShowSelectFilesDialog(false, Settings.XmlFilePathFolder);
var dialogResult = FileDialogHelper.ShowSelectFilesDialog(false, FileDialogHelper.XMLFilter, Settings.XmlFilePathFolder);
if (dialogResult == null)
return null;
......
......@@ -3,11 +3,13 @@ using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using System.Xml;
using Castle.Core.Internal;
using Ninject;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCore.InputData.FileIO.XML;
......@@ -27,15 +29,11 @@ namespace VECTO3GUI.ViewModel.Impl
protected ObservableCollectionEx<JobEntry> _jobs;
protected readonly ObservableCollection<MessageEntry> _messages = new ObservableCollection<MessageEntry>();
private readonly SettingsModel _settings;
private string _firstContextMenu;
private JobEntry _selectedJobEntry;
private JobListModel _jobListModel;
#endregion
#region Commands
private ICommand _newJobCommand;
private ICommand _editJobCommand;
private ICommand _removeJobCommand;
......@@ -43,10 +41,13 @@ namespace VECTO3GUI.ViewModel.Impl
private ICommand _addJobCommand;
private ICommand _openJobCommand;
private ICommand _openSettingsCommand;
private ICommand _exitCommand;
private ICommand _exitMainCommand;
private ICommand _addBusJobCommand;
private ICommand _editCompletedFileCommand;
private ICommand _moveJobUpCommand;
private ICommand _moveJobDownCommand;
private ICommand _startSimulationCommand;
private ICommand _openInFolderCommand;
#endregion
......@@ -55,7 +56,16 @@ namespace VECTO3GUI.ViewModel.Impl
public JobEntry SelectedJobEntry
{
get { return _selectedJobEntry; }
set { SetProperty(ref _selectedJobEntry, value); }
set
{
SetProperty(ref _selectedJobEntry, value);
if (_selectedJobEntry != null) {
var firstJobTyp = _selectedJobEntry.JobType == JobType.SingleBusJob
? JobFileType.PrimaryBusFile
: JobFileType.PIFBusFile;
FirstContextMenu = $"View {firstJobTyp.GetLable()}";
}
}
}
public ObservableCollectionEx<JobEntry> Jobs
......@@ -69,9 +79,14 @@ namespace VECTO3GUI.ViewModel.Impl
get { return _messages; }
}
public string FirstContextMenu
{
get { return _firstContextMenu; }
set { SetProperty(ref _firstContextMenu, value); }
}
#endregion
public JoblistViewModel()
{
_settings = new SettingsModel();
......@@ -88,38 +103,39 @@ namespace VECTO3GUI.ViewModel.Impl
private void JobItemChanged(object sender, PropertyChangedEventArgs e)
{
if(e.PropertyName == "Selected" && sender is JobEntry )
UpdateJobEntry((JobEntry) sender);
if (e.PropertyName == "Selected" && sender is JobEntry)
UpdateJobEntry((JobEntry)sender);
}
private void JobsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
switch (e.Action) {
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
case NotifyCollectionChangedAction.Remove:
case NotifyCollectionChangedAction.Move:
case NotifyCollectionChangedAction.Reset:
_jobListModel.SaveJobList(_jobs);
break;
}
}
#region Implementation IJoblistViewModel
#region Commands
public ICommand RemoveJob
{
get
{
return _removeJobCommand ??
(_removeJobCommand = new RelayCommand(DoRemoveJob, CanRemoveJob));
return _removeJobCommand ?? (_removeJobCommand = new RelayCommand<JobEntry>(DoRemoveJob, CanRemoveJob));
}
}
private void DoRemoveJob()
private void DoRemoveJob(JobEntry jobEntry)
{
_jobs.Remove(SelectedJobEntry);
SelectedJobEntry = null;
_jobs.Remove(jobEntry);
}
private bool CanRemoveJob()
private bool CanRemoveJob(JobEntry jobEntry)
{
return SelectedJobEntry != null;
return jobEntry != null;
}
......@@ -127,8 +143,7 @@ namespace VECTO3GUI.ViewModel.Impl
{
get
{
return _removeAllJobCommand ??
(_removeAllJobCommand = new RelayCommand(DoRemoveAllJobs));
return _removeAllJobCommand ?? (_removeAllJobCommand = new RelayCommand(DoRemoveAllJobs));
}
}
private void DoRemoveAllJobs()
......@@ -136,16 +151,29 @@ namespace VECTO3GUI.ViewModel.Impl
_jobs.Clear();
SelectedJobEntry = null;
}
public ICommand EditJob
{
get
{
return _editJobCommand ??
(_editJobCommand = new RelayCommand<JobEntry>(DoEditJob, CanEditJob));
return _editJobCommand ?? (_editJobCommand = new RelayCommand<JobEntry>(DoEditJob, CanEditJob));
}
}
private bool CanEditJob(JobEntry jobEntry)
{
return jobEntry != null;
}
private void DoEditJob(JobEntry jobEntry)
{
var viewModel = GetBusJobViewModel(jobEntry.JobType, jobEntry);
var window = CreateBusJobOutputWindow(viewModel, jobEntry.JobType);
if (window.ShowDialog() != true)
ResetBusJobEntries(jobEntry);
else
UpdateJobEntry(((IBusJobViewModel)viewModel).SavedJobEntry);
}
public ICommand EditCompletedFile
{
......@@ -156,12 +184,10 @@ namespace VECTO3GUI.ViewModel.Impl
new RelayCommand<JobEntry>(DoEditCompletedFile, CanEditCompletdFile));
}
}
private bool CanEditCompletdFile(JobEntry jobEntry)
{
return jobEntry != null;
}
private void DoEditCompletedFile(JobEntry jobEntry)
{
var viewModel = ReadCompletedXmlFile(jobEntry);
......@@ -172,29 +198,12 @@ namespace VECTO3GUI.ViewModel.Impl
window.Show();
}
private bool CanEditJob(JobEntry jobEntry)
{
return jobEntry != null;
}
private void DoEditJob(JobEntry jobEntry)
{
var viewModel = GetBusJobViewModel(jobEntry.JobType, jobEntry);
var window = CreateBusJobOutputWindow(viewModel, jobEntry.JobType);
if(window.ShowDialog() != true)
ResetBusJobEntries(jobEntry);
else
UpdateJobEntry(((IBusJobViewModel)viewModel).SavedJobEntry);
}
public ICommand CreateNewJob
{
get
{
return _newJobCommand ??
(_newJobCommand = new RelayCommand(DoNewJobCommand));
return _newJobCommand ?? (_newJobCommand = new RelayCommand(DoNewJobCommand));
}
}
private void DoNewJobCommand()
......@@ -209,16 +218,25 @@ namespace VECTO3GUI.ViewModel.Impl
{
get
{
return _openJobCommand ??
(_openJobCommand = new RelayCommand(DoOpenJobCommand));
return _openJobCommand ?? (_openJobCommand = new RelayCommand<JobFileType>(DoOpenJobCommand));
}
}
private void DoOpenJobCommand()
private void DoOpenJobCommand(JobFileType jobFileType)
{
if (SelectedJobEntry == null)
return;
var xmlViewModel = new XMLViewModel(SelectedJobEntry.FirstFilePath);
XMLViewModel xmlViewModel = null;
switch (jobFileType) {
case JobFileType.PIFBusFile:
case JobFileType.PrimaryBusFile:
xmlViewModel = new XMLViewModel(SelectedJobEntry.FirstFilePath);
break;
case JobFileType.CompletedBusFile:
xmlViewModel = new XMLViewModel(SelectedJobEntry.SecondFilePath);
break;
}
var window = OutputWindowHelper.CreateOutputWindow(Kernel, xmlViewModel, xmlViewModel.FileName);
window.Show();
}
......@@ -233,16 +251,12 @@ namespace VECTO3GUI.ViewModel.Impl
}
private void DoAddJob()
{
var filePath = FileDialogHelper.ShowSelectFilesDialog(false, _settings.XmlFilePathFolder);
if (filePath != null)
{
_jobs.Add(new JobEntry()
{
FirstFilePath = filePath.First(),
Selected = false,
Sorting = _jobs.Count
});
}
var filePath = FileDialogHelper.ShowSelectFilesDialog(false, FileDialogHelper.JobFilter);
if (filePath.IsNullOrEmpty() || !IsNewJobFile(filePath.First()))
return;
var jobEntry = SerializeHelper.DeserializeToObject<JobEntry>(filePath.First());
_jobs.Add(jobEntry);
}
......@@ -250,8 +264,7 @@ namespace VECTO3GUI.ViewModel.Impl
{
get
{
return _openSettingsCommand ??
(_openSettingsCommand = new RelayCommand(DoOpenSettingsCommand));
return _openSettingsCommand ?? (_openSettingsCommand = new RelayCommand(DoOpenSettingsCommand));
}
}
private void DoOpenSettingsCommand()
......@@ -262,12 +275,12 @@ namespace VECTO3GUI.ViewModel.Impl
window.ShowDialog();
}
public ICommand ExitMainCommand
{
get
{
return _exitMainCommand ??
(_exitMainCommand = new RelayCommand<Window>(DoCloseMainCommand));
return _exitMainCommand ?? (_exitMainCommand = new RelayCommand<Window>(DoCloseMainCommand));
}
}
private void DoCloseMainCommand(Window window)
......@@ -275,31 +288,77 @@ namespace VECTO3GUI.ViewModel.Impl
window?.Close();
}
public ICommand AddBusJob
{
get
{
return _addBusJobCommand ??
(_addBusJobCommand = new RelayCommand<JobType>(DoAddBusJobCommand));
return _addBusJobCommand ?? (_addBusJobCommand = new RelayCommand<JobType>(DoAddBusJobCommand));
}
}
private void DoAddBusJobCommand(JobType jobType)
{
var viewModel = GetBusJobViewModel(jobType);
var window = CreateBusJobOutputWindow(viewModel, jobType);
if(window.ShowDialog() == true)
if (window.ShowDialog() == true)
AddBusJobEntry(((IBusJobViewModel)viewModel)?.SavedJobEntry);
}
public ICommand MoveJobUp { get { return new RelayCommand(() => { }, () => false); } }
public ICommand MoveJobDown { get { return new RelayCommand(() => { }, () => false); } }
public ICommand StartSimulation { get { return new RelayCommand(() => { }, () => false); } }
public ICommand JobEntrySetActive { get { return new RelayCommand(() => { }, () => false); } }
public ICommand MoveJobUp
{
get { return _moveJobUpCommand ?? (_moveJobUpCommand = new RelayCommand<JobEntry>(DoMoveJobUpCommand)); }
}
private void DoMoveJobUpCommand(JobEntry jobEntry)
{
if (jobEntry == null)
return;
var index = _jobs.IndexOf(jobEntry);
if (index - 1 >= 0)
_jobs.Move(index, index - 1);
}
public ICommand MoveJobDown
{
get { return _moveJobDownCommand ?? (_moveJobDownCommand = new RelayCommand<JobEntry>(DoMoveJobDownCommand)); }
}
private void DoMoveJobDownCommand(JobEntry jobEntry)
{
if (jobEntry == null)
return;
var index = _jobs.IndexOf(jobEntry);
if (index + 1 < _jobs.Count)
_jobs.Move(index, index + 1);
}
public ICommand StartSimulation
{
get { return _startSimulationCommand ?? (_startSimulationCommand = new RelayCommand(DoStartSimulationCommand)); }
}
private void DoStartSimulationCommand()
{
}
public ICommand OpenInFolder
{
get { return _openInFolderCommand ?? (_openInFolderCommand = new RelayCommand<JobEntry>(DoOpenInFolderCommand)); }
}
private void DoOpenInFolderCommand(JobEntry jobEntry)
{
if (jobEntry != null) {
var dirPath = Path.GetDirectoryName(jobEntry.JobEntryFilePath);
if (Directory.Exists(dirPath)) {
Process.Start("explorer.exe", dirPath);
}
}
}
#endregion
private object GetBusJobViewModel(JobType jobType, JobEntry jobEntry = null)
{
var currentJobType = jobEntry?.JobType ?? jobType;
......@@ -338,7 +397,7 @@ namespace VECTO3GUI.ViewModel.Impl
private void ResetBusJobEntries(JobEntry jobEntry)
{
SerializeHelper.DeserializeToObject<JobEntry>(jobEntry.JobEntryFilePath);
SerializeHelper.DeserializeToObject<JobEntry>(jobEntry.JobEntryFilePath);
}
private void UpdateJobEntry(JobEntry jobEntry)
......@@ -349,7 +408,8 @@ namespace VECTO3GUI.ViewModel.Impl
private IJobEditViewModel ReadCompletedXmlFile(JobEntry jobEntry)
{
var xmlInputReader = Kernel.Get<IXMLInputDataReader>();
using (var reader = XmlReader.Create(jobEntry.SecondFilePath)) {
using (var reader = XmlReader.Create(jobEntry.SecondFilePath))
{
var readerResult = xmlInputReader.Create(reader) as IDeclarationInputDataProvider;
return CreateCompleteBusVehicleViewModel(readerResult);
}
......@@ -364,60 +424,16 @@ namespace VECTO3GUI.ViewModel.Impl
return dataProvider == null ? null : new CompleteVehicleBusJobViewModel(Kernel, dataProvider);
}
//private IJobEditViewModel ReadJob(string jobFile)
//{
// if (jobFile == null)
// return null;
// var ext = Path.GetExtension(jobFile);
// if (ext == Constants.FileExtensions.VectoXMLDeclarationFile)
// {
// var localName = GetLocalName(jobFile);
// var xmlInputReader = Kernel.Get<IXMLInputDataReader>();
// using (var reader = XmlReader.Create(jobFile))
// {
// if (localName == XMLNames.VectoPrimaryVehicleReport)
// return CreatePrimaryBusVehicleViewModel(xmlInputReader.Create(reader));
// if (localName == XMLNames.VectoInputDeclaration)
// {
// var readerResult = xmlInputReader.Create(reader) as IDeclarationInputDataProvider;
// if(readerResult?.JobInputData.Vehicle is XMLDeclarationCompletedBusDataProviderV26)
// return CreateCompleteBusVehicleViewModel(readerResult);
// }
// }
// }
// return null;
//}
//private string GetLocalName(string jobFilePath)
//{
// var doc = XDocument.Load(jobFilePath);
// return doc.Root?.Name.LocalName;
//}
//private IJobEditViewModel CreateCompleteBusVehicleViewModel(IDeclarationInputDataProvider dataProvider)
//{
// _messages.Add(new MessageEntry {
// Message = "Edit File"
// });
// return dataProvider == null ? null : new CompleteVehicleBusJobViewModel(Kernel, dataProvider);
//}
//private IJobEditViewModel CreatePrimaryBusVehicleViewModel(IInputDataProvider inputData)
//{
// var dataProvider = inputData as IPrimaryVehicleInformationInputDataProvider;
// return dataProvider == null ? null : new PrimaryVehicleBusJobViewModel(Kernel, dataProvider);
//}
}
private bool IsNewJobFile(string filePath)
{
if (!_jobs.IsNullOrEmpty()) {
for (int i = 0; i < _jobs.Count; i++) {
if (_jobs[i].JobEntryFilePath == filePath)
return false;
}
}
return true;
}
}
}
......@@ -18,10 +18,10 @@ namespace VECTO3GUI.ViewModel.Interfaces
ICommand StartSimulation { get; }
ICommand EditJob { get; }
ICommand EditCompletedFile { get; }
ICommand JobEntrySetActive { get; }
ICommand CreateNewJob { get; }
ICommand OpenJob { get; }
ICommand OpenSettings { get; }
ICommand ExitMainCommand { get; }
ICommand OpenInFolder { get; }
}
}
......@@ -3,12 +3,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:viewModel="clr-namespace:VECTO3GUI.ViewModel"
xmlns:helper="clr-namespace:VECTO3GUI.Helper"
xmlns:impl="clr-namespace:VECTO3GUI.ViewModel.Impl"
xmlns:interfaces="clr-namespace:VECTO3GUI.ViewModel.Interfaces"
xmlns:views="clr-namespace:VECTO3GUI.Views"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="600"
......@@ -33,12 +30,33 @@
<Grid Grid.Row="1" Grid.Column="0">
<Button VerticalAlignment="Top" Margin="10,40,0,0">
<StackPanel Orientation="Horizontal">
<iconPacks:PackIconModern Width="20" Height="15" Kind="ControlPlay" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Green"/>
<TextBlock Text="Start " />
<StackPanel Orientation="Vertical">
<Button VerticalAlignment="Top" Margin="10,10,0,0">
<StackPanel Orientation="Horizontal">
<iconPacks:PackIconModern Width="20" Height="15" Kind="ControlPlay" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Green"/>
<TextBlock Text="Start " />
</StackPanel>
</Button>
<StackPanel Orientation="Vertical" HorizontalAlignment="Right" Margin="0,10,0,0">
<Button Width="25"
Command="{Binding MoveJobUp}"
CommandParameter="{Binding ElementName=JobList, Path=SelectedItem}">
<StackPanel Orientation="Horizontal">
<iconPacks:PackIconModern Width="15" Height="15" Kind="ArrowUp" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Green"/>
</StackPanel>
</Button>
<Button Width="25" Margin="0,5,0,0"
Command="{Binding MoveJobDown}"
CommandParameter="{Binding ElementName=JobList, Path=SelectedItem}">
<StackPanel Orientation="Horizontal">
<iconPacks:PackIconModern Width="15" Height="15" Kind="ArrowDown" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Green"/>
</StackPanel>
</Button>
</StackPanel>
</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.Column="1" Margin="10">
......@@ -50,17 +68,47 @@
<DataGrid.Resources>
<ContextMenu x:Key="RowMenu">
<MenuItem Header="View File" Command="{Binding DataContext.OpenJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/>
<MenuItem Header="Edit File" Command="{Binding DataContext.EditJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/>
<MenuItem Header="{Binding DataContext.FirstContextMenu, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"
Command="{Binding DataContext.OpenJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"
CommandParameter="{Binding Source={x:Static impl:JobFileType.PrimaryBusFile}}"/>
<MenuItem Header="View Completed Bus File"
Command="{Binding DataContext.OpenJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"
CommandParameter="{Binding Source={x:Static impl:JobFileType.CompletedBusFile}}"/>
<Separator HorizontalAlignment="Stretch" Background="Gray"/>
<MenuItem Header="Remove File" Command="{Binding DataContext.RemoveJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/>
<MenuItem Header="Edit Job"
Command="{Binding DataContext.EditJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"
CommandParameter="{Binding DataContext.SelectedJobEntry, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/>
<MenuItem Header="Edit Completed File"
Command="{Binding DataContext.EditCompletedFile, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"
CommandParameter="{Binding DataContext.SelectedJobEntry, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/>
<Separator HorizontalAlignment="Stretch" Background="Gray"/>
<MenuItem Header="Show In Folder"
Command="{Binding DataContext.OpenInFolder, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"
CommandParameter="{Binding DataContext.SelectedJobEntry, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/>
<Separator HorizontalAlignment="Stretch" Background="Gray"/>
<MenuItem Header="Remove Job"
Command="{Binding DataContext.RemoveJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"
CommandParameter="{Binding DataContext.SelectedJobEntry, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/>
</ContextMenu>
</DataGrid.Resources>
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem Header="Add File" Command="{Binding AddJob}"/>
<MenuItem Header="New File" Command="{Binding CreateNewJob}"/>
<MenuItem Header="Add Job" Command="{Binding AddJob}"
CommandParameter="{Binding ElementName=JobList, Path=SelectedItem}"/>
<Separator HorizontalAlignment="Stretch" Background="Gray"/>
<MenuItem Header="Create Single Bus Job"
Command="{Binding AddBusJob}" CommandParameter="{Binding Source={x:Static impl:JobType.SingleBusJob}}"/>
<MenuItem Header="Create Completed Bus Job"
Command="{Binding AddBusJob}" CommandParameter="{Binding Source={x:Static impl:JobType.CompletedBusJob}}"/>
<MenuItem Header="Create Completed XML"
Command="{Binding CreateNewJob}"/>
<Separator HorizontalAlignment="Stretch" Background="Gray"/>
<MenuItem Header="Remove All" Command="{Binding RemoveAllJobs}"/>
</ContextMenu>
......@@ -83,24 +131,25 @@
</Grid>
<Grid Grid.Row="1" Grid.Column="2" Margin="0,0,10,0">
<StackPanel Orientation="Vertical" Margin="0,30,0,0">
<Button Margin="0,5,0,0" Content="Edit Job" Width="110"
<StackPanel Orientation="Vertical" Margin="0,30,0,0" Width="105">
<Button Margin="0,5,0,0" Content="Add Job"
Command="{Binding AddJob}"/>
<Button Margin="0,5,0,0" Content="Edit Job"
Command="{Binding EditJob}"
CommandParameter="{Binding ElementName=JobList, Path=SelectedItem}"/>
<Button Margin="0,5,0,0" Content="Edit Completed File" Width="110"
Command="{Binding EditCompletedFile}"
CommandParameter="{Binding ElementName=JobList, Path=SelectedItem}" />
<Button Margin="0,5,0,0" Content="Remove Job"
Command="{Binding RemoveJob}"
CommandParameter="{Binding ElementName=JobList, Path=SelectedItem}"/>
<!--<Button Margin="0,5,0,0" Command="{Binding AddBusJob}" Content="Add Bus Job"/>
<Button Margin="0,5,0,0" Command="{Binding EditJob}" Content="Edit File" />
<Button Margin="0,5,0,0" Command="{Binding CreateNewJob}" Content="New File" />
<Button Margin="0,5,0,0" Command="{Binding RemoveJob}" Content="Remove File" />-->
<Button Margin="0,5,0,0" Content="Edit Completed File"
Command="{Binding EditCompletedFile}"
CommandParameter="{Binding ElementName=JobList, Path=SelectedItem}"/>
</StackPanel>
</Grid>
<Grid Grid.Row="2" Grid.ColumnSpan="3" Margin="10,20,20,10">
<Grid Grid.Row="2" Grid.ColumnSpan="3" Grid.Column="0" Margin="10,20,20,10">
<DataGrid ItemsSource="{Binding Messages}" BorderThickness="1" CanUserAddRows="False" AutoGenerateColumns="False" SelectionUnit="FullRow"
IsReadOnly="True" HeadersVisibility="All" RowHeaderWidth="5">
......
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