CreatePerson UI tillaggt
This commit is contained in:
14
TrackerWPFUI/EventAggregationProvider.cs
Normal file
14
TrackerWPFUI/EventAggregationProvider.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using Caliburn.Micro;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace TrackerWPFUI
|
||||||
|
{
|
||||||
|
public static class EventAggregationProvider
|
||||||
|
{
|
||||||
|
public static EventAggregator TrackerEventAggregator { get; set; } = new EventAggregator();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -71,9 +71,14 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
<Compile Include="BootStrapper.cs" />
|
<Compile Include="BootStrapper.cs" />
|
||||||
|
<Compile Include="EventAggregationProvider.cs" />
|
||||||
|
<Compile Include="ViewModels\CreatePersonViewModel.cs" />
|
||||||
<Compile Include="ViewModels\CreatePrizeViewModel.cs" />
|
<Compile Include="ViewModels\CreatePrizeViewModel.cs" />
|
||||||
<Compile Include="ViewModels\CreateTeamViewModel.cs" />
|
<Compile Include="ViewModels\CreateTeamViewModel.cs" />
|
||||||
<Compile Include="ViewModels\ShellViewModel.cs" />
|
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||||
|
<Compile Include="Views\CreatePersonView.xaml.cs">
|
||||||
|
<DependentUpon>CreatePersonView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\CreatePrizeView.xaml.cs">
|
<Compile Include="Views\CreatePrizeView.xaml.cs">
|
||||||
<DependentUpon>CreatePrizeView.xaml</DependentUpon>
|
<DependentUpon>CreatePrizeView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -87,6 +92,10 @@
|
|||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Page Include="Views\CreatePersonView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\CreatePrizeView.xaml">
|
<Page Include="Views\CreatePrizeView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
79
TrackerWPFUI/ViewModels/CreatePersonViewModel.cs
Normal file
79
TrackerWPFUI/ViewModels/CreatePersonViewModel.cs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
using Caliburn.Micro;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using TrackerLibrary;
|
||||||
|
using TrackerLibrary.Models;
|
||||||
|
|
||||||
|
namespace TrackerWPFUI.ViewModels
|
||||||
|
{
|
||||||
|
public class CreatePersonViewModel:Screen
|
||||||
|
{
|
||||||
|
private string _firstName="";
|
||||||
|
private string _lastName = "";
|
||||||
|
private string _email = "";
|
||||||
|
private string _cellphone = "";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public string FirstName
|
||||||
|
{
|
||||||
|
get { return _firstName; }
|
||||||
|
set { _firstName = value;
|
||||||
|
NotifyOfPropertyChange(() => FirstName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string LastName
|
||||||
|
{
|
||||||
|
get { return _lastName; }
|
||||||
|
set { _lastName = value;
|
||||||
|
NotifyOfPropertyChange(() => LastName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Email
|
||||||
|
{
|
||||||
|
get { return _email; }
|
||||||
|
set { _email = value;
|
||||||
|
NotifyOfPropertyChange(() => Email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Cellphone
|
||||||
|
{
|
||||||
|
get { return _cellphone; }
|
||||||
|
set { _cellphone = value;
|
||||||
|
NotifyOfPropertyChange(() => Cellphone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanCreatePerson(string firstName, string lastName, string email, string cellphone)
|
||||||
|
{
|
||||||
|
if(firstName.Length>0 && lastName.Length>0 && email.Length>0 && cellphone.Length > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreatePerson(string firstName, string lastName, string email,string cellphone)
|
||||||
|
{
|
||||||
|
PersonModel p = new PersonModel();
|
||||||
|
|
||||||
|
p.FirstName = firstName;
|
||||||
|
p.LastName = lastName;
|
||||||
|
p.EmailAddress = email;
|
||||||
|
p.CellPhoneNumber = cellphone;
|
||||||
|
|
||||||
|
GlobalConfig.Connection.CreatePerson(p);
|
||||||
|
|
||||||
|
//TODO - Send results back to parent and close
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,7 +18,8 @@ namespace TrackerWPFUI.ViewModels
|
|||||||
GlobalConfig.InitializeConnections(DatabaseType.Sql);
|
GlobalConfig.InitializeConnections(DatabaseType.Sql);
|
||||||
_existingTournaments = new BindableCollection<TournamentModel>(GlobalConfig.Connection.GetTournament_All());
|
_existingTournaments = new BindableCollection<TournamentModel>(GlobalConfig.Connection.GetTournament_All());
|
||||||
//ActivateItem(new CreatePrizeViewModel());
|
//ActivateItem(new CreatePrizeViewModel());
|
||||||
ActivateItem(new CreateTeamViewModel());
|
//ActivateItem(new CreateTeamViewModel());
|
||||||
|
ActivateItem(new CreatePersonViewModel());
|
||||||
}
|
}
|
||||||
public void CreateTournament()
|
public void CreateTournament()
|
||||||
{
|
{
|
||||||
|
|||||||
46
TrackerWPFUI/Views/CreatePersonView.xaml
Normal file
46
TrackerWPFUI/Views/CreatePersonView.xaml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<UserControl x:Class="TrackerWPFUI.Views.CreatePersonView"
|
||||||
|
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:TrackerWPFUI.Views"
|
||||||
|
mc:Ignorable="d" Background="White"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<TextBlock FontSize="24" Margin="0 0 0 10" >Create Person</TextBlock>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="auto"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!--row 0-->
|
||||||
|
<TextBlock Margin="5 0 10 10" Grid.Column="0" Grid.Row="0">First Name</TextBlock>
|
||||||
|
<TextBox x:Name="FirstName" Margin="0 0 5 10" Grid.Column="1" Grid.Row="0"></TextBox>
|
||||||
|
<!--row 1-->
|
||||||
|
<TextBlock Margin="5 0 10 10" Grid.Column="0" Grid.Row="1">Last Name</TextBlock>
|
||||||
|
<TextBox x:Name="LastName" Margin="0 0 5 10" Grid.Column="1" Grid.Row="1"></TextBox>
|
||||||
|
<!--row 2-->
|
||||||
|
<TextBlock Margin="5 0 10 10" Grid.Column="0" Grid.Row="2">Email</TextBlock>
|
||||||
|
<TextBox x:Name="Email" Margin="0 0 5 10" Grid.Column="2" Grid.Row="2"></TextBox>
|
||||||
|
<!--row 3-->
|
||||||
|
<TextBlock Margin="5 0 10 10" Grid.Column="0" Grid.Row="3">Cellphone</TextBlock>
|
||||||
|
<TextBox x:Name="Cellphone" Margin="0 0 5 10" Grid.Column="2" Grid.Row="3"></TextBox>
|
||||||
|
<!--row 4-->
|
||||||
|
<Button x:Name="CreatePerson" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2" Padding="10" Margin="5 0 ">
|
||||||
|
Create Person
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
TrackerWPFUI/Views/CreatePersonView.xaml.cs
Normal file
28
TrackerWPFUI/Views/CreatePersonView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
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 TrackerWPFUI.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for CreatePersonView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class CreatePersonView : UserControl
|
||||||
|
{
|
||||||
|
public CreatePersonView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,7 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:TrackerWPFUI.Views"
|
xmlns:local="clr-namespace:TrackerWPFUI.Views"
|
||||||
mc:Ignorable="d" Background="White"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:TrackerWPFUI.Views"
|
xmlns:local="clr-namespace:TrackerWPFUI.Views"
|
||||||
mc:Ignorable="d" Background="White"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="300" d:DesignWidth="300">
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Orientation="Vertical" >
|
<StackPanel Orientation="Vertical" >
|
||||||
|
|||||||
Reference in New Issue
Block a user