diff --git a/VECTO3GUI/VECTO3GUI.csproj b/VECTO3GUI/VECTO3GUI.csproj index 3302fc1ff60c36da037cf072468a5133e01bdc0f..b317f30f7d4bb8f3d64f2d942b8f393a1c80e18d 100644 --- a/VECTO3GUI/VECTO3GUI.csproj +++ b/VECTO3GUI/VECTO3GUI.csproj @@ -201,6 +201,7 @@ <Compile Include="ViewModel\Impl\AxlegearViewModel.cs" /> <Compile Include="ViewModel\Impl\AxlesViewModel.cs" /> <Compile Include="ViewModel\Impl\AxleViewModel.cs" /> + <Compile Include="ViewModel\Impl\BusJobViewModel.cs" /> <Compile Include="ViewModel\Impl\CompleteVehicleBusJobViewModel.cs" /> <Compile Include="ViewModel\Impl\CompleteVehicleBusViewModel.cs" /> <Compile Include="ViewModel\Impl\CyclesViewModel.cs" /> @@ -211,6 +212,7 @@ <Compile Include="ViewModel\Impl\JobEntry.cs" /> <Compile Include="ViewModel\Impl\JoblistViewModel.cs" /> <Compile Include="ViewModel\Impl\MainWindowViewModel.cs" /> + <Compile Include="ViewModel\Impl\MessageEntry.cs" /> <Compile Include="ViewModel\Impl\NoneViewModel.cs" /> <Compile Include="ViewModel\Impl\ObservableObject.cs" /> <Compile Include="ViewModel\Impl\OutputWindowViewModel.cs" /> @@ -256,6 +258,9 @@ <Compile Include="ViewModel\Interfaces\SteeringPumpEntry.cs" /> <Compile Include="ViewModel\Interfaces\TorqueConverterCharacteristics.cs" /> <Compile Include="ViewModel\Interfaces\TorqueEntry.cs" /> + <Compile Include="Views\BusJobView.xaml.cs"> + <DependentUpon>BusJobView.xaml</DependentUpon> + </Compile> <Compile Include="Views\ComponentViews\Declaration\AirdragDeclarationView.xaml.cs"> <DependentUpon>AirdragDeclarationView.xaml</DependentUpon> </Compile> @@ -409,6 +414,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="Views\BusJobView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\ComponentViews\Declaration\AirdragDeclarationView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> diff --git a/VECTO3GUI/ViewModel/Impl/BusJobViewModel.cs b/VECTO3GUI/ViewModel/Impl/BusJobViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..ea0898ad578ad45264caf7f7f8910342f2051eb1 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/BusJobViewModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VECTO3GUI.ViewModel.Impl +{ + public class BusJobViewModel : ObservableObject + { + } +} diff --git a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs index 66026a030772e5882c7acc23b439a5ccae277456..f5c52e837d3f5ef80c774860e98b2bef50a97ad6 100644 --- a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs @@ -234,6 +234,7 @@ namespace VECTO3GUI.ViewModel.Impl public AllowedEntry<VehicleCode>[] AllowedVehicleCodes { get; private set; } public AllowedEntry<FloorType>[] AllowedFloorTypes { get; private set; } public AllowedEntry<ConsumerTechnology>[] AllowedConsumerTechnologies { get; private set; } + public AllowedEntry<RegistrationClass>[] AllowedRegisteredClasses { get; private set; } #endregion @@ -288,11 +289,19 @@ namespace VECTO3GUI.ViewModel.Impl AllowedVehicleCodes = Enum.GetValues(typeof(VehicleCode)).Cast<VehicleCode>() .Select(vc => AllowedEntry.Create(vc, vc.GetLabel())).ToArray(); - AllowedFloorTypes = Enum.GetValues(typeof(FloorType)).Cast<FloorType>() - .Select(ft => AllowedEntry.Create(ft, ft.GetLabel())).ToArray(); + var highFloor = AllowedEntry.Create(FloorType.HighFloor, FloorType.HighFloor.GetLabel()); + var lowFloor = AllowedEntry.Create(FloorType.LowFloor, FloorType.LowFloor.GetLabel()); + AllowedFloorTypes = new []{ highFloor, lowFloor }; AllowedConsumerTechnologies = Enum.GetValues(typeof(ConsumerTechnology)).Cast<ConsumerTechnology>() .Select(sc => AllowedEntry.Create(sc, sc.GetLabel())).ToArray(); + + AllowedRegisteredClasses = Enum.GetValues(typeof(RegistrationClass)).Cast<RegistrationClass>() + .Select(vc => AllowedEntry.Create(vc, vc.GetLabel())).ToArray(); + + AllowedRegisteredClasses = + AllowedRegisteredClasses.Where(val => val.Value != RegistrationClass.unknown).ToArray(); + } #endregion diff --git a/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs index 132f68b069fd38d00f7a5114fee105f5684f82fa..e91caa0dd93d16b17adb950961d8b49590597937 100644 --- a/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs @@ -21,6 +21,7 @@ using VECTO3GUI.Util; using VECTO3GUI.ViewModel.Interfaces; using System.Xml; using System.Xml.Linq; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; using TUGraz.VectoCommon.Resources; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider; using VECTO3GUI.Helper; @@ -35,6 +36,7 @@ namespace VECTO3GUI.ViewModel.Impl #region Members protected readonly ObservableCollection<JobEntry> _jobs = new ObservableCollection<JobEntry>(); + protected readonly ObservableCollection<MessageEntry> _messages = new ObservableCollection<MessageEntry>(); private readonly SettingsModel _settings; private JobEntry _selectedJobEntry; @@ -53,6 +55,7 @@ namespace VECTO3GUI.ViewModel.Impl private ICommand _openSettingsCommand; private ICommand _exitCommand; private ICommand _exitMainCommand; + private ICommand _addBusJobCommand; #endregion @@ -69,6 +72,11 @@ namespace VECTO3GUI.ViewModel.Impl get { return _jobs; } } + public ObservableCollection<MessageEntry> Messages + { + get { return _messages; } + } + #endregion @@ -205,8 +213,7 @@ namespace VECTO3GUI.ViewModel.Impl { get { - return _addJobCommand ?? - (_addJobCommand = new RelayCommand(DoAddJob)); + return _addJobCommand ?? (_addJobCommand = new RelayCommand(DoAddJob)); } } private void DoAddJob() @@ -253,6 +260,22 @@ namespace VECTO3GUI.ViewModel.Impl window?.Close(); } + public ICommand AddBusJob + { + get + { + return _addBusJobCommand ?? + (_addBusJobCommand = new RelayCommand(DoAddBusJobCommand)); + } + } + + private void DoAddBusJobCommand() + { + var viewModel = new BusJobViewModel(); + var window = OutputWindowHelper.CreateOutputWindow(Kernel, viewModel, "Create Bus Job"); + window.ShowDialog(); + } + public ICommand MoveJobUp { get { return new RelayCommand(() => { }, () => false); } } public ICommand MoveJobDown { get { return new RelayCommand(() => { }, () => false); } } @@ -301,6 +324,11 @@ namespace VECTO3GUI.ViewModel.Impl private IJobEditViewModel CreateCompleteBusVehicleViewModel(IDeclarationInputDataProvider dataProvider) { + + + _messages.Add(new MessageEntry { + Message = "Edit File" + }); return dataProvider == null ? null : new CompleteVehicleBusJobViewModel(Kernel, dataProvider); } diff --git a/VECTO3GUI/ViewModel/Impl/MessageEntry.cs b/VECTO3GUI/ViewModel/Impl/MessageEntry.cs new file mode 100644 index 0000000000000000000000000000000000000000..dc8ed960fb1fb0bc7c03e94165f852c36da48187 --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/MessageEntry.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VECTO3GUI.ViewModel.Impl +{ + public class MessageEntry : ObservableObject + { + private string _message; + private DateTime _time; + private string _source; + + public string Message + { + get { return _message; } + set { SetProperty(ref _message, value); } + } + + public DateTime Time + { + get { return _time; } + set { SetProperty(ref _time, value); } + } + public string Source + { + get { return _source; } + set { SetProperty(ref _source, value); } + } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs index 7e336b4a3491903c56f3401b163b81078d444aa4..5a473c45dd18ba098acc90c38652b491fed9defe 100644 --- a/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs +++ b/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs @@ -12,5 +12,6 @@ namespace VECTO3GUI.ViewModel.Interfaces AllowedEntry<VehicleCode>[] AllowedVehicleCodes { get; } AllowedEntry<FloorType>[] AllowedFloorTypes { get; } AllowedEntry<ConsumerTechnology>[] AllowedConsumerTechnologies { get; } + AllowedEntry<RegistrationClass>[] AllowedRegisteredClasses { get; } } } diff --git a/VECTO3GUI/ViewModel/Interfaces/IJoblistViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IJoblistViewModel.cs index 3b16cff796cab12fa982090b87bf8ed3ac159511..4c0f44b9c7bda3d33d2b5f5f1db8e14c78c3000c 100644 --- a/VECTO3GUI/ViewModel/Interfaces/IJoblistViewModel.cs +++ b/VECTO3GUI/ViewModel/Interfaces/IJoblistViewModel.cs @@ -7,6 +7,8 @@ namespace VECTO3GUI.ViewModel.Interfaces public interface IJoblistViewModel : IMainView { ObservableCollection<JobEntry> Jobs { get; } + ObservableCollection<MessageEntry> Messages { get; } + ICommand AddBusJob { get; } ICommand AddJob { get; } ICommand RemoveJob { get; } ICommand RemoveAllJobs { get; } diff --git a/VECTO3GUI/Views/BusJobView.xaml b/VECTO3GUI/Views/BusJobView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..f800ed32def7437fa0ba3b5e915b6a0e547b5de0 --- /dev/null +++ b/VECTO3GUI/Views/BusJobView.xaml @@ -0,0 +1,61 @@ +<UserControl x:Class="VECTO3GUI.Views.BusJobView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + 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:local="clr-namespace:VECTO3GUI.Views" + mc:Ignorable="d" + d:DesignHeight="200" d:DesignWidth="440"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition/> + <RowDefinition Height="40"/> + </Grid.RowDefinitions> + + <Grid Grid.Row="0" > + <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> + + <StackPanel Orientation="Horizontal"> + <ComboBox DataContext="{Binding }"/> + </StackPanel> + + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <TextBlock Text="Default Save Path Location: " Margin="5,0,0,0"/> + <TextBox Width="200" Margin="0,0,5,0" IsReadOnly="True" IsReadOnlyCaretVisible="True" + Text="{Binding SavePathFolder}"/> + <Button Content="..." Width="30" + Command="{Binding OpenSaveFolderCommand}" + CommandParameter="{Binding SavePathFolder}"/> + </StackPanel> + + <StackPanel Orientation="Horizontal" Margin="0,5,0,0"> + <TextBlock Text="Default XML-Files Location: " Margin="5,0,0,0"/> + <TextBox Width="200" Margin="0,0,5,0" IsReadOnly="True" IsReadOnlyCaretVisible="True" + Text="{Binding XMLFilePath}"/> + <Button Content="..." Width="30" + Command="{Binding OpenXMLFolderCommand}" + CommandParameter="{Binding XMLFilePath}"/> + </StackPanel> + </StackPanel> + </Grid> + + <Grid Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition/> + <ColumnDefinition/> + </Grid.ColumnDefinitions> + + <Button Content="Reset" HorizontalAlignment="Left" Width="80" Margin="10,0,0,0" + Command="{Binding ResetCommand}"/> + + <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right"> + <Button Content="Save" HorizontalAlignment="Right" Margin="5,0,0,0" VerticalAlignment="Center" Width="70" + Command="{Binding SaveCommand}"/> + <Button Content="Cancel" HorizontalAlignment="Right" Margin="5,0,10,0" Width="70" + Command="{Binding CancelCommand}" + CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/> + </StackPanel> + </Grid> + + </Grid> +</UserControl> diff --git a/VECTO3GUI/Views/BusJobView.xaml.cs b/VECTO3GUI/Views/BusJobView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..f40d8c1881d2a1e5aae4873615fd98cc506b93fc --- /dev/null +++ b/VECTO3GUI/Views/BusJobView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace VECTO3GUI.Views +{ + /// <summary> + /// Interaction logic for BusJobView.xaml + /// </summary> + public partial class BusJobView : UserControl + { + public BusJobView() + { + InitializeComponent(); + } + } +} diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml index 165e49e416a963645998963965855a388abe0ef6..0ba6e184858a7bc21235e43719a6541b17dcd22f 100644 --- a/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml +++ b/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml @@ -50,7 +50,7 @@ <DataGrid x:Name="AlternatorDataGrid" AutoGenerateColumns="False" ColumnWidth="*" IsReadOnly="False" CanUserAddRows="False" VerticalAlignment="Top" - HeadersVisibility="All" RowHeaderWidth="10" Height="150" Margin="0,10,0,0" + HeadersVisibility="All" RowHeaderWidth="10" Height="150" Margin="0,10,0,0" BorderThickness="1" ItemsSource="{Binding AlternatorTechnologies}"> <DataGrid.Resources> diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/CompleteVehicleBusView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/CompleteVehicleBusView.xaml index 4deebd40f8da046bcfa002baa84543e7df072bf9..35b62657adccf57ebd938b1285db56cfa3802681 100644 --- a/VECTO3GUI/Views/ComponentViews/Declaration/CompleteVehicleBusView.xaml +++ b/VECTO3GUI/Views/ComponentViews/Declaration/CompleteVehicleBusView.xaml @@ -9,7 +9,7 @@ xmlns:helper="clr-namespace:VECTO3GUI.Helper" xmlns:converter="clr-namespace:VECTO3GUI.Helper.Converter" mc:Ignorable="d" - d:DesignHeight="500" d:DesignWidth="500"> + d:DesignHeight="800" d:DesignWidth="500"> <d:PrimaryVehicleBusView.DataContext> <x:Type Type="interfaces:ICompleteVehicleBusViewModel" /> @@ -27,8 +27,8 @@ <RowDefinition/> </Grid.RowDefinitions> - <GroupBox Header="Vehicle Data" Grid.Row="1" Grid.Column="1" Width="420" HorizontalAlignment="Left"> - <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True"> + <GroupBox Header="Vehicle Data" Grid.Row="1" Grid.Column="1" Width="420" Height="650" HorizontalAlignment="Left" VerticalAlignment="Top"> + <StackPanel Orientation="Vertical" Width="400" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True" VerticalAlignment="Center"> <StackPanel Orientation="Vertical" DockPanel.Dock="Top" Grid.IsSharedSizeScope="True"> <customControls:VectoParameterControl @@ -50,9 +50,16 @@ Value="{Binding LegislativeClass}" AllowedValues="{Binding AllowedLegislativeClasses}" /> - <customControls:VectoParameterControl + <!--<customControls:VectoParameterControl Caption="Registered Class" Unit="" CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" - Value="{Binding RegisteredClass}" /> + Value="{Binding RegisteredClass}"/>--> + + <customControls:ComboParameter + Caption="Vehicle Code" + CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" + Value="{Binding RegisteredClass}" + AllowedValues="{Binding AllowedRegisteredClasses}" /> + <customControls:ComboParameter Caption="Vehicle Code" diff --git a/VECTO3GUI/Views/JoblistView.xaml b/VECTO3GUI/Views/JoblistView.xaml index 990e7fbb5f4778db4ec5b5ee610d4bd12615981e..2c20a766c37c5aaf73caf3c7d641b513a9e0cf9f 100644 --- a/VECTO3GUI/Views/JoblistView.xaml +++ b/VECTO3GUI/Views/JoblistView.xaml @@ -26,6 +26,7 @@ <Grid.RowDefinitions> <RowDefinition Height="30"/> <RowDefinition/> + <RowDefinition/> <RowDefinition Height="30"/> </Grid.RowDefinitions> @@ -73,12 +74,27 @@ <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" 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" /> </StackPanel> + </Grid> + + <Grid Grid.Row="2" Grid.ColumnSpan="3" Margin="10,20,20,10"> + <DataGrid ItemsSource="{Binding Messages}" BorderThickness="1" CanUserAddRows="False" AutoGenerateColumns="False" SelectionUnit="FullRow" + IsReadOnly="True" HeadersVisibility="All" RowHeaderWidth="5"> + + <DataGrid.Columns> + <DataGridTextColumn Header="Message" Binding="{Binding Message}" Width="*" /> + <DataGridTextColumn Header="Time" Binding="{Binding Time}" Width="130" /> + <DataGridTextColumn Header="Source" Binding="{Binding Source}" Width="150" /> + </DataGrid.Columns> + + </DataGrid> </Grid> + </Grid> diff --git a/VECTO3GUI/Views/OutputWindow.xaml b/VECTO3GUI/Views/OutputWindow.xaml index eed4a86f665aae4ee1cfd754ed5696b81c8a4ed8..8bad3430b2c056566be50497e7d057a093095a78 100644 --- a/VECTO3GUI/Views/OutputWindow.xaml +++ b/VECTO3GUI/Views/OutputWindow.xaml @@ -26,7 +26,18 @@ <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> + <Grid.RowDefinitions> + <RowDefinition/> + <RowDefinition Height="10"/> + </Grid.RowDefinitions> + + <Grid Grid.Row="0"> <ContentControl Content="{Binding ViewModel}" /> + </Grid> + + <Grid Grid.Row="1"> + <StatusBar/> + </Grid> </Grid> </mah:MetroWindow> diff --git a/VectoCommon/VectoCommon/BusAuxiliaries/FloorType.cs b/VectoCommon/VectoCommon/BusAuxiliaries/FloorType.cs index de46b38bbc9b5ee365fb6ea43c40ff30986b9459..9f9553a08266a7a8fec1fc6f9278c2ceea5e9aab 100644 --- a/VectoCommon/VectoCommon/BusAuxiliaries/FloorType.cs +++ b/VectoCommon/VectoCommon/BusAuxiliaries/FloorType.cs @@ -15,19 +15,15 @@ namespace TUGraz.VectoCommon.BusAuxiliaries { { switch (self) { - case FloorType.Unknown: - return "Unknown"; + case FloorType.SemiLowFloor: case FloorType.LowFloor: return "Low Floor"; case FloorType.HighFloor: return "High Floor"; - case FloorType.SemiLowFloor: - return "Semi Low Floor"; default: - throw new ArgumentOutOfRangeException(nameof(self), self, null); + return "Unknown"; + } } - - } } \ No newline at end of file