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

Skip to content
Snippets Groups Projects
Commit 8f9473fe authored by Harald Martini's avatar Harald Martini
Browse files

Added Settings Tab and About View

parent 1b59fcba
No related branches found
No related tags found
No related merge requests found
Showing
with 381 additions and 24 deletions
...@@ -17,7 +17,16 @@ namespace VECTO3GUI2020.Helper.Converter ...@@ -17,7 +17,16 @@ namespace VECTO3GUI2020.Helper.Converter
/// <returns></returns> /// <returns></returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{ {
if (value is bool b) { 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; var visibility = b ? Visibility.Collapsed : Visibility.Visible;
return visibility; return visibility;
} }
......
...@@ -14,30 +14,99 @@ ...@@ -14,30 +14,99 @@
<Grid x:Name="Grid" > <Grid x:Name="Grid" >
<Grid.ColumnDefinitions> <DockPanel>
<ColumnDefinition Width="1*"/> <StackPanel DockPanel.Dock="Top" Grid.Row="0" Orientation="Vertical">
</Grid.ColumnDefinitions> <Menu IsMainMenu="True">
<Grid.RowDefinitions> <MenuItem Header="File" x:Name="MenuItemFile" AutomationProperties.Name="=" VerticalAlignment="Stretch">
<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">
<MenuItem Header="Settings" Command="{Binding OpenSettings}"/> <MenuItem Header="Settings" Command="{Binding OpenSettings}"/>
<MenuItem Header="New File" Command="{Binding NewInterimFile}"/> <MenuItem Header="New File" Command="{Binding NewInterimFile}"/>
<MenuItem Header="Open File" Command="{Binding AddJob}"/> <!--<MenuItem Header="Open File" Command="{Binding AddJob}"/>-->
</MenuItem> </MenuItem>
</Menu> </Menu>
</StackPanel> </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> </Grid>
</Window> </Window>
...@@ -20,9 +20,10 @@ namespace VECTO3GUI2020.Ninject ...@@ -20,9 +20,10 @@ namespace VECTO3GUI2020.Ninject
Bind<IMainViewModel>().To<JobListViewModel>(); Bind<IMainViewModel>().To<JobListViewModel>();
Bind<ISettingsViewModel>().To<SettingsViewModel>(); Bind<ISettingsViewModel>().To<SettingsViewModel>();
Bind<IOutputViewModel>().To<OutputViewModel>().InSingletonScope(); Bind<IOutputViewModel>().To<OutputViewModel>().InSingletonScope();
Bind<ISettingsModel>().To<SettingsModel>(); Bind<ISettingsModel>().To<SettingsModel>().InSingletonScope();
Bind<IDialogHelper>().To<DialogHelper>().InSingletonScope(); Bind<IDialogHelper>().To<DialogHelper>().InSingletonScope();
Bind<IWindowHelper>().To<WindowHelper>(); Bind<IWindowHelper>().To<WindowHelper>();
Bind<AboutViewModel>().ToSelf().InSingletonScope();
} }
#endregion #endregion
......
VECTO3GUI2020/Resources/Images/JRC-About.png

15.4 KiB

VECTO3GUI2020/Resources/Images/VECTO-About.png

31.8 KiB

<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
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
<views:SettingsView/> <views:SettingsView/>
</DataTemplate> </DataTemplate>
<DataTemplate x:Shared="False" DataType="{x:Type impl:AboutViewModel}">
<views:AboutView></views:AboutView>
</DataTemplate>
......
...@@ -203,6 +203,7 @@ ...@@ -203,6 +203,7 @@
<Compile Include="TestViewModel.cs" /> <Compile Include="TestViewModel.cs" />
<Compile Include="Util\XML\Implementation\ComponentWriter\XMLBusAuxiliariesWriter.cs" /> <Compile Include="Util\XML\Implementation\ComponentWriter\XMLBusAuxiliariesWriter.cs" />
<Compile Include="Util\XML\Implementation\ComponentWriter\XMLPTOWriter.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\DeclarationJobViewModel.cs" />
<Compile Include="ViewModel\Implementation\Document\DeclarationTrailerJobDocumentViewModel.cs" /> <Compile Include="ViewModel\Implementation\Document\DeclarationTrailerJobDocumentViewModel.cs" />
<Compile Include="Model\Interfaces\IAuxiliaryModelFactory.cs" /> <Compile Include="Model\Interfaces\IAuxiliaryModelFactory.cs" />
...@@ -318,6 +319,9 @@ ...@@ -318,6 +319,9 @@
<Compile Include="ViewModel\MultiStage\Interfaces\IMultistageAirdragViewModel.cs" /> <Compile Include="ViewModel\MultiStage\Interfaces\IMultistageAirdragViewModel.cs" />
<Compile Include="ViewModel\MultiStage\Interfaces\IMultiStageViewModelFactory.cs" /> <Compile Include="ViewModel\MultiStage\Interfaces\IMultiStageViewModelFactory.cs" />
<Compile Include="ViewModel\Implementation\OutputViewModel.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"> <Compile Include="Views\CustomControls\ComboParameter.xaml.cs">
<DependentUpon>ComboParameter.xaml</DependentUpon> <DependentUpon>ComboParameter.xaml</DependentUpon>
</Compile> </Compile>
...@@ -522,6 +526,10 @@ ...@@ -522,6 +526,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Resources\Templates\ButtonTemplates.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\Templates\ErrorTemplates.xaml"> <Page Include="Resources\Templates\ErrorTemplates.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
...@@ -534,6 +542,10 @@ ...@@ -534,6 +542,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\AboutView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\CustomControls\ComboParameter.xaml"> <Page Include="Views\CustomControls\ComboParameter.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
...@@ -817,6 +829,12 @@ ...@@ -817,6 +829,12 @@
<LastGenOutput>Version.cs</LastGenOutput> <LastGenOutput>Version.cs</LastGenOutput>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\JRC-About.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\VECTO-About.png" />
</ItemGroup>
<!-- ItemGroup> <!-- ItemGroup>
<Analyzer Include="..\packages\Microsoft.DependencyValidation.Analyzers.0.11.0\analyzers\dotnet\cs\Microsoft.DependencyValidation.Analyzers.resources.dll" /> <Analyzer Include="..\packages\Microsoft.DependencyValidation.Analyzers.0.11.0\analyzers\dotnet\cs\Microsoft.DependencyValidation.Analyzers.resources.dll" />
</-ItemGroup --> </-ItemGroup -->
......
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
}
}
using System; using System;
using System.Collections.Generic;
using VECTO3GUI2020.ViewModel.Interfaces; using VECTO3GUI2020.ViewModel.Interfaces;
using Ninject; using Ninject;
using System.Diagnostics; using System.Diagnostics;
...@@ -20,28 +21,87 @@ namespace VECTO3GUI2020.ViewModel.Implementation ...@@ -20,28 +21,87 @@ namespace VECTO3GUI2020.ViewModel.Implementation
#region Commands #region Commands
private ICommand _openSettings; private ICommand _openSettings;
private ICommand _switchTopView;
private IWindowHelper _windowHelper; private IWindowHelper _windowHelper;
private ISettingsViewModel _settingsViewModel; private ISettingsViewModel _settingsViewModel;
private IMainViewModel _currentViewModelTop;
private Dictionary<string, IMainViewModel> _viewModels = new Dictionary<string, IMainViewModel>(StringComparer.InvariantCultureIgnoreCase);
private readonly AboutViewModel _aboutViewModel;
#endregion #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; _windowHelper = windowHelper;
_settingsViewModel = settingsViewModel; _settingsViewModel = settingsViewModel;
_jobListVm = jobListViewModel; _jobListVm = jobListViewModel;
_aboutViewModel = aboutVm;
_currentViewModelTop = _jobListVm;
_bottomView = outputViewModel; _bottomView = outputViewModel;
//_bottomView = new TestViewModel(); //_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 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 public IMainViewModel CurrentViewModelBottom
......
namespace VECTO3GUI2020.ViewModel.Interfaces namespace VECTO3GUI2020.ViewModel.Interfaces
{ {
public interface ISettingsViewModel public interface ISettingsViewModel : IMainViewModel
{ {
......
<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>
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();
}
}
}
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