Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Commit

Permalink
Add new UserControl for new entities
Browse files Browse the repository at this point in the history
  • Loading branch information
dhcgn committed Mar 26, 2020
1 parent 1f0bcc9 commit bc8e7b4
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Planungsboard.Presentation/UserControls/MenuUserControl.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<UserControl x:Class="Planungsboard.Presentation.MenuUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
xmlns:viewModels="clr-namespace:Planungsboard.Presentation.ViewModels">

<UserControl.Resources>
<Style x:Key="BaseStyle" TargetType="FrameworkElement">
Expand All @@ -26,7 +26,7 @@
<StackPanel Grid.Row="0">
<Button Content="Open On GitHib" FontSize="5" Style="{StaticResource SideBarButtonStyle}" CommandParameter="https://github.com/haevg-rz/Planungsboard/" />
<Rectangle Height="100"></Rectangle>
<Button Content="New Team" Style="{StaticResource SideBarButtonStyle}" />
<Button Content="New Team" Style="{StaticResource SideBarButtonStyle}" Command="{Binding Path=(viewModels:MainViewModel.NewTeamCommand)}" />
<Button Content="New Card" Style="{StaticResource SideBarButtonStyle}" />

<Separator Style="{StaticResource BaseStyle}" />
Expand Down
14 changes: 12 additions & 2 deletions Planungsboard.Presentation/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Windows.Media.Media3D;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
using Planungsboard.Presentation.Views;

namespace Planungsboard.Presentation.ViewModels
{
Expand All @@ -16,6 +17,7 @@ public MainViewModel()
LoadedCommand = new RelayCommand(LoadedCommandHandling);
QuarterBackCommand = new RelayCommand(QuarterBackCommandHandling);
QuarterNextCommand = new RelayCommand(QuarterNextCommandHandling);
NewTeamCommand = new RelayCommand(NewTeamCommandHandling);

this.DisplayQuarters = new List<string>
{
Expand Down Expand Up @@ -48,8 +50,6 @@ public MainViewModel()
};
teams.ForEach(team => team.SetColor());
this.Teams = teams;


}

private void QuarterNextCommandHandling()
Expand All @@ -75,6 +75,14 @@ private void QuarterNextCommandHandling()
this.DisplayQuarters = newQuarterList;
}

private void NewTeamCommandHandling()
{
var newEntityWindows = new NewGenericEntityWindows<Team>();
newEntityWindows.ShowDialog();

this.Teams.Add(newEntityWindows.Instance);
}

private void QuarterBackCommandHandling()
{
var newQuarterList = new List<string>();
Expand Down Expand Up @@ -134,6 +142,8 @@ public double TeamLabelWidth
public RelayCommand QuarterNextCommand { get; set; }
public RelayCommand QuarterBackCommand { get; set; }

public RelayCommand NewTeamCommand { get; set; }

#endregion

#region Commands Handling
Expand Down
7 changes: 3 additions & 4 deletions Planungsboard.Presentation/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<local:MenuUserControl>

</local:MenuUserControl>
<local:MenuUserControl />

<Grid Grid.Column="1" Margin="10">

Expand Down Expand Up @@ -74,7 +72,7 @@
<Setter Property="HorizontalAlignment" Value="Left" />
</Style>
</DataTemplate.Resources>
<Grid Margin="0,10,0,0" SizeChanged="FrameworkElement_OnSizeChanged2">
<Grid Margin="0,10,0,0" SizeChanged="FrameworkElement_OnSizeChanged">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
Expand Down Expand Up @@ -139,6 +137,7 @@
</MultiBinding>
</userControls:CardsWarpPanel.Quarter4Cards>
</userControls:CardsWarpPanel>

<Border Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Grid.RowSpan="2"
BorderBrush="{Binding Color}" BorderThickness="2" />

Expand Down
2 changes: 1 addition & 1 deletion Planungsboard.Presentation/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public MainWindow()
InitializeComponent();
}

private void FrameworkElement_OnSizeChanged2(object sender, SizeChangedEventArgs e)
private void FrameworkElement_OnSizeChanged(object sender, SizeChangedEventArgs e)
{
var grid = sender as Grid;
var firstColumn = grid.ColumnDefinitions.FirstOrDefault();
Expand Down
12 changes: 12 additions & 0 deletions Planungsboard.Presentation/Views/NewEntityWindows.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Window x:Class="Planungsboard.Presentation.Views.NewEntityWindows"
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:Planungsboard.Presentation.Views"
mc:Ignorable="d"
Title="NewEntityWindows" Height="450" Width="800">
<Grid>

</Grid>
</Window>
37 changes: 37 additions & 0 deletions Planungsboard.Presentation/Views/NewEntityWindows.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
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 Planungsboard.Presentation.Views
{
/// <summary>
/// Interaktionslogik für NewEntityWindows.xaml
/// </summary>
public partial class NewEntityWindows : Window
{
public NewEntityWindows()
{
InitializeComponent();
}

}

public class NewGenericEntityWindows<T> : NewEntityWindows
{
public NewGenericEntityWindows()
{

}

public T Instance { get; set; }
}
}

0 comments on commit bc8e7b4

Please sign in to comment.