diff --git a/VECTO3GUI2020/Helper/Converter/BoolToVisibilityConverter.cs b/VECTO3GUI2020/Helper/Converter/BoolToVisibilityConverter.cs index 0eb30e7c549784ad287c57a8645066fcf89ebae7..f91f4022fba7c4c270658653384bc106e0a138ed 100644 --- a/VECTO3GUI2020/Helper/Converter/BoolToVisibilityConverter.cs +++ b/VECTO3GUI2020/Helper/Converter/BoolToVisibilityConverter.cs @@ -17,7 +17,16 @@ namespace VECTO3GUI2020.Helper.Converter /// <returns></returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { + + + if (value is bool b) { + if (parameter != null) { + if (string.Equals((string)parameter, "invert", StringComparison.InvariantCultureIgnoreCase)) { + b = !b; + } + } + var visibility = b ? Visibility.Collapsed : Visibility.Visible; return visibility; } diff --git a/VECTO3GUI2020/MainWindow.xaml b/VECTO3GUI2020/MainWindow.xaml index 73a0a4efb0ecca551477ec3772aa586d54540eff..4da7c0c7084b6e06d67e550d6684ea70c212ab43 100644 --- a/VECTO3GUI2020/MainWindow.xaml +++ b/VECTO3GUI2020/MainWindow.xaml @@ -14,30 +14,99 @@ <Grid x:Name="Grid" > - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*"/> - </Grid.ColumnDefinitions> - <Grid.RowDefinitions> - <RowDefinition Height="40"/> - <RowDefinition Height="1.5*"/> - <RowDefinition Height="5"></RowDefinition> - <RowDefinition Height="1*"/> - </Grid.RowDefinitions> - - <StackPanel Grid.Row="0" Orientation="Vertical"> - <Menu x:Name="menu" AutomationProperties.Name="-" AutomationProperties.AutomationId="Test" IsMainMenu="True"> - <MenuItem Header="File" x:Name="MenuItemFile" AutomationProperties.Name="=" VerticalAlignment="Stretch"> + <DockPanel> + <StackPanel DockPanel.Dock="Top" Grid.Row="0" Orientation="Vertical"> + <Menu IsMainMenu="True"> + <MenuItem Header="File" x:Name="MenuItemFile" AutomationProperties.Name="=" VerticalAlignment="Stretch"> <MenuItem Header="Settings" Command="{Binding OpenSettings}"/> <MenuItem Header="New File" Command="{Binding NewInterimFile}"/> - <MenuItem Header="Open File" Command="{Binding AddJob}"/> + <!--<MenuItem Header="Open File" Command="{Binding AddJob}"/>--> </MenuItem> </Menu> </StackPanel> + <UniformGrid Rows="1" DockPanel.Dock="Top" Width="400" HorizontalAlignment="Left"> + <Border x:Name="JobsButtonBorder" BorderThickness ="0 0 0 3"> + <Border.Style> + <Style TargetType="Border"> + <Style.Triggers> + <DataTrigger Binding="{Binding JobsSelected}" Value="true"> + <Setter Property="BorderBrush" Value="{StaticResource AccentColorButton}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + + + <Button x:Name="Jobs" Margin="0 0 0 0" + VerticalAlignment="Stretch" + DockPanel.Dock="Top" + Content="Jobs" + Command="{Binding SwitchTopView}" + CommandParameter="Jobs" + Style="{DynamicResource MultiStageButtonStyle1}"> + </Button> + </Border> + <Border BorderThickness="{Binding ElementName=JobsButtonBorder, Path=BorderThickness}" > + <Border.Style> + <Style TargetType="Border"> + <Style.Triggers> + <DataTrigger Binding="{Binding SettingsSelected}" Value="true"> + <Setter Property="BorderBrush" Value="{StaticResource AccentColorButton}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Button Margin="0 0 0 0" + VerticalAlignment="Stretch" + DockPanel.Dock="Top" + Content="Settings" + Command="{Binding SwitchTopView}" + CommandParameter="Settings" + Style="{DynamicResource MultiStageButtonStyle1}"> + </Button> + </Border> + <Border BorderThickness="{Binding ElementName=JobsButtonBorder, Path=BorderThickness}"> + <Border.Style> + <Style TargetType="Border"> + <Style.Triggers> + <DataTrigger Binding="{Binding AboutSelected}" Value="true"> + <Setter Property="BorderBrush" Value="{StaticResource AccentColorButton}"/> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Button Margin="0 0 0 0" + VerticalAlignment="Stretch" + DockPanel.Dock="Top" + Content="About" + Command="{Binding SwitchTopView}" + CommandParameter="About" + Style="{DynamicResource MultiStageButtonStyle1}"> + </Button> + </Border> + </UniformGrid> - <ContentControl Grid.Row="1" Margin="0, 4, 0 0" Content="{Binding CurrentViewModelTop}"/> - <GridSplitter Grid.Row="2" HorizontalAlignment="Stretch" Height="5"/> - <ContentControl Grid.Row="3" Margin="0,0,0,0" Name="ContentControlBottom" Content="{Binding CurrentViewModelBottom}"/> - + + + + <Border DockPanel.Dock="Top" BorderBrush="{DynamicResource AccentColorButton}" BorderThickness="3"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="1.5*"/> + <RowDefinition Height="5"></RowDefinition> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <ContentControl Grid.Row="0" Margin="0, 4, 0 0" Content="{Binding CurrentViewModelTop}"/> + <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" Height="5"/> + <ContentControl Visibility="{Binding JobsSelected, + Converter={StaticResource BooleanToVisibilityConverter}}" Grid.Row="2" Margin="0,0,0,0" Name="ContentControlBottom" Content="{Binding CurrentViewModelBottom}"/> + </Grid> + </Border> + </DockPanel> </Grid> </Window> diff --git a/VECTO3GUI2020/Ninject/Vecto3GUI2020Module.cs b/VECTO3GUI2020/Ninject/Vecto3GUI2020Module.cs index e9b081a7162566bdd3048b80d154f425b4672bd0..5dd4bcd59632c201d90303d168b199018921e603 100644 --- a/VECTO3GUI2020/Ninject/Vecto3GUI2020Module.cs +++ b/VECTO3GUI2020/Ninject/Vecto3GUI2020Module.cs @@ -20,9 +20,10 @@ namespace VECTO3GUI2020.Ninject Bind<IMainViewModel>().To<JobListViewModel>(); Bind<ISettingsViewModel>().To<SettingsViewModel>(); Bind<IOutputViewModel>().To<OutputViewModel>().InSingletonScope(); - Bind<ISettingsModel>().To<SettingsModel>(); + Bind<ISettingsModel>().To<SettingsModel>().InSingletonScope(); Bind<IDialogHelper>().To<DialogHelper>().InSingletonScope(); Bind<IWindowHelper>().To<WindowHelper>(); + Bind<AboutViewModel>().ToSelf().InSingletonScope(); } #endregion diff --git a/VECTO3GUI2020/Resources/Images/JRC-About.png b/VECTO3GUI2020/Resources/Images/JRC-About.png new file mode 100644 index 0000000000000000000000000000000000000000..7ccda103840925863e14e959ef1371dedc797ba6 Binary files /dev/null and b/VECTO3GUI2020/Resources/Images/JRC-About.png differ diff --git a/VECTO3GUI2020/Resources/Images/VECTO-About.png b/VECTO3GUI2020/Resources/Images/VECTO-About.png new file mode 100644 index 0000000000000000000000000000000000000000..4755b511626afcd157f27b0cf70e1c21b6ee067e Binary files /dev/null and b/VECTO3GUI2020/Resources/Images/VECTO-About.png differ diff --git a/VECTO3GUI2020/Resources/Templates/ButtonTemplates.xaml b/VECTO3GUI2020/Resources/Templates/ButtonTemplates.xaml new file mode 100644 index 0000000000000000000000000000000000000000..72b220dc8dc1e8b36c766f283b5e269aa7d320b6 --- /dev/null +++ b/VECTO3GUI2020/Resources/Templates/ButtonTemplates.xaml @@ -0,0 +1,11 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + + <ControlTemplate x:Key="multistageParameterControlErrorTemplate"> + <Grid> + <AdornedElementPlaceholder x:Name="placeHolder"></AdornedElementPlaceholder> + <TextBlock Text="!" Height="Auto" FontWeight="ExtraBold" Foreground="OrangeRed" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 -10 0"></TextBlock> + </Grid> + + </ControlTemplate> +</ResourceDictionary> \ No newline at end of file diff --git a/VECTO3GUI2020/Resources/ViewModelBindings.xaml b/VECTO3GUI2020/Resources/ViewModelBindings.xaml index 8ab51b42b3298ef42586280491f1b96d77eb0b38..cec55212745831db57222664144969ca8ead0e11 100644 --- a/VECTO3GUI2020/Resources/ViewModelBindings.xaml +++ b/VECTO3GUI2020/Resources/ViewModelBindings.xaml @@ -28,7 +28,9 @@ <views:SettingsView/> </DataTemplate> - + <DataTemplate x:Shared="False" DataType="{x:Type impl:AboutViewModel}"> + <views:AboutView></views:AboutView> + </DataTemplate> diff --git a/VECTO3GUI2020/VECTO3GUI2020.csproj b/VECTO3GUI2020/VECTO3GUI2020.csproj index 9de0c0a0c3222f03c1903cea8bd101e37be705c4..a96bb060f69903e21a42f861edee09fc6df072c5 100644 --- a/VECTO3GUI2020/VECTO3GUI2020.csproj +++ b/VECTO3GUI2020/VECTO3GUI2020.csproj @@ -203,6 +203,7 @@ <Compile Include="TestViewModel.cs" /> <Compile Include="Util\XML\Implementation\ComponentWriter\XMLBusAuxiliariesWriter.cs" /> <Compile Include="Util\XML\Implementation\ComponentWriter\XMLPTOWriter.cs" /> + <Compile Include="ViewModel\Implementation\AboutViewModel.cs" /> <Compile Include="ViewModel\Implementation\Document\DeclarationJobViewModel.cs" /> <Compile Include="ViewModel\Implementation\Document\DeclarationTrailerJobDocumentViewModel.cs" /> <Compile Include="Model\Interfaces\IAuxiliaryModelFactory.cs" /> @@ -318,6 +319,9 @@ <Compile Include="ViewModel\MultiStage\Interfaces\IMultistageAirdragViewModel.cs" /> <Compile Include="ViewModel\MultiStage\Interfaces\IMultiStageViewModelFactory.cs" /> <Compile Include="ViewModel\Implementation\OutputViewModel.cs" /> + <Compile Include="Views\AboutView.xaml.cs"> + <DependentUpon>AboutView.xaml</DependentUpon> + </Compile> <Compile Include="Views\CustomControls\ComboParameter.xaml.cs"> <DependentUpon>ComboParameter.xaml</DependentUpon> </Compile> @@ -522,6 +526,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Resources\Templates\ButtonTemplates.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Resources\Templates\ErrorTemplates.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -534,6 +542,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\AboutView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\CustomControls\ComboParameter.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -817,6 +829,12 @@ <LastGenOutput>Version.cs</LastGenOutput> </None> </ItemGroup> + <ItemGroup> + <Resource Include="Resources\Images\JRC-About.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Resources\Images\VECTO-About.png" /> + </ItemGroup> <!-- ItemGroup> <Analyzer Include="..\packages\Microsoft.DependencyValidation.Analyzers.0.11.0\analyzers\dotnet\cs\Microsoft.DependencyValidation.Analyzers.resources.dll" /> </-ItemGroup --> diff --git a/VECTO3GUI2020/ViewModel/Implementation/AboutViewModel.cs b/VECTO3GUI2020/ViewModel/Implementation/AboutViewModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..de8eef21be44febe9c57829fd86e26d56a107d10 --- /dev/null +++ b/VECTO3GUI2020/ViewModel/Implementation/AboutViewModel.cs @@ -0,0 +1,72 @@ +using System.Diagnostics; +using System.Windows.Input; +using Microsoft.Toolkit.Mvvm.Input; +using VECTO3GUI2020.ViewModel.Implementation.Common; +using VECTO3GUI2020.ViewModel.Interfaces; + +namespace VECTO3GUI2020.ViewModel.Implementation +{ + public class AboutViewModel : ViewModelBase, IMainViewModel + { + #region Members + + private ICommand _euplLinkClickedCommand; + private ICommand _mailClickedCommand; + private ICommand _jrcPicClickedCommand; + + #endregion + + #region Properties + + public string EUPLLink { get; set; } + public string JRCMail { get; set; } + public string JRCPic { get; set; } + + #endregion + + public AboutViewModel() + { + EUPLLink = "https://joinup.ec.europa.eu/community/eupl/og_page/eupl"; + JRCMail = "mailto:jrc-vecto@ec.europa.eu"; + JRCPic = "http://ec.europa.eu/dgs/jrc/index.cfm"; + } + + #region Commands + + public ICommand EUPLLinkClickedCommand + { + get + { + return _euplLinkClickedCommand ?? (_euplLinkClickedCommand = new RelayCommand(DoLinkClickedCommand)); + } + } + + private void DoLinkClickedCommand() + { + Process.Start(EUPLLink); + } + + public ICommand MailClickedCommand + { + get { return _mailClickedCommand ?? (_mailClickedCommand = new RelayCommand(DoMailClickedCommand)); } + } + + private void DoMailClickedCommand() + { + Process.Start(JRCMail); + } + + public ICommand JrcPicClickedCommand + { + get { return _jrcPicClickedCommand ?? (_jrcPicClickedCommand = new RelayCommand(DoJrcPicClickedCommand)); } + } + + private void DoJrcPicClickedCommand() + { + Process.Start(JRCPic); + } + #endregion + + + } +} diff --git a/VECTO3GUI2020/ViewModel/Implementation/MainWindowViewModel.cs b/VECTO3GUI2020/ViewModel/Implementation/MainWindowViewModel.cs index ddb2e680e424c12a871fd59f19b6ea9167b75478..98d114dc65c5c2b58ed75f39e4f41e406432627c 100644 --- a/VECTO3GUI2020/ViewModel/Implementation/MainWindowViewModel.cs +++ b/VECTO3GUI2020/ViewModel/Implementation/MainWindowViewModel.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using VECTO3GUI2020.ViewModel.Interfaces; using Ninject; using System.Diagnostics; @@ -20,28 +21,87 @@ namespace VECTO3GUI2020.ViewModel.Implementation #region Commands private ICommand _openSettings; + + private ICommand _switchTopView; private IWindowHelper _windowHelper; private ISettingsViewModel _settingsViewModel; + private IMainViewModel _currentViewModelTop; + private Dictionary<string, IMainViewModel> _viewModels = new Dictionary<string, IMainViewModel>(StringComparer.InvariantCultureIgnoreCase); + private readonly AboutViewModel _aboutViewModel; #endregion + - public MainWindowViewModel(IWindowHelper windowHelper, ISettingsViewModel settingsViewModel, IJobListViewModel jobListViewModel, IOutputViewModel outputViewModel) + public MainWindowViewModel(IWindowHelper windowHelper, ISettingsViewModel settingsViewModel, IJobListViewModel jobListViewModel, IOutputViewModel outputViewModel, AboutViewModel aboutVm) { _windowHelper = windowHelper; _settingsViewModel = settingsViewModel; _jobListVm = jobListViewModel; + _aboutViewModel = aboutVm; + _currentViewModelTop = _jobListVm; _bottomView = outputViewModel; + //_bottomView = new TestViewModel(); + _viewModels.Add("Jobs", _jobListVm); + _viewModels.Add("Settings", _settingsViewModel); + _viewModels.Add("About", _aboutViewModel); + + + + } + + public ICommand SwitchTopView + { + get + { + return _switchTopView ?? (_switchTopView = new RelayCommand<string>(SwitchTopViewModel, (s) => true)); + } + } + + public void SwitchTopViewModel(string key) + { + CurrentViewModelTop = _viewModels[key]; + } + + public bool JobsSelected + { + get + { + return CurrentViewModelTop == _jobListVm; + } + } + + public bool SettingsSelected + { + get + { + return CurrentViewModelTop == _settingsViewModel; + } + } + + public bool AboutSelected + { + get + { + return CurrentViewModelTop == _aboutViewModel; + } } public IMainViewModel CurrentViewModelTop { - get { return _jobListVm; + get { return _currentViewModelTop; } - set { throw new NotImplementedException(); } + set + { + if (SetProperty(ref _currentViewModelTop, value)) { + OnPropertyChanged(nameof(JobsSelected)); + OnPropertyChanged(nameof(SettingsSelected)); + OnPropertyChanged(nameof(AboutSelected)); + } + } } public IMainViewModel CurrentViewModelBottom diff --git a/VECTO3GUI2020/ViewModel/Interfaces/ISettingsViewModel.cs b/VECTO3GUI2020/ViewModel/Interfaces/ISettingsViewModel.cs index 889bdc9b65870abd36d314e3f62200bc9b8801bd..9718b18a22335ac7e4407e69e3f80fe0db8532e7 100644 --- a/VECTO3GUI2020/ViewModel/Interfaces/ISettingsViewModel.cs +++ b/VECTO3GUI2020/ViewModel/Interfaces/ISettingsViewModel.cs @@ -1,6 +1,6 @@ namespace VECTO3GUI2020.ViewModel.Interfaces { - public interface ISettingsViewModel + public interface ISettingsViewModel : IMainViewModel { diff --git a/VECTO3GUI2020/Views/AboutView.xaml b/VECTO3GUI2020/Views/AboutView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..406d408dbb1dcd4f86218ce78682f944c229a36f --- /dev/null +++ b/VECTO3GUI2020/Views/AboutView.xaml @@ -0,0 +1,87 @@ +<UserControl x:Class="VECTO3GUI2020.Views.AboutView" + 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:VECTO3GUI2020.Views" + mc:Ignorable="d" + d:DesignHeight="450" d:DesignWidth="800"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="5"/> + <ColumnDefinition/> + <ColumnDefinition Width="5"/> + </Grid.ColumnDefinitions> + + <Grid Grid.Column ="1"> + <Grid.RowDefinitions> + <RowDefinition Height="10"/> + <RowDefinition/> + <RowDefinition Height="38"/> + <RowDefinition Height="115"/> + <RowDefinition Height="30"/> + </Grid.RowDefinitions> + + <Grid Grid.Row="1"> + <Image HorizontalAlignment="Center" VerticalAlignment="Center"> + <Image.Source> + <BitmapImage UriSource="../Resources/Images/VECTO-About.png"/> + </Image.Source> + </Image> + </Grid> + + <Grid Grid.Row="2" Margin="0,5,0,0"> + <StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="5,0,0,0"> + <TextBlock> + <Hyperlink NavigateUri="{Binding EUPLLink}" Command="{Binding EUPLLinkClickedCommand}"> + <TextBlock Text="VECTO is licensed under EUPL 1.1+"/> + </Hyperlink> + </TextBlock> + <TextBlock Text="Copyright © 2012-2019 European Union"/> + </StackPanel> + </Grid> + + <Grid Grid.Row="3"> + + <Grid.ColumnDefinitions> + <ColumnDefinition/> + <ColumnDefinition/> + </Grid.ColumnDefinitions> + + <Grid Grid.Column="0" Margin="10,30,0,0" > + <StackPanel Orientation="Vertical" HorizontalAlignment="Left"> + <TextBlock Text="Developed on behalf of the"/> + <TextBlock Text="European Commission DG CLIMA" Margin="20,0,0,0"/> + </StackPanel> + </Grid> + + <Grid Grid.Column="1"> + <Button Command="{Binding JrcPicClickedCommand}"> + <Button.Template> + <ControlTemplate> + <Image HorizontalAlignment="Center" VerticalAlignment="Center"> + <Image.Source> + <BitmapImage UriSource="../Resources/Images/JRC-About.png"/> + </Image.Source> + </Image> + </ControlTemplate> + </Button.Template> + </Button> + </Grid> + </Grid> + + <Grid Grid.Row="4"> + <StackPanel Orientation="Horizontal" Margin="10,0,0,0"> + <TextBlock Text="Support Contact:"/> + <TextBlock Margin="5,0,0,0"> + <Hyperlink NavigateUri="{Binding JRCMail}" Command="{Binding MailClickedCommand}" > + <TextBlock Text="jrc-vecto@ec.europa.eu"/> + </Hyperlink> + </TextBlock> + </StackPanel> + </Grid> + + </Grid> + + </Grid> +</UserControl> diff --git a/VECTO3GUI2020/Views/AboutView.xaml.cs b/VECTO3GUI2020/Views/AboutView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..6522582166d4bff97b380456d97dca9a5c5033eb --- /dev/null +++ b/VECTO3GUI2020/Views/AboutView.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 VECTO3GUI2020.Views +{ + /// <summary> + /// Interaction logic for AboutView.xaml + /// </summary> + public partial class AboutView : UserControl + { + public AboutView() + { + InitializeComponent(); + } + } +}