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

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

Added Menu to main window

parent fbb832e2
No related branches found
No related tags found
No related merge requests found
......@@ -17,17 +17,24 @@
<Grid x:Name="Grid" >
<DockPanel Margin="0 10 0 0">
<!--<StackPanel DockPanel.Dock="Top" Grid.Row="0" Orientation="Vertical">
<DockPanel Margin="0 0 0 0">
<StackPanel DockPanel.Dock="Top" Grid.Row="0" Orientation="Vertical">
<Menu IsMainMenu="True">
<MenuItem Header="File" x:Name="MenuItemFile" AutomationProperties.Name="=" VerticalAlignment="Stretch">
<MenuItem Header="New File">
<MenuItem Header="Primary and Interim Job" Command="{Binding JobListVm.NewVifCommand}"/>
<MenuItem Header="Interim/Completed Job" Command="{Binding JobListVm.NewManufacturingStageFileCommand}"/>
<MenuItem Header="Complete Job"></MenuItem>
<Separator></Separator>
<MenuItem Header="Create interim/completeted input" Command="{Binding JobListVm.NewCompletedInputCommand}"/>
<MenuItem Header="Create extemted interim/completed input" Command="{Binding JobListVm.NewExemptedCompletedInputCommand}"/>
</MenuItem>
<MenuItem Header="Load File" Command="{Binding AddJob}"/>
<MenuItem Header="Settings" Command="{Binding OpenSettings}"/>
<MenuItem Header="New File" Command="{Binding NewInterimFile}"/>
--><!--<MenuItem Header="Open File" Command="{Binding AddJob}"/>--><!--
</MenuItem>
</Menu>
</StackPanel>-->
<UniformGrid Rows="1" DockPanel.Dock="Top" Width="400" HorizontalAlignment="Left">
</StackPanel>
<UniformGrid Margin="0 10 0 0 " Rows="1" DockPanel.Dock="Top" Width="400" HorizontalAlignment="Left">
<Border x:Name="JobsButtonBorder" BorderThickness ="0 0 0 3">
<Border.Style>
<Style TargetType="Border">
......@@ -89,31 +96,8 @@
</Button>
</Border>
</UniformGrid>
<!--<Border DockPanel.Dock="Top" BorderBrush="{DynamicResource AccentColorButton}" BorderThickness="3" VerticalAlignment="Stretch"
Visibility="{Binding JobsSelected, Converter={StaticResource BooleanToVisibilityConverter}}">
<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>-->
<Border DockPanel.Dock="Top" BorderBrush="{DynamicResource AccentColorButton}" BorderThickness="3" VerticalAlignment="Stretch">
<ContentControl Content="{Binding CurrentViewModelTop}"></ContentControl>
<ContentControl Content="{Binding CurrentViewModel}"></ContentControl>
</Border>
</DockPanel>
</Grid>
......
......@@ -14,27 +14,18 @@ namespace VECTO3GUI2020.ViewModel.Implementation
{
public class MainWindowViewModel : ViewModelBase, IMainWindowViewModel
{
#region Member
#region Members
private IJobListViewModel _jobListVm;
private IMainViewModel _bottomView;
#endregion
#region Commands
private ICommand _openSettings;
private ICommand _switchTopView;
private Dictionary<string, IMainViewModel> _viewModels = new Dictionary<string, IMainViewModel>(StringComparer.InvariantCultureIgnoreCase);
private readonly AboutViewModel _aboutViewModel;
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, AboutViewModel aboutVm)
public MainWindowViewModel(IWindowHelper windowHelper, ISettingsViewModel settingsViewModel, IJobListViewModel jobListViewModel, IOutputViewModel outputViewModel, AboutViewModel aboutVm)
{
_windowHelper = windowHelper;
_settingsViewModel = settingsViewModel;
......@@ -47,29 +38,20 @@ namespace VECTO3GUI2020.ViewModel.Implementation
_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));
}
}
#region Properties
public void SwitchTopViewModel(string key)
{
CurrentViewModelTop = _viewModels[key];
CurrentViewModel = _viewModels[key];
}
public bool JobsSelected
{
get
{
return CurrentViewModelTop == _jobListVm;
return CurrentViewModel == _jobListVm;
}
}
......@@ -77,7 +59,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation
{
get
{
return CurrentViewModelTop == _settingsViewModel;
return CurrentViewModel == _settingsViewModel;
}
}
......@@ -85,17 +67,16 @@ namespace VECTO3GUI2020.ViewModel.Implementation
{
get
{
return CurrentViewModelTop == _aboutViewModel;
return CurrentViewModel == _aboutViewModel;
}
}
public IMainViewModel CurrentViewModelTop
public IMainViewModel CurrentViewModel
{
get { return _currentViewModelTop;
}
set
{
get {
return _currentViewModelTop;
}
set {
if (SetProperty(ref _currentViewModelTop, value)) {
OnPropertyChanged(nameof(JobsSelected));
OnPropertyChanged(nameof(SettingsSelected));
......@@ -110,10 +91,18 @@ namespace VECTO3GUI2020.ViewModel.Implementation
set { _bottomView = value; }
}
public IJobListViewModel JobListVm
{
get => _jobListVm;
set => SetProperty(ref _jobListVm, value);
}
#endregion
#region Commands
#region CommandImplementations
#region CommandOpenSettings
public ICommand OpenSettings
private ICommand _openSettings;
private ICommand _switchTopView;
public ICommand OpenSettings
{
get{
return _openSettings ?? (ICommand)new RelayCommand(OpenSettingsExecute);
......@@ -129,35 +118,17 @@ namespace VECTO3GUI2020.ViewModel.Implementation
_windowHelper.ShowWindow(_settingsViewModel);
}
#region newMultiStage
public ICommand NewInterimFile => _jobListVm.NewManufacturingStageFileCommand;
public ICommand SwitchTopView
{
get
{
return _switchTopView ?? (_switchTopView = new RelayCommand<string>(SwitchTopViewModel, (s) => true));
}
}
#endregion
#endregion
#endregion
}
}
}
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Windows.Input;
using Microsoft.Toolkit.Mvvm.Input;
using VECTO3GUI2020.Model.Interfaces;
using VECTO3GUI2020.ViewModel.Interfaces.Document;
......@@ -10,6 +11,13 @@ namespace VECTO3GUI2020.ViewModel.Interfaces
{
ObservableCollection<IDocumentViewModel> Jobs { get; }
ICommand NewManufacturingStageFileCommand { get; }
ICommand NewCompletedInputCommand { get; }
ICommand NewExemptedCompletedInputCommand { get; }
IRelayCommand NewVifCommand { get; }
IAsyncRelayCommand AddJobAsyncCommand { get; }
ICommand EditDocument { get; set; }
ICommand ViewXMLFile { get; set; }
IAsyncRelayCommand RemoveJob { get; set; }
Task<IDocumentViewModel> AddJobAsync(string fileName, bool runSimulationAfterAdding = false);
void AddJob(IDocumentViewModel jobToAdd);
}
......
......@@ -4,10 +4,9 @@ namespace VECTO3GUI2020.ViewModel.Interfaces
{
public interface IMainWindowViewModel
{
IMainViewModel CurrentViewModelTop { get; set; }
IMainViewModel CurrentViewModelBottom { get; set; }
IMainViewModel CurrentViewModel { get; set; }
#region Commands
#region Commands
ICommand OpenSettings { get;}
#endregion
}
......
......@@ -142,7 +142,7 @@
Style="{StaticResource MultiStageButtonStyle1}"
Command="{Binding EditDocument}"
CommandParameter="{Binding ElementName=JobDataGrid, Path=SelectedItem}">Edit Job</Button>
<Button x:Name="newFileButton" Margin="4" HorizontalAlignment="Stretch"
<!--<Button x:Name="newFileButton" Margin="4" HorizontalAlignment="Stretch"
Style="{StaticResource MultiStageButtonStyle1}"
Command="{Binding OpenPopUpCommand}">New File</Button>
<Popup HorizontalAlignment="Center"
......@@ -160,7 +160,7 @@
<Button Style="{StaticResource MultiStageButtonStyle1}" Command="{Binding NewExemptedCompletedInputCommand}">New Exempted Completed Input</Button>
</StackPanel>
</Border>
</Popup>
</Popup>-->
<Button x:Name="button6" Margin="4" HorizontalAlignment="Stretch"
Style="{StaticResource MultiStageButtonStyle1}"
Command="{Binding RemoveJob, IsAsync=True}"
......
......@@ -48,25 +48,5 @@ namespace VECTO3GUI2020.Views
e.Effects = DragDropEffects.None;
}
}
private void JobDataGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
CommandManager.InvalidateRequerySuggested();
}
private void NewFilePopup_OnMouseLeave(object sender, MouseEventArgs e)
{
}
private void NewFilePopup_OnMouseDown(object sender, MouseButtonEventArgs e)
{
newFilePopup.IsOpen = false;
}
private void NewFilePopup_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
newFilePopup.IsOpen = false;
}
}
}
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