select logo

This commit is contained in:
Natlinux
2022-11-10 22:48:47 +01:00
parent 727d4c7285
commit d4dd7a545a
63 changed files with 247 additions and 37 deletions

View File

@@ -36,6 +36,7 @@ namespace Apollon.WPF.Commands
Tournament tournament = new Tournament(
Guid.NewGuid(),
detailsViewModel.Logo,
detailsViewModel.Organisation,
detailsViewModel.TournamentName,
detailsViewModel.Competition,

View File

@@ -0,0 +1,40 @@
using Apollon.WPF.ViewModels;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Windows;
namespace Apollon.WPF.Commands
{
public class ChooseLogoCommand : CommandBase
{
private readonly AddEditDetailsViewModel _addEditDetailsViewModel;
public ChooseLogoCommand(AddEditDetailsViewModel addEditDetailsViewModel)
{
_addEditDetailsViewModel = addEditDetailsViewModel;
}
public override void Execute(object parameter)
{
OpenFileDialog openFileDialog = new OpenFileDialog()
{
Title = "Logo wählen",
Filter = "Picture (.jpg) | *.jpg",
};
bool? result = openFileDialog.ShowDialog();
if (result == true)
{
_addEditDetailsViewModel.Logo = openFileDialog.FileName;
}
}
}
}

View File

@@ -31,6 +31,7 @@ namespace Apollon.WPF.Commands
Tournament tournament = new Tournament(
_editTournamentViewModel.TournamentId,
detailsViewModel.Logo,
detailsViewModel.Organisation,
detailsViewModel.TournamentName,
detailsViewModel.Competition,

View File

@@ -1,4 +1,5 @@
using Apollon.Domain.Models;
using Apollon.WPF.Commands;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
@@ -15,7 +16,20 @@ namespace Apollon.WPF.ViewModels
{
public class AddEditDetailsViewModel : ViewModelBase
{
private string logo;
public string Logo
{
get
{
return logo;
}
set
{
logo = value;
OnPropertyChanged(nameof(Logo));
}
}
private string _organisation;
public string Organisation
{
@@ -183,13 +197,16 @@ namespace Apollon.WPF.ViewModels
public ICommand SubmitCommand { get; }
public ICommand CancelCommand { get; }
public ICommand ChooseLogoCommand { get; }
public ObservableCollection<Competition> CompetitionList { get; set; }
public AddEditDetailsViewModel(ICommand submitCommand, ICommand cancelCommand)
public ObservableCollection<Competition> CompetitionList { get; }
public AddEditDetailsViewModel(ICommand submitCommand, ICommand cancelCommand)
{
SubmitCommand = submitCommand;
CancelCommand = cancelCommand;
ChooseLogoCommand = new ChooseLogoCommand(this);
CompetitionList = new ObservableCollection<Competition>
{
@@ -214,9 +231,7 @@ namespace Apollon.WPF.ViewModels
CompetitionName = "3D",
CompetitionImage = @"\Images\3d.png"
}
};
}
}
}

View File

@@ -16,6 +16,7 @@ namespace Apollon.WPF.ViewModels
private Tournament SelectedTournament => _selectedTournamentStore.SelectedTournament;
public bool HasSelectedTournament => SelectedTournament != null;
public string Logo => SelectedTournament?.Logo ?? "D:\\Projekte\\Apollon\\Apollon\\Apollon.WPF\\Images\\Archery.png";
public string Organisation => SelectedTournament?.Organisation ?? "keine Organisation";
public string TournamentName => SelectedTournament?.TournamentName ?? "kein Name";
public string Competition => SelectedTournament?.Competition ?? "keine Kategorie";
@@ -47,6 +48,7 @@ namespace Apollon.WPF.ViewModels
private void SelectedTournamentStore_SelectedTournamentChanged()
{
OnPropertyChanged(nameof(HasSelectedTournament));
OnPropertyChanged(nameof(Logo));
OnPropertyChanged(nameof(Organisation));
OnPropertyChanged(nameof(TournamentName));
OnPropertyChanged(nameof(Competition));

View File

@@ -18,6 +18,7 @@ namespace Apollon.WPF.ViewModels
private Tournament SelectedTournament => _selectedTournamentsStore.SelectedTournament;
public bool HasSelectedTournament => SelectedTournament != null;
public string Logo => SelectedTournament?.Logo ?? "D:\\Projekte\\Apollon\\Apollon\\Apollon.WPF\\Images\\Archery.png";
public string Organisation => SelectedTournament?.Organisation ?? "keine Organisation";
public string TournamentName => SelectedTournament?.TournamentName ?? "kein Name";
public string Competition => SelectedTournament?.Competition ?? "keine Kategorie";

View File

@@ -58,8 +58,10 @@
FontFamily="Arial"
FontSize="16"
Height="30"
Width="300"
Background="LightGray"
VerticalContentAlignment="Center"/>
VerticalContentAlignment="Center"
HorizontalAlignment="Left"/>
<TextBox Grid.Row="1"
Grid.Column="1"
@@ -67,9 +69,28 @@
FontFamily="Arial"
FontSize="16"
Height="30"
Width="300"
HorizontalAlignment="Left"
VerticalContentAlignment="Center"
Background="LightGray"/>
<StackPanel Grid.Column="1"
Grid.RowSpan="2">
<Image
Height="80"
Width="80"
HorizontalAlignment="Right"
Source="{Binding Logo, TargetNullValue={x:Null}}"/>
<Button Style="{StaticResource ModernButton}"
Content="Logo wählen"
Height="20"
Width="80"
HorizontalAlignment="Right"
FontSize="10"
Command="{Binding ChooseLogoCommand}"/>
</StackPanel>
<ComboBox Grid.Row="2"
Text="{Binding Competition}"
IsReadOnly="False"
@@ -90,11 +111,11 @@
<Image x:Name="CompetitionImage"
Grid.Row="2"
Grid.Column="1"
Grid.RowSpan="2"
Grid.RowSpan="3"
Height="80"
Width="80"
HorizontalAlignment="Right"
Margin="0 0 80 0"
Margin="0 0 60 0"
Source="{Binding CompetitionImage, TargetNullValue={x:Null}}" />
<DatePicker SelectedDateFormat="Long"
@@ -119,6 +140,8 @@
FontFamily="Arial"
FontSize="16"
Height="30"
Width="300"
HorizontalAlignment="Left"
VerticalContentAlignment="Center"
Background="LightGray"/>
<TextBox Grid.Row="6"

View File

@@ -8,12 +8,13 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Border BorderBrush="#0000a0"
BorderThickness="1"
CornerRadius="10">
</Border>
<TextBlock
<TextBlock Grid.RowSpan="6"
TextAlignment="Center"
VerticalAlignment="Center"
FontFamily="Arial"
@@ -34,44 +35,69 @@
</TextBlock.Style>
klicke auf <LineBreak/> Neues Turnier vorbereiten <LineBreak/><LineBreak/> oder wähle ein vorhandenes Turnier aus um es zu bearbeiten!
</TextBlock>
<StackPanel>
<TextBlock Text="{Binding TournamentName}"
TextAlignment="Center"
<StackPanel Margin="10">
<WrapPanel HorizontalAlignment="Center">
<StackPanel>
<TextBlock Text="{Binding TournamentName}"
TextAlignment="Left"
Width="200"
FontFamily="Arial"
FontWeight="Bold"
FontSize="14"
Foreground="#0000a0"
Margin="10">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Hidden"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasSelectedTournament}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
TextWrapping="WrapWithOverflow">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Hidden"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasSelectedTournament}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Text="{Binding Organisation}"
TextAlignment="Center"
<TextBlock Text="{Binding Organisation}"
TextAlignment="Left"
FontFamily="Arial"
FontWeight="Bold"
FontSize="14"
Foreground="#0000a0"
Width="200"
TextWrapping="WrapWithOverflow"
Margin="10">
<TextBlock.Style>
<Style TargetType="TextBlock">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Hidden"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasSelectedTournament}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
<Image Grid.Column="2"
Grid.Row="2"
Source="{Binding Logo}"
Width="50"
Height="50">
<Image.Style>
<Style TargetType="Image">
<Setter Property="Visibility" Value="Hidden"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasSelectedTournament}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Image.Style>
</Image>
</WrapPanel>
<WrapPanel HorizontalAlignment="Center">
<TextBlock Text="{Binding Competition}"
TextAlignment="Center"
@@ -224,8 +250,8 @@
Content="Turnier öffnen"
FontSize="16"
Height="40"
Width="210"
Margin="40"
Width="150"
Margin="20"
Cursor="Hand"
Command="{Binding NavigateNavBarCommand}">
<Button.Style>

View File

@@ -13,7 +13,7 @@
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0"
Source="D:\Projekte\Apollon\Apollon\Apollon.WPF\Images\Logos\logo_klein_DSB.jpg"
Source="{Binding Logo}"
Width="80"
VerticalAlignment="Center"/>
<StackPanel Grid.Column="1">

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 KiB