The new WPF UI Can run and show existing Tournaments

This commit is contained in:
2020-05-14 23:59:26 +02:00
parent 6a4b3fc422
commit effdbe02b4
4 changed files with 99 additions and 6 deletions

View File

@ -1,5 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<appSettings>
<add key="filePath" value="D:\data\TournamentTracker" />
<!--<add key="filePath" value="C:\AppData\TournamentTracker"/>-->
<add key="greaterWins" value="1" />
<add key="senderEmail" value="tommy@oeman.se" />
<add key="senderDisplayName" value="Tommy Öman" />
<add key="smsAccountSid" value="AC722d9a6f2c7812a1eb4e091426ca5581" />
<add key="smsAuthToken" value="8383d2239d043690984c7b80a8b0a704" />
<add key="smsFromPhoneNumber" value="+12058462699" />
</appSettings>
<connectionStrings>
<!--<add name="Tournaments" connectionString="Server=TOMMYASUS\SQLEXPR2017;Database=Tournaments;Trusted_Connection=True;" providerName="System.Data.SqlClient"/>-->
<add name="Tournaments" connectionString="Server=.\SQLEXPR2017;Database=Tournaments;Trusted_Connection=True;" providerName="System.Data.SqlClient" />
<!--Data Source=TOMMYASUS\SQLEXPR2017;Initial Catalog=Tournaments;Integrated Security=True-->
</connectionStrings>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="127.0.0.1" userName="tfoman" password="testing" port="25" enableSsl="false" />
</smtp>
</mailSettings>
</system.net>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup> </startup>

View File

@ -119,5 +119,11 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource> </Resource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TrackerLibrary\TrackerLibrary.csproj">
<Project>{27ba8b4b-4ef6-4ca2-8e43-7c930552ecd9}</Project>
<Name>TrackerLibrary</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -4,10 +4,45 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using TrackerLibrary;
using TrackerLibrary.Models;
namespace TrackerWPFUI.ViewModels namespace TrackerWPFUI.ViewModels
{ {
public class ShellViewModel:Conductor<object> public class ShellViewModel : Conductor<object>
{ {
public ShellViewModel()
{
// Initialize the database connections
GlobalConfig.InitializeConnections(DatabaseType.Sql);
_existingTournaments = new BindableCollection<TournamentModel>(GlobalConfig.Connection.GetTournament_All());
}
public void CreateTournament()
{
}
private BindableCollection<TournamentModel> _existingTournaments;
public BindableCollection<TournamentModel> ExistingTournaments
{
get { return _existingTournaments; }
set { _existingTournaments = value; }
}
private TournamentModel _SelectedTournament;
public TournamentModel SelectedTournament
{
get { return _SelectedTournament; }
set
{
_SelectedTournament = value;
NotifyOfPropertyChange(() => SelectedTournament);
}
}
} }
} }

View File

@ -5,8 +5,37 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TrackerWPFUI.Views" FontSize="18" xmlns:local="clr-namespace:TrackerWPFUI.Views" FontSize="18"
mc:Ignorable="d" WindowStartupLocation="CenterScreen" Icon="..\TournamentTracker.ico" mc:Ignorable="d" WindowStartupLocation="CenterScreen" Icon="..\TournamentTracker.ico"
Title="ShellView" Height="450" Width="800"> Title="ShellView" Height="500" Width="600">
<Grid> <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" Grid.Column="2"
HorizontalAlignment="Center"
FontSize="36"
>
Tournament Tracker
</TextBlock>
<StackPanel Orientation="Vertical" Grid.Column="1" Grid.Row="1"
Grid.RowSpan="2">
<Button x:Name="CreateTournament" Padding="10" >Create Tournament</Button>
<TextBlock FontWeight="Bold" Margin="0 10 0 0">Existing Tournaments</TextBlock>
<ListBox x:Name="ExistingTournaments" DisplayMemberPath="TournamentName"
SelectedItem="{Binding Path=SelectedTournament,Mode=OneWayToSource}"/>
<!--<TextBlock x:Name="SelectedTournament_TournamentName"/>-->
</StackPanel>
<ContentControl Grid.Row="2" Grid.Column="2"/>
</Grid> </Grid>
</Window> </Window>