Compare commits
10 Commits
bd0c6f0a7c
...
d401a56dc2
| Author | SHA1 | Date | |
|---|---|---|---|
| d401a56dc2 | |||
| 70a4f3cd42 | |||
| 8040d47acb | |||
| 1207617a7c | |||
| bcb1a561d4 | |||
| 8ae6337c00 | |||
| 94056f5f08 | |||
| c13e2f3ccb | |||
| effdbe02b4 | |||
| 6a4b3fc422 |
@ -172,6 +172,7 @@
|
|||||||
<Content Include="Content\bootstrap-reboot.css.map" />
|
<Content Include="Content\bootstrap-reboot.css.map" />
|
||||||
<Content Include="Content\bootstrap-grid.min.css.map" />
|
<Content Include="Content\bootstrap-grid.min.css.map" />
|
||||||
<Content Include="Content\bootstrap-grid.css.map" />
|
<Content Include="Content\bootstrap-grid.css.map" />
|
||||||
|
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
|
||||||
<None Include="Scripts\jquery-3.5.0.intellisense.js" />
|
<None Include="Scripts\jquery-3.5.0.intellisense.js" />
|
||||||
<Content Include="Scripts\jquery-3.5.0.js" />
|
<Content Include="Scripts\jquery-3.5.0.js" />
|
||||||
<Content Include="Scripts\jquery-3.5.0.min.js" />
|
<Content Include="Scripts\jquery-3.5.0.min.js" />
|
||||||
|
|||||||
@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackerUI", "TrackerUI\Trac
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVCUI", "MVCUI\MVCUI.csproj", "{2D8CCD92-CE52-4D5E-840A-AFD1FED830E0}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVCUI", "MVCUI\MVCUI.csproj", "{2D8CCD92-CE52-4D5E-840A-AFD1FED830E0}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackerWPFUI", "TrackerWPFUI\TrackerWPFUI.csproj", "{C898495C-BFE3-45B2-9E18-552423D5F03F}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -27,6 +29,10 @@ Global
|
|||||||
{2D8CCD92-CE52-4D5E-840A-AFD1FED830E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2D8CCD92-CE52-4D5E-840A-AFD1FED830E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2D8CCD92-CE52-4D5E-840A-AFD1FED830E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2D8CCD92-CE52-4D5E-840A-AFD1FED830E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2D8CCD92-CE52-4D5E-840A-AFD1FED830E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2D8CCD92-CE52-4D5E-840A-AFD1FED830E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C898495C-BFE3-45B2-9E18-552423D5F03F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C898495C-BFE3-45B2-9E18-552423D5F03F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C898495C-BFE3-45B2-9E18-552423D5F03F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C898495C-BFE3-45B2-9E18-552423D5F03F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@ -12,8 +12,9 @@
|
|||||||
</appSettings>
|
</appSettings>
|
||||||
<connectionStrings>
|
<connectionStrings>
|
||||||
<!--<add name="Tournaments" connectionString="Server=TOMMYASUS\SQLEXPR2017;Database=Tournaments;Trusted_Connection=True;" providerName="System.Data.SqlClient"/>-->
|
<!--<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" />
|
<!--<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-->
|
<!--Data Source=TOMMYASUS\SQLEXPR2017;Initial Catalog=Tournaments;Integrated Security=True-->
|
||||||
|
<add name="Tournaments" connectionString="Server=oemansv7win;Database=Tournaments;User ID=SA;Password=SAoemansv7SA;" providerName="System.Data.SqlClient"/>
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
<system.net>
|
<system.net>
|
||||||
<mailSettings>
|
<mailSettings>
|
||||||
|
|||||||
29
TrackerWPFUI/App.config
Normal file
29
TrackerWPFUI/App.config
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<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>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
14
TrackerWPFUI/App.xaml
Normal file
14
TrackerWPFUI/App.xaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<Application x:Class="TrackerWPFUI.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:TrackerWPFUI">
|
||||||
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<local:BootStrapper x:Key="BootStrapper" />
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
17
TrackerWPFUI/App.xaml.cs
Normal file
17
TrackerWPFUI/App.xaml.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace TrackerWPFUI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
24
TrackerWPFUI/BootStrapper.cs
Normal file
24
TrackerWPFUI/BootStrapper.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using Caliburn.Micro;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using TrackerWPFUI.ViewModels;
|
||||||
|
|
||||||
|
namespace TrackerWPFUI
|
||||||
|
{
|
||||||
|
public class BootStrapper:BootstrapperBase
|
||||||
|
{
|
||||||
|
public BootStrapper()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStartup(object sender, StartupEventArgs e)
|
||||||
|
{
|
||||||
|
DisplayRootViewFor<ShellViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
55
TrackerWPFUI/Properties/AssemblyInfo.cs
Normal file
55
TrackerWPFUI/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("TrackerWPFUI")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("TrackerWPFUI")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
//In order to begin building localizable applications, set
|
||||||
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
71
TrackerWPFUI/Properties/Resources.Designer.cs
generated
Normal file
71
TrackerWPFUI/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace TrackerWPFUI.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TrackerWPFUI.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
117
TrackerWPFUI/Properties/Resources.resx
Normal file
117
TrackerWPFUI/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
30
TrackerWPFUI/Properties/Settings.Designer.cs
generated
Normal file
30
TrackerWPFUI/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace TrackerWPFUI.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
TrackerWPFUI/Properties/Settings.settings
Normal file
7
TrackerWPFUI/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
BIN
TrackerWPFUI/TournamentTracker.ico
Normal file
BIN
TrackerWPFUI/TournamentTracker.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
170
TrackerWPFUI/TrackerWPFUI.csproj
Normal file
170
TrackerWPFUI/TrackerWPFUI.csproj
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{C898495C-BFE3-45B2-9E18-552423D5F03F}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>TrackerWPFUI</RootNamespace>
|
||||||
|
<AssemblyName>TrackerWPFUI</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationIcon>TournamentTracker.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Caliburn.Micro.Platform, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Caliburn.Micro.Platform.Core, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\Caliburn.Micro.Platform.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xaml">
|
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Compile Include="BootStrapper.cs" />
|
||||||
|
<Compile Include="EventAggregationProvider.cs" />
|
||||||
|
<Compile Include="ViewModels\CreatePersonViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\CreatePrizeViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\CreateTeamViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\CreateTournamentViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\TournamentViewerViewModel.cs" />
|
||||||
|
<Compile Include="Views\CreatePersonView.xaml.cs">
|
||||||
|
<DependentUpon>CreatePersonView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\CreatePrizeView.xaml.cs">
|
||||||
|
<DependentUpon>CreatePrizeView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\CreateTeamView.xaml.cs">
|
||||||
|
<DependentUpon>CreateTeamView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\CreateTournamentView.xaml.cs">
|
||||||
|
<DependentUpon>CreateTournamentView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\ShellView.xaml.cs">
|
||||||
|
<DependentUpon>ShellView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\TournamentViewerView.xaml.cs">
|
||||||
|
<DependentUpon>TournamentViewerView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Page Include="Views\CreatePersonView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\CreatePrizeView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\CreateTeamView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\CreateTournamentView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\ShellView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\TournamentViewerView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Models\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="TournamentTracker.ico">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
|
</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" />
|
||||||
|
</Project>
|
||||||
88
TrackerWPFUI/ViewModels/CreatePersonViewModel.cs
Normal file
88
TrackerWPFUI/ViewModels/CreatePersonViewModel.cs
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
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 void CancelCreation()
|
||||||
|
{
|
||||||
|
EventAggregationProvider.TrackerEventAggregator.PublishOnUIThread(new PersonModel());
|
||||||
|
this.TryClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
EventAggregationProvider.TrackerEventAggregator.PublishOnUIThread(p);
|
||||||
|
this.TryClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
110
TrackerWPFUI/ViewModels/CreatePrizeViewModel.cs
Normal file
110
TrackerWPFUI/ViewModels/CreatePrizeViewModel.cs
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
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 CreatePrizeViewModel : Screen
|
||||||
|
{
|
||||||
|
private int _placeNumber;
|
||||||
|
private string _placeName;
|
||||||
|
private decimal _prizeAmount;
|
||||||
|
private double _prizePercentage;
|
||||||
|
|
||||||
|
|
||||||
|
public int PlaceNumber
|
||||||
|
{
|
||||||
|
get { return _placeNumber; }
|
||||||
|
set {
|
||||||
|
_placeNumber = value;
|
||||||
|
NotifyOfPropertyChange(() => PlaceNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string PlaceName
|
||||||
|
{
|
||||||
|
get { return _placeName; }
|
||||||
|
set { _placeName = value;
|
||||||
|
NotifyOfPropertyChange(() => PlaceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public decimal PrizeAmount
|
||||||
|
{
|
||||||
|
get { return _prizeAmount; }
|
||||||
|
set { _prizeAmount = value;
|
||||||
|
NotifyOfPropertyChange(() => PrizeAmount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double PrizePercentage
|
||||||
|
{
|
||||||
|
get { return _prizePercentage; }
|
||||||
|
set { _prizePercentage = value;
|
||||||
|
NotifyOfPropertyChange(() => PrizePercentage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CancelCreation()
|
||||||
|
{
|
||||||
|
EventAggregationProvider.TrackerEventAggregator.PublishOnCurrentThread(new PrizeModel());
|
||||||
|
this.TryClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanCreatePrize(int placeNumber, string placeName, decimal prizeAmount, double prizePercentage)
|
||||||
|
{
|
||||||
|
return ValidateForm(placeNumber, placeName, prizeAmount, prizePercentage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreatePrize(int placeNumber, string placeName, decimal prizeAmount, double prizePercentage)
|
||||||
|
{
|
||||||
|
PrizeModel model = new PrizeModel
|
||||||
|
{
|
||||||
|
PlaceNumber = placeNumber,
|
||||||
|
PlaceName = placeName,
|
||||||
|
PrizeAmount = prizeAmount,
|
||||||
|
PrizePercentage = prizePercentage
|
||||||
|
};
|
||||||
|
GlobalConfig.Connection.CreatePrize(model);
|
||||||
|
|
||||||
|
EventAggregationProvider.TrackerEventAggregator.PublishOnCurrentThread(model);
|
||||||
|
this.TryClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ValidateForm(int placeNumber, string placeName, decimal prizeAmount, double prizePercentage)
|
||||||
|
{
|
||||||
|
bool output = true;
|
||||||
|
|
||||||
|
|
||||||
|
if (placeNumber < 1)
|
||||||
|
{
|
||||||
|
output = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placeName.Length == 0)
|
||||||
|
{
|
||||||
|
output = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prizeAmount <= 0 && prizePercentage <= 0)
|
||||||
|
{
|
||||||
|
output = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prizePercentage < 0 || prizePercentage > 100)
|
||||||
|
{
|
||||||
|
output = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
189
TrackerWPFUI/ViewModels/CreateTeamViewModel.cs
Normal file
189
TrackerWPFUI/ViewModels/CreateTeamViewModel.cs
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
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 CreateTeamViewModel : Conductor<object>, IHandle<PersonModel>
|
||||||
|
{
|
||||||
|
private string _teamName = "";
|
||||||
|
private BindableCollection<PersonModel> _availableTeamMembers;
|
||||||
|
private PersonModel _selectedTeamMemberToAdd;
|
||||||
|
private BindableCollection<PersonModel> _selectedTeamMembers = new BindableCollection<PersonModel>();
|
||||||
|
private PersonModel _selectedTeamMemberToRemove;
|
||||||
|
private bool _selectedTeamMembersIsVisible = true;
|
||||||
|
private bool _addPersonIsVisible = false;
|
||||||
|
|
||||||
|
|
||||||
|
public CreateTeamViewModel()
|
||||||
|
{
|
||||||
|
AvailableTeamMembers = new BindableCollection<PersonModel>(GlobalConfig.Connection.GetPerson_All());
|
||||||
|
EventAggregationProvider.TrackerEventAggregator.Subscribe(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string TeamName
|
||||||
|
{
|
||||||
|
get { return _teamName; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_teamName = value;
|
||||||
|
NotifyOfPropertyChange(() => TeamName);
|
||||||
|
NotifyOfPropertyChange(() => CanCreateTeam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SelectedTeamMembersIsVisible
|
||||||
|
{
|
||||||
|
get { return _selectedTeamMembersIsVisible; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedTeamMembersIsVisible = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedTeamMembersIsVisible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AddPersonIsVisible
|
||||||
|
{
|
||||||
|
get { return _addPersonIsVisible; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_addPersonIsVisible = value;
|
||||||
|
NotifyOfPropertyChange(() => AddPersonIsVisible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<PersonModel> AvailableTeamMembers
|
||||||
|
{
|
||||||
|
get { return _availableTeamMembers; }
|
||||||
|
set { _availableTeamMembers = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public BindableCollection<PersonModel> SelectedTeamMembers
|
||||||
|
{
|
||||||
|
get { return _selectedTeamMembers; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedTeamMembers = value;
|
||||||
|
NotifyOfPropertyChange(() => CanCreateTeam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public PersonModel SelectedTeamMemberToAdd
|
||||||
|
{
|
||||||
|
get { return _selectedTeamMemberToAdd; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedTeamMemberToAdd = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedTeamMemberToAdd);
|
||||||
|
NotifyOfPropertyChange(() => CanAddMember);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanAddMember
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return SelectedTeamMemberToAdd != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddMember()
|
||||||
|
{
|
||||||
|
SelectedTeamMembers.Add(SelectedTeamMemberToAdd);
|
||||||
|
AvailableTeamMembers.Remove(SelectedTeamMemberToAdd);
|
||||||
|
NotifyOfPropertyChange(() => CanCreateTeam);
|
||||||
|
}
|
||||||
|
public PersonModel SelectedTeamMemberToRemove
|
||||||
|
{
|
||||||
|
get { return _selectedTeamMemberToRemove; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedTeamMemberToRemove = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedTeamMemberToRemove);
|
||||||
|
NotifyOfPropertyChange(() => CanRemoveMember);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanRemoveMember
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return SelectedTeamMemberToRemove != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveMember()
|
||||||
|
{
|
||||||
|
AvailableTeamMembers.Add(SelectedTeamMemberToRemove);
|
||||||
|
SelectedTeamMembers.Remove(SelectedTeamMemberToRemove);
|
||||||
|
NotifyOfPropertyChange(() => CanCreateTeam);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateMember()
|
||||||
|
{
|
||||||
|
ActivateItem(new CreatePersonViewModel());
|
||||||
|
SelectedTeamMembersIsVisible = false;
|
||||||
|
AddPersonIsVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CancelCreation()
|
||||||
|
{
|
||||||
|
EventAggregationProvider.TrackerEventAggregator.PublishOnUIThread(new TeamModel());
|
||||||
|
this.TryClose();
|
||||||
|
}
|
||||||
|
public bool CanCreateTeam
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (SelectedTeamMembers != null)
|
||||||
|
{
|
||||||
|
if (TeamName.Length > 0 && SelectedTeamMembers.Count > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateTeam()
|
||||||
|
{
|
||||||
|
TeamModel t = new TeamModel();
|
||||||
|
t.TeamName = TeamName;
|
||||||
|
t.TeamMembers = SelectedTeamMembers.ToList();
|
||||||
|
|
||||||
|
GlobalConfig.Connection.CreateTeam(t);
|
||||||
|
|
||||||
|
EventAggregationProvider.TrackerEventAggregator.PublishOnUIThread(t);
|
||||||
|
this.TryClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(PersonModel message)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(message.FullName))
|
||||||
|
{
|
||||||
|
SelectedTeamMembers.Add(message);
|
||||||
|
NotifyOfPropertyChange(() => CanCreateTeam);
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectedTeamMembersIsVisible = true;
|
||||||
|
AddPersonIsVisible = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
298
TrackerWPFUI/ViewModels/CreateTournamentViewModel.cs
Normal file
298
TrackerWPFUI/ViewModels/CreateTournamentViewModel.cs
Normal file
@ -0,0 +1,298 @@
|
|||||||
|
using Caliburn.Micro;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using TrackerLibrary;
|
||||||
|
using TrackerLibrary.Models;
|
||||||
|
|
||||||
|
namespace TrackerWPFUI.ViewModels
|
||||||
|
{
|
||||||
|
public class CreateTournamentViewModel : Conductor<object>.Collection.AllActive, IHandle<TeamModel>,IHandle<PrizeModel>
|
||||||
|
{
|
||||||
|
private string _tournamentName = "";
|
||||||
|
private decimal _entryFee;
|
||||||
|
private BindableCollection<TeamModel> _availableTeams;
|
||||||
|
private TeamModel _selectedTeamToAdd;
|
||||||
|
private BindableCollection<TeamModel> _selectedTeams = new BindableCollection<TeamModel>();
|
||||||
|
private TeamModel _selectedTeamToRemove;
|
||||||
|
private Screen _activeAddTeamView;
|
||||||
|
private BindableCollection<PrizeModel> _selectedPrizes = new BindableCollection<PrizeModel>();
|
||||||
|
private PrizeModel _selectedPrizeToRemove;
|
||||||
|
private Screen _activAddPrizeView;
|
||||||
|
private bool _selectedTeamIsVisible =true;
|
||||||
|
private bool _addTeamIsVisible = false;
|
||||||
|
private bool _selectedPrizesIsVisible = true;
|
||||||
|
private bool _addPrizeIsVisible = false;
|
||||||
|
|
||||||
|
|
||||||
|
public CreateTournamentViewModel()
|
||||||
|
{
|
||||||
|
AvailableTeams = new BindableCollection<TeamModel>(GlobalConfig.Connection.GetTeam_All());
|
||||||
|
EventAggregationProvider.TrackerEventAggregator.Subscribe(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TournamentName
|
||||||
|
{
|
||||||
|
get { return _tournamentName; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_tournamentName = value;
|
||||||
|
NotifyOfPropertyChange(() => TournamentName);
|
||||||
|
NotifyOfPropertyChange(() => CanCreateTournament);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal EntryFee
|
||||||
|
{
|
||||||
|
get { return _entryFee; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_entryFee = value;
|
||||||
|
NotifyOfPropertyChange(() => EntryFee);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<TeamModel> AvailableTeams
|
||||||
|
{
|
||||||
|
get { return _availableTeams; }
|
||||||
|
set { _availableTeams = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public TeamModel SelectedTeamToAdd
|
||||||
|
{
|
||||||
|
get { return _selectedTeamToAdd; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedTeamToAdd = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedTeamToAdd);
|
||||||
|
NotifyOfPropertyChange(() => CanAddTeam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<TeamModel> SelectedTeams
|
||||||
|
{
|
||||||
|
get { return _selectedTeams; }
|
||||||
|
set { _selectedTeams = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedTeams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TeamModel SelectedTeamToRemove
|
||||||
|
{
|
||||||
|
get { return _selectedTeamToRemove; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedTeamToRemove = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedTeamToRemove);
|
||||||
|
NotifyOfPropertyChange(() => CanRemoveTeam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Screen ActiveAddTeamView
|
||||||
|
{
|
||||||
|
get { return _activeAddTeamView; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_activeAddTeamView = value;
|
||||||
|
NotifyOfPropertyChange(() => ActiveAddTeamView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<PrizeModel> SelectedPrizes
|
||||||
|
{
|
||||||
|
get { return _selectedPrizes; }
|
||||||
|
set { _selectedPrizes = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrizeModel SelectedPrizeToRemove
|
||||||
|
{
|
||||||
|
get { return _selectedPrizeToRemove; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedPrizeToRemove = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedPrizeToRemove);
|
||||||
|
NotifyOfPropertyChange(() => CanRemovePrize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Screen ActiveAddPrizeView
|
||||||
|
{
|
||||||
|
get { return _activAddPrizeView; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_activAddPrizeView = value;
|
||||||
|
NotifyOfPropertyChange(() => ActiveAddPrizeView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool SelectedTeamIsVisible
|
||||||
|
{
|
||||||
|
get { return _selectedTeamIsVisible; }
|
||||||
|
set { _selectedTeamIsVisible = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedTeamIsVisible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AddTeamIsVisible
|
||||||
|
{
|
||||||
|
get { return _addTeamIsVisible; }
|
||||||
|
set { _addTeamIsVisible = value;
|
||||||
|
NotifyOfPropertyChange(() => AddTeamIsVisible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool SelectedPrizesIsVisible
|
||||||
|
{
|
||||||
|
get { return _selectedPrizesIsVisible; }
|
||||||
|
set { _selectedPrizesIsVisible = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedPrizesIsVisible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AddPrizeIsVisible
|
||||||
|
{
|
||||||
|
get { return _addPrizeIsVisible; }
|
||||||
|
set { _addPrizeIsVisible = value;
|
||||||
|
NotifyOfPropertyChange(() => AddPrizeIsVisible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool CanAddTeam
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return SelectedTeamToAdd != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void AddTeam()
|
||||||
|
{
|
||||||
|
SelectedTeams.Add(SelectedTeamToAdd);
|
||||||
|
AvailableTeams.Remove(SelectedTeamToAdd);
|
||||||
|
NotifyOfPropertyChange(() => CanCreateTournament);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateTeam()
|
||||||
|
{
|
||||||
|
ActiveAddTeamView = new CreateTeamViewModel();
|
||||||
|
Items.Add(ActiveAddTeamView);
|
||||||
|
|
||||||
|
SelectedTeamIsVisible = false;
|
||||||
|
AddTeamIsVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanRemoveTeam
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return SelectedTeamToRemove != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void RemoveTeam()
|
||||||
|
{
|
||||||
|
AvailableTeams.Add(SelectedTeamToRemove);
|
||||||
|
SelectedTeams.Remove(SelectedTeamToRemove);
|
||||||
|
NotifyOfPropertyChange(() => CanCreateTournament);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreatePrize()
|
||||||
|
{
|
||||||
|
ActiveAddPrizeView = new CreatePrizeViewModel();
|
||||||
|
Items.Add(ActiveAddPrizeView);
|
||||||
|
|
||||||
|
SelectedPrizesIsVisible = false;
|
||||||
|
AddPrizeIsVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanRemovePrize
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return SelectedPrizeToRemove != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemovePrize()
|
||||||
|
{
|
||||||
|
SelectedPrizes.Remove(SelectedPrizeToRemove);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanCreateTournament
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if(SelectedTeams != null)
|
||||||
|
{
|
||||||
|
if (TournamentName.Length > 0 && SelectedTeams.Count > 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateTournament()
|
||||||
|
{
|
||||||
|
|
||||||
|
// Create our tournament model
|
||||||
|
TournamentModel tm = new TournamentModel();
|
||||||
|
|
||||||
|
tm.TournamentName = TournamentName;
|
||||||
|
tm.EntryFee = EntryFee;
|
||||||
|
tm.Prizes = SelectedPrizes.ToList();
|
||||||
|
tm.EnteredTeams = SelectedTeams.ToList();
|
||||||
|
|
||||||
|
// TODO Wireup our matchups
|
||||||
|
|
||||||
|
TournamentLogic.CreateRounds(tm);
|
||||||
|
|
||||||
|
// Finally create the tournament entry
|
||||||
|
// Create all of the prizes entries
|
||||||
|
// Create all of team entries
|
||||||
|
GlobalConfig.Connection.CreateTournament(tm);
|
||||||
|
|
||||||
|
tm.AlertUsersToNewRound();
|
||||||
|
|
||||||
|
EventAggregationProvider.TrackerEventAggregator.PublishOnUIThread(tm);
|
||||||
|
this.TryClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(TeamModel message)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(message.TeamName))
|
||||||
|
{
|
||||||
|
SelectedTeams.Add(message);
|
||||||
|
NotifyOfPropertyChange(() => CanCreateTournament);
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectedTeamIsVisible = true;
|
||||||
|
AddTeamIsVisible = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(PrizeModel message)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(message.PlaceName))
|
||||||
|
{
|
||||||
|
SelectedPrizes.Add(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectedPrizesIsVisible = true;
|
||||||
|
AddPrizeIsVisible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
68
TrackerWPFUI/ViewModels/ShellViewModel.cs
Normal file
68
TrackerWPFUI/ViewModels/ShellViewModel.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
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 ShellViewModel : Conductor<object>,IHandle<TournamentModel> //ActiveItem in Itemcontrol tells whats going on
|
||||||
|
{
|
||||||
|
|
||||||
|
public ShellViewModel()
|
||||||
|
{
|
||||||
|
// Initialize the database connections
|
||||||
|
GlobalConfig.InitializeConnections(DatabaseType.Sql);
|
||||||
|
|
||||||
|
EventAggregationProvider.TrackerEventAggregator.Subscribe(this);
|
||||||
|
|
||||||
|
_existingTournaments = new BindableCollection<TournamentModel>(GlobalConfig.Connection.GetTournament_All());
|
||||||
|
//ActivateItem(new CreatePrizeViewModel());
|
||||||
|
//ActivateItem(new CreateTeamViewModel());
|
||||||
|
//ActivateItem(new CreatePersonViewModel());
|
||||||
|
}
|
||||||
|
public void CreateTournament()
|
||||||
|
{
|
||||||
|
ActivateItem(new CreateTournamentViewModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadTournament()
|
||||||
|
{
|
||||||
|
if (SelectedTournament !=null && !string.IsNullOrWhiteSpace(SelectedTournament.TournamentName))
|
||||||
|
{
|
||||||
|
ActivateItem(new TournamentViewerViewModel(SelectedTournament));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(TournamentModel message)
|
||||||
|
{
|
||||||
|
// Open the tournamentViewer to the given tournament
|
||||||
|
ExistingTournaments.Add(message);
|
||||||
|
SelectedTournament = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BindableCollection<TournamentModel> _existingTournaments;
|
||||||
|
private TournamentModel _SelectedTournament;
|
||||||
|
|
||||||
|
public BindableCollection<TournamentModel> ExistingTournaments
|
||||||
|
{
|
||||||
|
get { return _existingTournaments; }
|
||||||
|
set { _existingTournaments = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TournamentModel SelectedTournament
|
||||||
|
{
|
||||||
|
get { return _SelectedTournament; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_SelectedTournament = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedTournament);
|
||||||
|
LoadTournament();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
249
TrackerWPFUI/ViewModels/TournamentViewerViewModel.cs
Normal file
249
TrackerWPFUI/ViewModels/TournamentViewerViewModel.cs
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
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 TournamentViewerViewModel : Screen
|
||||||
|
{
|
||||||
|
public TournamentModel Tournament { get; set; }
|
||||||
|
|
||||||
|
private string _tournamentName;
|
||||||
|
private BindableCollection<int> _rounds = new BindableCollection<int>();
|
||||||
|
private BindableCollection<MatchupModel> _matchups = new BindableCollection<MatchupModel>();
|
||||||
|
private bool _unplayedOnly;
|
||||||
|
private string _teamOne;
|
||||||
|
private string _teamTwo;
|
||||||
|
private double _teamOneScore;
|
||||||
|
private double _teamTwoScore;
|
||||||
|
private MatchupModel _selectedMatchup;
|
||||||
|
private int _selectedRound = 0;
|
||||||
|
|
||||||
|
public TournamentViewerViewModel(TournamentModel model)
|
||||||
|
{
|
||||||
|
Tournament = model;
|
||||||
|
TournamentName = model.TournamentName;
|
||||||
|
LoadRounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TournamentName
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
return $"Tournament: {_tournamentName}" ;
|
||||||
|
}
|
||||||
|
set { _tournamentName = value;
|
||||||
|
NotifyOfPropertyChange(() => TournamentName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int SelectedRound
|
||||||
|
{
|
||||||
|
get { return _selectedRound; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedRound = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedRound);
|
||||||
|
LoadMatchups();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MatchupModel SelectedMatchup
|
||||||
|
{
|
||||||
|
get { return _selectedMatchup; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedMatchup = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedMatchup);
|
||||||
|
LoadMatchup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double TeamTwoScore
|
||||||
|
{
|
||||||
|
get { return _teamTwoScore; }
|
||||||
|
set { _teamTwoScore = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public double TeamOneScore
|
||||||
|
{
|
||||||
|
get { return _teamOneScore; }
|
||||||
|
set { _teamOneScore = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TeamTwo
|
||||||
|
{
|
||||||
|
get { return _teamTwo; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_teamTwo = value;
|
||||||
|
NotifyOfPropertyChange(() => TeamTwo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TeamOne
|
||||||
|
{
|
||||||
|
get { return _teamOne; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_teamOne = value;
|
||||||
|
NotifyOfPropertyChange(() => TeamOne);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool UnplayedOnly
|
||||||
|
{
|
||||||
|
get { return _unplayedOnly; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_unplayedOnly = value;
|
||||||
|
NotifyOfPropertyChange(() => UnplayedOnly);
|
||||||
|
LoadMatchups();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<MatchupModel> Matchups
|
||||||
|
{
|
||||||
|
get { return _matchups; }
|
||||||
|
set { _matchups = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<int> Rounds
|
||||||
|
{
|
||||||
|
get { return _rounds; }
|
||||||
|
set { _rounds = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadRounds()
|
||||||
|
{
|
||||||
|
Rounds.Clear();
|
||||||
|
|
||||||
|
Rounds.Add(1);
|
||||||
|
int currRound = 1;
|
||||||
|
foreach (List<MatchupModel> matchups in Tournament.Rounds)
|
||||||
|
{
|
||||||
|
if (matchups.First().MatchupRound > currRound)
|
||||||
|
{
|
||||||
|
currRound = matchups.First().MatchupRound;
|
||||||
|
Rounds.Add(currRound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectedRound = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadMatchups()
|
||||||
|
{
|
||||||
|
foreach (List<MatchupModel> matchups in Tournament.Rounds)
|
||||||
|
{
|
||||||
|
if (matchups.First().MatchupRound == SelectedRound)
|
||||||
|
{
|
||||||
|
//loading = true;
|
||||||
|
Matchups.Clear();
|
||||||
|
foreach (MatchupModel mm in matchups)
|
||||||
|
{
|
||||||
|
if (mm.Winner == null || !UnplayedOnly)
|
||||||
|
{
|
||||||
|
Matchups.Add(mm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//loading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Matchups.Count > 0)
|
||||||
|
{
|
||||||
|
SelectedMatchup = Matchups.First();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadMatchup()
|
||||||
|
{
|
||||||
|
//if (!loading)
|
||||||
|
//{
|
||||||
|
if (SelectedMatchup == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < SelectedMatchup.Entries.Count; i++)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
if (SelectedMatchup.Entries[0].TeamCompeting != null)
|
||||||
|
{
|
||||||
|
TeamOne = SelectedMatchup.Entries[0].TeamCompeting.TeamName;
|
||||||
|
TeamOneScore = SelectedMatchup.Entries[0].Score;
|
||||||
|
|
||||||
|
TeamTwo = "<bye>";
|
||||||
|
TeamTwoScore = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TeamOne = "Not Yet Set";
|
||||||
|
TeamOneScore = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == 1)
|
||||||
|
{
|
||||||
|
if (SelectedMatchup.Entries[1].TeamCompeting != null)
|
||||||
|
{
|
||||||
|
TeamTwo = SelectedMatchup.Entries[1].TeamCompeting.TeamName;
|
||||||
|
TeamTwoScore = SelectedMatchup.Entries[1].Score;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TeamTwo = "Not Yet Set";
|
||||||
|
TeamTwoScore = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ScoreMatch()
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int i = 0; i < SelectedMatchup.Entries.Count; i++)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
if (SelectedMatchup.Entries[0].TeamCompeting != null)
|
||||||
|
{
|
||||||
|
SelectedMatchup.Entries[0].Score = TeamOneScore;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == 1)
|
||||||
|
{
|
||||||
|
if (SelectedMatchup.Entries[1].TeamCompeting != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
SelectedMatchup.Entries[1].Score = TeamTwoScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TournamentLogic.UpdateTournamentResults(Tournament);
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show($"The application had the following error :{ex.Message}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadMatchups();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
51
TrackerWPFUI/Views/CreatePersonView.xaml
Normal file
51
TrackerWPFUI/Views/CreatePersonView.xaml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<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-->
|
||||||
|
<StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2" Margin="5 0 " HorizontalAlignment="Center">
|
||||||
|
<Button x:Name="CreatePerson" Padding="10" Margin="0 0 5 0">
|
||||||
|
Create Person
|
||||||
|
</Button>
|
||||||
|
<Button x:Name="CancelCreation" Padding="10" Background="Red" Foreground="White" Margin="5 0 0 0">
|
||||||
|
Cancel Person
|
||||||
|
</Button>
|
||||||
|
</StackPanel >
|
||||||
|
</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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
61
TrackerWPFUI/Views/CreatePrizeView.xaml
Normal file
61
TrackerWPFUI/Views/CreatePrizeView.xaml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<UserControl x:Class="TrackerWPFUI.Views.CreatePrizeView"
|
||||||
|
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"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<TextBlock FontSize="24" Margin="0 0 0 10" >Create Prize</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">Place Number</TextBlock>
|
||||||
|
<TextBox x:Name="PlaceNumber" 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">Place Name</TextBlock>
|
||||||
|
<TextBox x:Name="PlaceName" 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">Prize Amount</TextBlock>
|
||||||
|
<TextBox x:Name="PrizeAmount" Margin="0 0 5 10" Grid.Column="2" Grid.Row="2"></TextBox>
|
||||||
|
<!--row 3-->
|
||||||
|
<TextBlock Margin="5 0 5 10" Grid.Column="0" Grid.Row="3"
|
||||||
|
HorizontalAlignment="Center" Grid.ColumnSpan="2">
|
||||||
|
-- OR --
|
||||||
|
</TextBlock>
|
||||||
|
<!--row 4-->
|
||||||
|
<TextBlock Margin="5 0 10 10" Grid.Column="0" Grid.Row="4">Prize Percentage</TextBlock>
|
||||||
|
<TextBox x:Name="PrizePercentage" Margin="0 0 5 10" Grid.Column="2" Grid.Row="4"></TextBox>
|
||||||
|
<!--row 5-->
|
||||||
|
<StackPanel Orientation="Horizontal" Grid.Column="0"
|
||||||
|
Grid.Row="5" Grid.ColumnSpan="2" Margin="5 0"
|
||||||
|
HorizontalAlignment="Center">
|
||||||
|
<Button x:Name="CreatePrize" Padding="10" Margin="0 0 5 0 ">
|
||||||
|
Create Prize
|
||||||
|
</Button>
|
||||||
|
<Button x:Name="CancelCreation" Padding="10" Margin="5 0 " Background="Red" Foreground="White">
|
||||||
|
Cancel Prize
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
<!--<Button x:Name="CreatePrize" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="2" Padding="10" Margin="5 0 ">
|
||||||
|
Create Prize
|
||||||
|
</Button>-->
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
TrackerWPFUI/Views/CreatePrizeView.xaml.cs
Normal file
28
TrackerWPFUI/Views/CreatePrizeView.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 CreatePrizeView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class CreatePrizeView : UserControl
|
||||||
|
{
|
||||||
|
public CreatePrizeView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
43
TrackerWPFUI/Views/CreateTeamView.xaml
Normal file
43
TrackerWPFUI/Views/CreateTeamView.xaml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<UserControl x:Class="TrackerWPFUI.Views.CreateTeamView"
|
||||||
|
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"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
<Grid>
|
||||||
|
<StackPanel Orientation="Vertical" >
|
||||||
|
<TextBlock FontSize="24">Create Team</TextBlock>
|
||||||
|
<TextBlock Margin="5 0 5 5">Team Name</TextBlock>
|
||||||
|
<TextBox x:Name="TeamName" Margin="5 0 5 10 "></TextBox>
|
||||||
|
<TextBlock Margin="5 0 5 5">Select Team Member</TextBlock>
|
||||||
|
<ComboBox x:Name="AvailableTeamMembers" Margin="5 0 5 10"
|
||||||
|
SelectedItem="{Binding Path=SelectedTeamMemberToAdd, Mode=OneWayToSource}"
|
||||||
|
DisplayMemberPath="FullName"/>
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
|
<Button x:Name="AddMember" Padding="5" Margin="0 0 5 0">Add Member</Button>
|
||||||
|
<Button x:Name="CreateMember" Padding="5" >Create Member</Button>
|
||||||
|
<Button x:Name="RemoveMember" Padding="5" Margin="5 0 0 0">Remove Member</Button>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel x:Name="SelectedTeamMembersIsVisible" Orientation="Vertical" Margin="5 10 5 0">
|
||||||
|
<TextBlock Margin="0 0 0 10" >Selected Team Members</TextBlock>
|
||||||
|
<ListBox x:Name="SelectedTeamMembers" DisplayMemberPath="FullName"
|
||||||
|
MinHeight="20"
|
||||||
|
SelectedItem="{Binding Path=SelectedTeamMemberToRemove, Mode=TwoWay}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel x:Name="AddPersonIsVisible" Orientation="Vertical" Margin="5 10 5 0">
|
||||||
|
<ContentControl x:Name="ActiveItem"/>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="5 10 5 5" HorizontalAlignment="Center">
|
||||||
|
<Button x:Name="CreateTeam" Padding="5" Margin="0 0 5 0" >
|
||||||
|
Create Team
|
||||||
|
</Button>
|
||||||
|
<Button x:Name="CancelCreation" Background="Red" Foreground="White"
|
||||||
|
Margin="5 0 0 0" Padding="5" >
|
||||||
|
Cancel Team
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
TrackerWPFUI/Views/CreateTeamView.xaml.cs
Normal file
28
TrackerWPFUI/Views/CreateTeamView.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 CreateTeamView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class CreateTeamView : UserControl
|
||||||
|
{
|
||||||
|
public CreateTeamView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
80
TrackerWPFUI/Views/CreateTournamentView.xaml
Normal file
80
TrackerWPFUI/Views/CreateTournamentView.xaml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<UserControl x:Class="TrackerWPFUI.Views.CreateTournamentView"
|
||||||
|
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="500" d:DesignWidth="600">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="auto" />
|
||||||
|
<ColumnDefinition Width="auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!-- Row 0 -->
|
||||||
|
<TextBlock FontSize="28" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Center">Create Tournament</TextBlock>
|
||||||
|
<!-- Row 1 -->
|
||||||
|
<StackPanel Orientation="Vertical" Grid.Column="0" Grid.Row="1" Margin="0 10 10 10">
|
||||||
|
<TextBlock FontSize="22" >General Info</TextBlock>
|
||||||
|
<TextBlock Margin="5 0 5 5">Tournament Name</TextBlock>
|
||||||
|
<TextBox x:Name="TournamentName" Margin="5 0 5 10 "></TextBox>
|
||||||
|
<TextBlock Margin="5 0 5 5">Entry Fee</TextBlock>
|
||||||
|
<TextBox x:Name="EntryFee" Margin="5 0 5 10 "></TextBox>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Vertical" Grid.Column="1" Grid.Row="1" Margin="0 10">
|
||||||
|
<StackPanel x:Name="SelectedTeamsIsVisible" Orientation="Vertical">
|
||||||
|
<TextBlock FontSize="22" >Teams Section</TextBlock>
|
||||||
|
<!--<TextBox x:Name="TeamName" Margin="5 0 5 10 "></TextBox>-->
|
||||||
|
<TextBlock Margin="5 0 5 5">Select Team</TextBlock>
|
||||||
|
<ComboBox x:Name="AvailableTeams" Margin="5 0 5 10"
|
||||||
|
SelectedItem="{Binding Path=SelectedTeamToAdd, Mode=OneWayToSource}"
|
||||||
|
DisplayMemberPath="TeamName"/>
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
|
<Button x:Name="AddTeam" Padding="5" Margin="0 0 5 0">Add Team</Button>
|
||||||
|
<Button x:Name="CreateTeam" Padding="5" >Create Team</Button>
|
||||||
|
<Button x:Name="RemoveTeam" Padding="5" Margin="5 0 0 0">Remove Team</Button>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Vertical" Margin="5 10 5 0">
|
||||||
|
<TextBlock Margin="0 0 0 10" >Selected Teams</TextBlock>
|
||||||
|
<ListBox x:Name="SelectedTeams" DisplayMemberPath="TeamName"
|
||||||
|
MinHeight="20"
|
||||||
|
SelectedItem="{Binding Path=SelectedTeamToRemove, Mode=TwoWay}" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel x:Name="AddTeamIsVisible" Orientation="Vertical" Margin="5 10 5 0">
|
||||||
|
<ContentControl x:Name="ActiveAddTeamView"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Vertical" Grid.Column="2" Grid.Row="1" Margin="10 10 0 10">
|
||||||
|
<StackPanel x:Name="SelectedPrizesIsVisible" Orientation="Vertical">
|
||||||
|
<TextBlock FontSize="22" >Prizes Section</TextBlock>
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
|
<Button x:Name="CreatePrize" Padding="5" Margin="0 0 5 0">Create Prize</Button>
|
||||||
|
<Button x:Name="RemovePrize" Padding="5" Margin="5 0 0 0">Remove Prize</Button>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Vertical" Margin="5 10 5 0">
|
||||||
|
<TextBlock Margin="0 0 0 10" >Selected Prizes</TextBlock>
|
||||||
|
<ListBox x:Name="SelectedPrizes" DisplayMemberPath="PlaceName"
|
||||||
|
MinHeight="20"
|
||||||
|
SelectedItem="{Binding Path=SelectedPrizeToRemove, Mode=TwoWay}" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel x:Name="AddPrizeIsVisible" Orientation="Vertical" Margin="5 0 5 0">
|
||||||
|
<ContentControl x:Name="ActiveAddPrizeView"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
<!--Row 2-->
|
||||||
|
<Button x:Name="CreateTournament" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="3"
|
||||||
|
Padding="10" Margin="0 0 0 10">
|
||||||
|
Create Tournament
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
TrackerWPFUI/Views/CreateTournamentView.xaml.cs
Normal file
28
TrackerWPFUI/Views/CreateTournamentView.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 CreateTournamentView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class CreateTournamentView : UserControl
|
||||||
|
{
|
||||||
|
public CreateTournamentView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
43
TrackerWPFUI/Views/ShellView.xaml
Normal file
43
TrackerWPFUI/Views/ShellView.xaml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<Window x:Class="TrackerWPFUI.Views.ShellView"
|
||||||
|
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:TrackerWPFUI.Views" FontSize="18"
|
||||||
|
mc:Ignorable="d" WindowStartupLocation="CenterScreen" Icon="..\TournamentTracker.ico"
|
||||||
|
Title="ShellView" Height="700" Width="1200">
|
||||||
|
<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>
|
||||||
|
<Border Grid.Row="2" Grid.Column="2" BorderThickness="1"
|
||||||
|
Margin="10 10 0 0" BorderBrush="Gray" >
|
||||||
|
<ContentControl x:Name="ActiveItem" Margin="5" />
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
27
TrackerWPFUI/Views/ShellView.xaml.cs
Normal file
27
TrackerWPFUI/Views/ShellView.xaml.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
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.Shapes;
|
||||||
|
|
||||||
|
namespace TrackerWPFUI.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ShellView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ShellView : Window
|
||||||
|
{
|
||||||
|
public ShellView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
68
TrackerWPFUI/Views/TournamentViewerView.xaml
Normal file
68
TrackerWPFUI/Views/TournamentViewerView.xaml
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<UserControl x:Class="TrackerWPFUI.Views.TournamentViewerView"
|
||||||
|
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="300" d:DesignWidth="300">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</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 x:Name="TournamentName" FontSize="28" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"/>
|
||||||
|
<!--Row 1-->
|
||||||
|
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0" >
|
||||||
|
<TextBlock Margin="0 10 5 0" >Round</TextBlock>
|
||||||
|
<ComboBox x:Name="Rounds" Margin="5 10 0 0"
|
||||||
|
SelectedItem="{Binding Path=SelectedRound, Mode=TwoWay}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<!--Row 2-->
|
||||||
|
<CheckBox x:Name="UnplayedOnly" Grid.Row="2" Grid.Column="0" Margin="0 10 0 0">
|
||||||
|
Unplayed Only
|
||||||
|
</CheckBox>
|
||||||
|
<!--Row 3-->
|
||||||
|
<ListBox x:Name="Matchups" Grid.Row="3" Grid.Column="0"
|
||||||
|
DisplayMemberPath="DisplayName" Grid.RowSpan="3"
|
||||||
|
Margin="0 0 5 0"
|
||||||
|
SelectedItem="{Binding Path=SelectedMatchup , Mode=TwoWay}"/>
|
||||||
|
<StackPanel Grid.Column="1" Grid.Row="3" Orientation="Vertical" >
|
||||||
|
<TextBlock x:Name="TeamOne" Margin="0 0 0 5"/>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Margin="0 0 5 0">Score</TextBlock>
|
||||||
|
<TextBox x:Name="TeamOneScore" MinWidth="50"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
<!--Row 4-->
|
||||||
|
<TextBlock Margin="0 10 0 10" Grid.Row="4" Grid.Column="1"
|
||||||
|
HorizontalAlignment="Center">
|
||||||
|
- VS -
|
||||||
|
</TextBlock>
|
||||||
|
<Button x:Name="ScoreMatch" Grid.Row="4" Grid.Column="2"
|
||||||
|
Margin="10 0 0 0" Padding="15 5" >
|
||||||
|
Score
|
||||||
|
</Button>
|
||||||
|
<!--Row 5-->
|
||||||
|
<StackPanel Grid.Column="1" Grid.Row="5" Orientation="Vertical" >
|
||||||
|
<TextBlock x:Name="TeamTwo" Margin="0 0 0 5"/>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Margin="0 0 5 0">Score</TextBlock>
|
||||||
|
<TextBox x:Name="TeamTwoScore" MinWidth="50"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
TrackerWPFUI/Views/TournamentViewerView.xaml.cs
Normal file
28
TrackerWPFUI/Views/TournamentViewerView.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 TournamentViewerView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class TournamentViewerView : UserControl
|
||||||
|
{
|
||||||
|
public TournamentViewerView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
TrackerWPFUI/packages.config
Normal file
5
TrackerWPFUI/packages.config
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net472" />
|
||||||
|
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net472" />
|
||||||
|
</packages>
|
||||||
Reference in New Issue
Block a user