From cfea2168e19bcc10a8663be20f29035bfc96a1e1 Mon Sep 17 00:00:00 2001 From: "VKMTHD\\franzjosefkober" <franz.josef.kober@ivt.tugraz.at> Date: Fri, 10 Apr 2020 16:49:28 +0200 Subject: [PATCH] extended vecto gui code --- VECTO3GUI/App.xaml | 2 +- VECTO3GUI/Helper/FileDialogHelper.cs | 3 + VECTO3GUI/Helper/OutputWindowHelper.cs | 30 ++++++++ VECTO3GUI/MainWindow.xaml | 2 +- VECTO3GUI/Resources/GlobalStyles.xaml | 13 ++++ VECTO3GUI/VECTO3GUI.csproj | 13 ++++ VECTO3GUI/ViewModel/Impl/AbstractViewModel.cs | 7 ++ VECTO3GUI/ViewModel/Impl/AirdragViewModel.cs | 16 +++++ .../ViewModel/Impl/AuxiliariesViewModel.cs | 40 ++++++++++- .../Impl/CompleteVehicleBusViewModel.cs | 35 ++++++++- VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs | 29 +++++++- .../ViewModel/Impl/OutputWindowViewModel.cs | 21 ++++++ .../Interfaces/IComponentViewModel.cs | 2 + VECTO3GUI/Views/JoblistView.xaml | 71 +++++++------------ VECTO3GUI/Views/JoblistView.xaml.cs | 17 ----- VECTO3GUI/Views/OutputWindow.xaml | 18 +++++ VECTO3GUI/Views/OutputWindow.xaml.cs | 28 ++++++++ 17 files changed, 272 insertions(+), 75 deletions(-) create mode 100644 VECTO3GUI/Helper/OutputWindowHelper.cs create mode 100644 VECTO3GUI/Resources/GlobalStyles.xaml create mode 100644 VECTO3GUI/ViewModel/Impl/OutputWindowViewModel.cs create mode 100644 VECTO3GUI/Views/OutputWindow.xaml create mode 100644 VECTO3GUI/Views/OutputWindow.xaml.cs diff --git a/VECTO3GUI/App.xaml b/VECTO3GUI/App.xaml index 01e1e46fcc..9b382c0861 100644 --- a/VECTO3GUI/App.xaml +++ b/VECTO3GUI/App.xaml @@ -44,7 +44,7 @@ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/baselight.xaml" /> - + <ResourceDictionary Source="Resources/GlobalStyles.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> diff --git a/VECTO3GUI/Helper/FileDialogHelper.cs b/VECTO3GUI/Helper/FileDialogHelper.cs index 47e066ef55..8baf328f12 100644 --- a/VECTO3GUI/Helper/FileDialogHelper.cs +++ b/VECTO3GUI/Helper/FileDialogHelper.cs @@ -13,6 +13,8 @@ namespace VECTO3GUI.Helper { public static class FileDialogHelper { + private const string XMLFilter = "XML Files (*.xml)|*.xml|All Files (*.*)|*.*"; + public static string[] ShowSelectFilesDialog(bool multiselect, string initialDirectory = null) { @@ -20,6 +22,7 @@ namespace VECTO3GUI.Helper { openFileDialog.InitialDirectory = initialDirectory; openFileDialog.Multiselect = multiselect; + openFileDialog.Filter = XMLFilter; var result = openFileDialog.ShowDialog(); if (result == DialogResult.OK) diff --git a/VECTO3GUI/Helper/OutputWindowHelper.cs b/VECTO3GUI/Helper/OutputWindowHelper.cs new file mode 100644 index 0000000000..f8bd33680c --- /dev/null +++ b/VECTO3GUI/Helper/OutputWindowHelper.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Ninject; +using VECTO3GUI.ViewModel.Impl; +using VECTO3GUI.Views; + +namespace VECTO3GUI.Helper +{ + + public static class OutputWindowHelper + { + public static OutputWindow CreateOutputWindow(IKernel kernel, object viewModel, + double width = default(double), double height= default(double)) + { + var window = new OutputWindow { + DataContext = new OutputWindowViewModel(kernel, viewModel) + }; + + if (Math.Abs(width - default(double)) > 0 ) + window.Width = width; + if (Math.Abs(height - default(double)) > 0) + window.Height = height; + + return window; + } + } +} diff --git a/VECTO3GUI/MainWindow.xaml b/VECTO3GUI/MainWindow.xaml index ca19680d18..92626265c4 100644 --- a/VECTO3GUI/MainWindow.xaml +++ b/VECTO3GUI/MainWindow.xaml @@ -8,7 +8,7 @@ xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" xmlns:impl="clr-namespace:VECTO3GUI.ViewModel.Impl" mc:Ignorable="d" - Title="VECTO 3" Height="515.36" Width="972.48" + Title="VECTO 3" Height="515.36" Width="972.48" WindowStartupLocation="CenterScreen" d:DataContext="{d:DesignInstance Type=impl:MainWindowViewModel, IsDesignTimeCreatable=False}"> <Grid> diff --git a/VECTO3GUI/Resources/GlobalStyles.xaml b/VECTO3GUI/Resources/GlobalStyles.xaml new file mode 100644 index 0000000000..42b63c4ea4 --- /dev/null +++ b/VECTO3GUI/Resources/GlobalStyles.xaml @@ -0,0 +1,13 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:VECTO3GUI.Resources" + xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"> + + <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MetroDataGridColumnHeader}"> + <Setter Property="mah:ControlsHelper.ContentCharacterCasing" Value="Normal"/> + </Style> + + <Style TargetType="{x:Type Button}" BasedOn="{StaticResource MetroButton}"> + <Setter Property="mah:ControlsHelper.ContentCharacterCasing" Value="Normal"/> + </Style> +</ResourceDictionary> \ No newline at end of file diff --git a/VECTO3GUI/VECTO3GUI.csproj b/VECTO3GUI/VECTO3GUI.csproj index 81a82ea874..08846c3577 100644 --- a/VECTO3GUI/VECTO3GUI.csproj +++ b/VECTO3GUI/VECTO3GUI.csproj @@ -155,6 +155,7 @@ <SubType>Designer</SubType> </ApplicationDefinition> <Compile Include="Helper\FileDialogHelper.cs" /> + <Compile Include="Helper\OutputWindowHelper.cs" /> <Compile Include="Model\InterfacesImpl.cs" /> <Compile Include="Util\AllowedEntry.cs" /> <Compile Include="Util\Component.cs" /> @@ -198,6 +199,7 @@ <Compile Include="ViewModel\Impl\MainWindowViewModel.cs" /> <Compile Include="ViewModel\Impl\NoneViewModel.cs" /> <Compile Include="ViewModel\Impl\ObservableObject.cs" /> + <Compile Include="ViewModel\Impl\OutputWindowViewModel.cs" /> <Compile Include="ViewModel\Impl\PrimaryVehicleBusJobViewModel.cs" /> <Compile Include="ViewModel\Impl\PrimaryVehicleBusViewModel.cs" /> <Compile Include="ViewModel\Impl\RetarderViewModel.cs" /> @@ -349,6 +351,9 @@ <Compile Include="Views\JobView.xaml.cs"> <DependentUpon>JobView.xaml</DependentUpon> </Compile> + <Compile Include="Views\OutputWindow.xaml.cs"> + <DependentUpon>OutputWindow.xaml</DependentUpon> + </Compile> <Page Include="MainWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -367,6 +372,10 @@ <DependentUpon>MainWindow.xaml</DependentUpon> <SubType>Code</SubType> </Compile> + <Page Include="Resources\GlobalStyles.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Resources\ViewModelMappings.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -523,6 +532,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="Views\OutputWindow.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> diff --git a/VECTO3GUI/ViewModel/Impl/AbstractViewModel.cs b/VECTO3GUI/ViewModel/Impl/AbstractViewModel.cs index 3568cc3be7..de1347140c 100644 --- a/VECTO3GUI/ViewModel/Impl/AbstractViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/AbstractViewModel.cs @@ -3,6 +3,7 @@ using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; using TUGraz.VectoCommon.InputData; using VECTO3GUI.ViewModel.Interfaces; using Component = VECTO3GUI.Util.Component; @@ -63,6 +64,12 @@ namespace VECTO3GUI.ViewModel.Impl return null; } + public virtual bool AnyDataChanges() + { + return true; + } + + #region Submodule Handling protected IEnumerable<Component> GetSubmodels() { diff --git a/VECTO3GUI/ViewModel/Impl/AirdragViewModel.cs b/VECTO3GUI/ViewModel/Impl/AirdragViewModel.cs index bfb81fe4b7..1feea31613 100644 --- a/VECTO3GUI/ViewModel/Impl/AirdragViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/AirdragViewModel.cs @@ -13,6 +13,7 @@ namespace VECTO3GUI.ViewModel.Impl private SquareMeter _declaredCdxA; private bool _useStandardValues; private string _appVersion; + private IAirdragDeclarationInputData _airdragData; #region Implementation of IAirdragViewModel @@ -74,5 +75,20 @@ namespace VECTO3GUI.ViewModel.Impl AppVersion = airdrag.AppVersion; DeclaredCdxA = airdrag.AirDragArea; } + + public override bool AnyDataChanges() + { + if(_airdragData == null) + return base.AnyDataChanges(); + + var changed = _airdragData.Model != Model || + _airdragData.Manufacturer != Manufacturer || + _airdragData.CertificationNumber != CertificationNumber || + _airdragData.Date != Date || + _airdragData.AppVersion != AppVersion || + _airdragData.AirDragArea != DeclaredCdxA; + + return changed; + } } } diff --git a/VECTO3GUI/ViewModel/Impl/AuxiliariesViewModel.cs b/VECTO3GUI/ViewModel/Impl/AuxiliariesViewModel.cs index b7922c03eb..ae180a1ac6 100644 --- a/VECTO3GUI/ViewModel/Impl/AuxiliariesViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/AuxiliariesViewModel.cs @@ -32,6 +32,7 @@ namespace VECTO3GUI.ViewModel.Impl private string _hvacTechnology; private readonly ObservableCollection<SteeringPumpEntry> _steeringPumpTechnologies = new ObservableCollection<SteeringPumpEntry>(); private IAxlesViewModel axlesViewModel; + private IBusAuxiliariesDeclarationData _busAuxiliaries; private ObservableCollection<string> _alternatorTechnologies; private bool _dayRunningLightsLED; @@ -217,9 +218,11 @@ namespace VECTO3GUI.ViewModel.Impl // .If<IDeclarationInputDataProvider>(d => SetValues(d.JobInputData.Vehicle.Components.AuxiliaryInputData())) // .If<IEngineeringInputDataProvider>(e => SetValues(e.JobInputData.Vehicle.Components.AuxiliaryInputData())); - if (inputData?.JobInputData?.Vehicle?.Components?.BusAuxiliaries != null) + if (inputData?.JobInputData?.Vehicle?.Components?.BusAuxiliaries != null) { SetValues(inputData.JobInputData.Vehicle.Components.BusAuxiliaries); - + _busAuxiliaries = inputData.JobInputData.Vehicle.Components.BusAuxiliaries; + } + ConnectAxleViewModel(); } @@ -284,7 +287,7 @@ namespace VECTO3GUI.ViewModel.Impl { if (!busAux.ElectricSupply.Alternators.IsNullOrEmpty()) { AlternatorTechnologies = new ObservableCollection<string>(); - + for (int i = 0; i < busAux.ElectricSupply.Alternators.Count; i++) { AlternatorTechnologies.Add(busAux.ElectricSupply.Alternators[i].Technology); } @@ -323,5 +326,36 @@ namespace VECTO3GUI.ViewModel.Impl AllowedConsumerTechnologies = Enum.GetValues(typeof(ConsumerTechnology)).Cast<ConsumerTechnology>() .Select(sc => AllowedEntry.Create(sc, sc.GetLabel())).ToArray(); } + + public override bool AnyDataChanges() + { + if(_busAuxiliaries == null) + return base.AnyDataChanges(); + + bool changed; + + if (!_busAuxiliaries.ElectricSupply.Alternators.IsNullOrEmpty()) { + //ToDo + //Changed Event?! + } + + + changed = _busAuxiliaries.ElectricConsumers.DayrunninglightsLED != DayrunninglightsLED || + _busAuxiliaries.ElectricConsumers.HeadlightsLED != HeadlightsLED || + _busAuxiliaries.ElectricConsumers.PositionlightsLED != PositionlightsLED || + _busAuxiliaries.ElectricConsumers.BrakelightsLED != BrakelightsLED || + _busAuxiliaries.ElectricConsumers.InteriorLightsLED != InteriorLightsLED || + _busAuxiliaries.PneumaticConsumers.DoorDriveTechnology != DoorDriveTechnology || + _busAuxiliaries.HVACAux.SystemConfiguration != SystemConfiguration || + _busAuxiliaries.HVACAux.CompressorTypeDriver != CompressorTypeDriver || + _busAuxiliaries.HVACAux.CompressorTypePassenger != CompressorTypePassenger || + _busAuxiliaries.HVACAux.AuxHeaterPower != AuxHeaterPower || + _busAuxiliaries.HVACAux.DoubleGlasing != DoubleGlasing || + _busAuxiliaries.HVACAux.HeatPump != HeatPump || + _busAuxiliaries.HVACAux.AdjustableAuxiliaryHeater != AdjustableAuxiliaryHeater || + _busAuxiliaries.HVACAux.SeparateAirDistributionDucts != SeparateAirDistributionDucts; + + return changed; + } } } \ No newline at end of file diff --git a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs index 41c2eff719..495d052ca9 100644 --- a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs @@ -19,6 +19,8 @@ namespace VECTO3GUI.ViewModel.Impl #region Members + private IVehicleDeclarationInputData _vehicle; + private string _manufacturer; private string _manufacturerAddress; private string _model; @@ -142,14 +144,14 @@ namespace VECTO3GUI.ViewModel.Impl #endregion - - + #region Set XML Data protected override void InputDataChanged() { var inputData = JobViewModel.InputDataProvider as IDeclarationInputDataProvider; - SetVehicleData(inputData?.JobInputData.Vehicle); + _vehicle = inputData?.JobInputData.Vehicle; + SetVehicleData(_vehicle); SetAllowedEntries(); } @@ -196,5 +198,32 @@ namespace VECTO3GUI.ViewModel.Impl #endregion + public override bool AnyDataChanges() + { + if(_vehicle == null) + return base.AnyDataChanges(); + + var changed = _vehicle.Manufacturer != Manufacturer || + _vehicle.ManufacturerAddress != ManufacturerAddress || + _vehicle.Model != Model || + _vehicle.VIN != VIN || + _vehicle.Date != Date || + _vehicle.LegislativeClass != LegislativeClass || + _vehicle.RegisteredClass != RegisteredClass || + _vehicle.VehicleCode != VehicleCode || + _vehicle.CurbMassChassis != CurbMassChassis || + _vehicle.GrossVehicleMassRating != TechnicalPermissibleMaximumLadenMass || + _vehicle.NumberOfPassengersLowerDeck != NumberOfPassengersLowerDeck || + _vehicle.NuberOfPassengersUpperDeck != NumberOfPassengersUpperDeck || + _vehicle.FloorType != FloorType || + _vehicle.Height != HeightIntegratedBody || + _vehicle.Length != VehicleLength || + _vehicle.Width != VehicleWidth || + _vehicle.EntranceHeight != EntranceHeight|| + ((XMLDeclarationCompletedBusDataProviderV26)_vehicle).DoorDriveTechnology != DoorDriveTechnology; + + return changed; + } } + } diff --git a/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs index c01f5a4389..684036cb12 100644 --- a/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs @@ -22,6 +22,8 @@ using VECTO3GUI.ViewModel.Interfaces; using System.Xml; using System.Xml.Linq; using TUGraz.VectoCommon.Resources; +using VECTO3GUI.Helper; +using VECTO3GUI.Views; namespace VECTO3GUI.ViewModel.Impl @@ -42,6 +44,7 @@ namespace VECTO3GUI.ViewModel.Impl private ICommand _newJobCommand; private ICommand _editJobCommand; private ICommand _removeJobCommand; + private ICommand _addJobCommand; #endregion @@ -109,8 +112,13 @@ namespace VECTO3GUI.ViewModel.Impl try { var jobEditView = ReadJob(entry.Filename); //Kernel.Get<IJobEditViewModel>(); - var wnd = new Window { Content = jobEditView }; - wnd.Show(); + if(jobEditView == null) + return; + + + var window = OutputWindowHelper.CreateOutputWindow(Kernel, jobEditView); + window.Show(); + } catch (Exception e) { @@ -136,7 +144,22 @@ namespace VECTO3GUI.ViewModel.Impl - public ICommand AddJob { get { return new RelayCommand(() => {}, () => false); } } + public ICommand AddJob { get { return _addJobCommand ?? new RelayCommand(DoAddJob); } } + + private void DoAddJob() + { + var filePath = FileDialogHelper.ShowSelectFilesDialog(false, @"F:\VECTO\VECTO\bin"); + if (filePath != null) { + _jobs.Add(new JobEntry() + { + Filename = filePath.First(), + Selected = false, + Sorting = _jobs.Count + }); + } + } + + public ICommand MoveJobUp { get { return new RelayCommand(() => {}, () => false); } } public ICommand MoveJobDown { get { return new RelayCommand(() => {}, () => false); } } public ICommand StartSimulation { get { return new RelayCommand(() => {}, () => false); } } diff --git a/VECTO3GUI/ViewModel/Impl/OutputWindowViewModel.cs b/VECTO3GUI/ViewModel/Impl/OutputWindowViewModel.cs new file mode 100644 index 0000000000..c8f207c34d --- /dev/null +++ b/VECTO3GUI/ViewModel/Impl/OutputWindowViewModel.cs @@ -0,0 +1,21 @@ +using Ninject; + +namespace VECTO3GUI.ViewModel.Impl +{ + public class OutputWindowViewModel : ValidatingViewModel + { + private object _viewModel; + + public object ViewModel + { + get { return _viewModel; } + set { SetProperty(ref _viewModel, value); } + } + + public OutputWindowViewModel(IKernel kernel, object viewModel) + { + Kernel = kernel; + _viewModel = viewModel; + } + } +} diff --git a/VECTO3GUI/ViewModel/Interfaces/IComponentViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IComponentViewModel.cs index c0ef6640a6..a2e2a441e8 100644 --- a/VECTO3GUI/ViewModel/Interfaces/IComponentViewModel.cs +++ b/VECTO3GUI/ViewModel/Interfaces/IComponentViewModel.cs @@ -15,5 +15,7 @@ namespace VECTO3GUI.ViewModel.Interfaces { IComponentViewModel ParentViewModel { get; set; } IComponentViewModel GetComponentViewModel(Component component); + + bool AnyDataChanges(); } } \ No newline at end of file diff --git a/VECTO3GUI/Views/JoblistView.xaml b/VECTO3GUI/Views/JoblistView.xaml index 0bf44e0b7b..e6dc0a7b3c 100644 --- a/VECTO3GUI/Views/JoblistView.xaml +++ b/VECTO3GUI/Views/JoblistView.xaml @@ -13,16 +13,9 @@ d:DesignHeight="300" d:DesignWidth="600" d:DataContext="{d:DesignInstance Type=impl:JoblistViewModel, IsDesignTimeCreatable=False}"> - - <d:JoblistView.DataContext> <x:Type Type="interfaces:IJoblistViewModel"/> </d:JoblistView.DataContext> - - <!--<UserControl.Resources> - <helper:JobEntrySelectedConverter x:Key="JobEntrySelectedConverter" /> - </UserControl.Resources>--> - <Grid> <Grid.ColumnDefinitions> @@ -36,25 +29,39 @@ <RowDefinition Height="30"/> </Grid.RowDefinitions> - <Grid Grid.Row="1" Grid.Column="1" Margin="10"> - <DataGrid ItemsSource="{Binding Jobs}" mah:ControlsHelper.ContentCharacterCasing="Normal" + <DataGrid ItemsSource="{Binding Jobs}" SelectedValue="{Binding DataContext.SelectedJobEntry, RelativeSource={RelativeSource AncestorType=views:JoblistView}}" Style="{DynamicResource AzureDataGrid}" BorderThickness="1" CanUserAddRows="False" AutoGenerateColumns="False" SelectionUnit="FullRow" IsReadOnly="True" HeadersVisibility="All" RowHeaderWidth="5" ColumnWidth="*" > - - + + + <DataGrid.Resources> + <ContextMenu x:Key="RowMenu"> + <MenuItem Header="Remove" Command="{Binding DataContext.RemoveJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/> + <MenuItem Header="Edit" Command="{Binding DataContext.EditJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/> + <MenuItem Header="Add File" Command="{Binding DataContext.AddJob, RelativeSource={RelativeSource AncestorType=views:JoblistView}}"/> + </ContextMenu> + </DataGrid.Resources> + <DataGrid.Columns> - <DataGridTextColumn Header="File Path" Binding="{Binding Filename}" MinWidth="150"/> + <DataGridTextColumn Header="File Path" Binding="{Binding Filename}"> + <DataGridTextColumn.CellStyle> + <Style TargetType= "{x:Type DataGridCell}" BasedOn="{StaticResource MetroDataGridCell}" > + <Setter Property="ContextMenu" Value="{StaticResource RowMenu}"/> + </Style> + </DataGridTextColumn.CellStyle> + </DataGridTextColumn> </DataGrid.Columns> + </DataGrid> </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" Command="{Binding EditJob}" Content="Edit" mah:ControlsHelper.ContentCharacterCasing="Normal"/> - <Button Margin="0,5,0,0" Command="{Binding CreateNewJob}" Content="New File" mah:ControlsHelper.ContentCharacterCasing="Normal" /> - <Button Margin="0,5,0,0" Command="{Binding RemoveJob}" Content="Remove File" mah:ControlsHelper.ContentCharacterCasing="Normal" /> + <Button Margin="0,5,0,0" Command="{Binding EditJob}" Content="Edit" /> + <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> @@ -64,35 +71,5 @@ - <!--<Grid Margin="0,0,10,0"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="*"/> - <ColumnDefinition Width="70"/> - </Grid.ColumnDefinitions> - <ListView x:Name="Joblisting" Height="156" Margin="10,10,10,0" VerticalAlignment="Top" Grid.Column="0" - ItemsSource="{Binding Jobs}" MouseDoubleClick="Joblisting_MouseDoubleClick"> - <ListView.View> - <GridView> - <GridViewColumn Width="30"> - <GridViewColumn.CellTemplate> - <DataTemplate DataType="impl:JobEntry"> - <StackPanel Orientation="Horizontal"> - <CheckBox IsChecked="{Binding Path=Selected}"/> - </StackPanel> - </DataTemplate> - </GridViewColumn.CellTemplate> - </GridViewColumn> - <GridViewColumn Header="Filepath" Width="auto" DisplayMemberBinding="{Binding Filename}"/> - </GridView> - </ListView.View> - </ListView> - <StackPanel Grid.Column="1"> - <Button Margin="0,20,0,0" Command="{Binding EditJob}" CommandParameter="{Binding ElementName=Joblisting, Path=SelectedItem}">Edit</Button> - <Button Margin="0,15,0,0" Command="{Binding AddJob}">New File</Button> - <Button Margin="0,5,0,0" Command="{Binding RemoveJob}" CommandParameter="{Binding ElementName=Joblisting, Path=SelectedItem}">Remove</Button> - --><!--<Button Margin="0,5,0,0" Command="{Binding MoveJobUp}">Up</Button>--> - <!--<Button Margin="0,5,0,0" Command="{Binding MoveJobDown}">Down</Button>--> - <!--<Button Margin="0,20,0,0" Command="{Binding StartSimulation}">Start</Button>--><!-- - </StackPanel> - </Grid>--> + </UserControl> diff --git a/VECTO3GUI/Views/JoblistView.xaml.cs b/VECTO3GUI/Views/JoblistView.xaml.cs index 7cea923207..029a8ff922 100644 --- a/VECTO3GUI/Views/JoblistView.xaml.cs +++ b/VECTO3GUI/Views/JoblistView.xaml.cs @@ -28,22 +28,5 @@ namespace VECTO3GUI.Views { InitializeComponent(); } - - //public JoblistView(IJoblistViewModel viewModel) - //{ - // InitializeComponent(); - // DataContext = viewModel; - //} - - //private void Joblisting_MouseDoubleClick(object sender, MouseButtonEventArgs e) - //{ - // var listView = (ListView)sender; - // if (listView.SelectedItems.Count == 0) { - // return; - // } - - // var model = (IJoblistViewModel)DataContext; - // model.EditJob.Execute(listView.SelectedItem); - //} } } diff --git a/VECTO3GUI/Views/OutputWindow.xaml b/VECTO3GUI/Views/OutputWindow.xaml new file mode 100644 index 0000000000..11bbe604a0 --- /dev/null +++ b/VECTO3GUI/Views/OutputWindow.xaml @@ -0,0 +1,18 @@ +<mah:MetroWindow x:Class="VECTO3GUI.Views.OutputWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:VECTO3GUI.Views" + xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:impl="clr-namespace:VECTO3GUI.ViewModel.Impl" + xmlns:interfaces="clr-namespace:VECTO3GUI.ViewModel.Interfaces" + mc:Ignorable="d" + Title="OutputWindow" Height="450" Width="800" WindowStartupLocation="CenterScreen" + d:DataContext="{d:DesignInstance Type=impl:OutputWindowViewModel, IsDesignTimeCreatable=False}"> + + <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> + <ContentControl Content="{Binding ViewModel}" /> + </Grid> + +</mah:MetroWindow> diff --git a/VECTO3GUI/Views/OutputWindow.xaml.cs b/VECTO3GUI/Views/OutputWindow.xaml.cs new file mode 100644 index 0000000000..2da0f2d28f --- /dev/null +++ b/VECTO3GUI/Views/OutputWindow.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.Shapes; +using MahApps.Metro.Controls; + +namespace VECTO3GUI.Views +{ + /// <summary> + /// Interaction logic for OutputWindow.xaml + /// </summary> + public partial class OutputWindow : MetroWindow + { + public OutputWindow() + { + InitializeComponent(); + } + } +} -- GitLab