Commit d54a3b81 by liulongfei

模块封装

parent f50dac90
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -15,6 +16,11 @@ namespace VIZ.TVP.Golf.Domain
public class ApplicationDomainEx : ApplicationDomain
{
/// <summary>
/// 远程数据工作目录
/// </summary>
public readonly static string REMOTE_DATA_WORK_PATH = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "db", "remote");
/// <summary>
/// 球员信息列表
/// </summary>
public static ObservableCollection<PlayerInfoModel> PlayerInfos { get; set; }
......
......@@ -40,6 +40,11 @@ namespace VIZ.TVP.Golf.Domain
// ====================================================================================
/// <summary>
/// 底部洞信息版
/// </summary>
public const string BottomHoleInfoView = "BottomHoleInfoView";
/// <summary>
/// 底部信息版
/// </summary>
public const string BottomInformationView = "BottomInformationView";
......
......@@ -32,6 +32,20 @@ namespace VIZ.TVP.Golf.Domain
#endregion
#region Par -- 标准杆
private int par;
/// <summary>
/// 标准杆
/// </summary>
public int Par
{
get { return par; }
set { par = value; this.RaisePropertyChanged(nameof(Par)); }
}
#endregion
#region Picture -- 照片
private string pictire;
......@@ -52,6 +66,7 @@ namespace VIZ.TVP.Golf.Domain
public void UpdatePropertyToEntity()
{
this.Entity.HoleID = this.HoleID;
this.Entity.Par = this.Par;
this.Entity.Picture = this.Picture;
}
......@@ -61,6 +76,7 @@ namespace VIZ.TVP.Golf.Domain
public void UpdatePropertyFromEntity()
{
this.HoleID = this.Entity.HoleID;
this.Par = this.Entity.Par;
this.Picture = this.Entity.Picture;
}
}
......
......@@ -68,7 +68,7 @@ namespace VIZ.TVP.Golf.Domain
#region Sex -- 性别
private SexEnum sex;
private SexEnum sex = SexEnum.Male;
/// <summary>
/// 性别
/// </summary>
......@@ -80,16 +80,30 @@ namespace VIZ.TVP.Golf.Domain
#endregion
#region Country -- 国家
#region TeamID -- 队伍编号
private string country;
private int teamID;
/// <summary>
/// 国家
/// 队伍编号
/// </summary>
public string Country
public int TeamID
{
get { return country; }
set { country = value; this.RaisePropertyChanged(nameof(Country)); }
get { return teamID; }
set { teamID = value; this.RaisePropertyChanged(nameof(TeamID)); }
}
#endregion
#region Group -- 分组
private string group;
/// <summary>
/// 分组
/// </summary>
public string Group
{
get { return group; }
set { group = value; this.RaisePropertyChanged(nameof(Group)); }
}
#endregion
......@@ -122,6 +136,25 @@ namespace VIZ.TVP.Golf.Domain
#endregion
#region TeamInfoModel -- 队伍信息模型
private TeamInfoModel teamInfoModel;
/// <summary>
/// 队伍信息模型
/// </summary>
public TeamInfoModel TeamInfoModel
{
get { return teamInfoModel; }
set
{
teamInfoModel = value;
this.RaisePropertyChanged(nameof(TeamInfoModel));
this.TeamID = value == null ? 0 : value.TeamID;
}
}
#endregion
/// <summary>
/// 更新属性值实体模型
/// </summary>
......@@ -131,7 +164,8 @@ namespace VIZ.TVP.Golf.Domain
this.Entity.Name = this.Name;
this.Entity.Age = this.Age;
this.Entity.Sex = this.Sex;
this.Entity.Country = this.Country;
this.Entity.TeamID = this.TeamID;
this.Entity.Group = this.Group;
this.Entity.FullPicture = this.FullPicture;
this.Entity.HalfPicture = this.HalfPicture;
}
......@@ -145,7 +179,8 @@ namespace VIZ.TVP.Golf.Domain
this.Name = this.Entity.Name;
this.Age = this.Entity.Age;
this.Sex = this.Entity.Sex;
this.Country = this.Entity.Country;
this.TeamID = this.Entity.TeamID;
this.Group = this.Entity.Group;
this.FullPicture = this.Entity.FullPicture;
this.HalfPicture = this.Entity.HalfPicture;
}
......
......@@ -19,6 +19,20 @@ namespace VIZ.TVP.Golf.Domain
/// </summary>
public PlayerNode Node { get; set; }
#region PlayerID -- 球员编号
private int playerID;
/// <summary>
/// 球员编号
/// </summary>
public int PlayerID
{
get { return playerID; }
set { playerID = value; this.RaisePropertyChanged(nameof(PlayerID)); }
}
#endregion
#region Name -- 名称
private string name;
......@@ -153,6 +167,7 @@ namespace VIZ.TVP.Golf.Domain
{
this.Node = node;
this.PlayerID = node.id;
this.Name = node.pl_tvlname;
this.Country = node.country;
this.Position = node.position;
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Domain
{
/// <summary>
/// 文件临时模型
/// </summary>
public class FileTempModel : ModelBase
{
#region FullPath -- 完整路径
private string fullPath;
/// <summary>
/// 完整路径
/// </summary>
public string FullPath
{
get { return fullPath; }
set { fullPath = value; this.RaisePropertyChanged(nameof(FullPath)); }
}
#endregion
#region FileName -- 文件名
private string fileName;
/// <summary>
/// 文件名
/// </summary>
public string FileName
{
get { return fileName; }
set { fileName = value; this.RaisePropertyChanged(nameof(FileName)); }
}
#endregion
#region Time -- 时间
private string time;
/// <summary>
/// 时间
/// </summary>
public string Time
{
get { return time; }
set { time = value; this.RaisePropertyChanged(nameof(Time)); }
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Domain
{
/// <summary>
/// 分组临时模型
/// </summary>
public class GroupTempModel : ModelBase
{
#region TeamInfo -- 队伍信息
private TeamInfoModel teamInfo;
/// <summary>
/// 队伍信息
/// </summary>
public TeamInfoModel TeamInfo
{
get { return teamInfo; }
set { teamInfo = value; this.RaisePropertyChanged(nameof(TeamInfo)); }
}
#endregion
#region Players -- 球员信息
private ObservableCollection<PlayerInfoModel> players = new ObservableCollection<PlayerInfoModel>();
/// <summary>
/// 球员信息
/// </summary>
public ObservableCollection<PlayerInfoModel> Players
{
get { return players; }
set { players = value; this.RaisePropertyChanged(nameof(Players)); }
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Domain
{
/// <summary>
/// 球员临时模型
/// </summary>
public class PlayerTempModel : ModelBase
{
#region PlayerID -- 球员编号
private int playerID;
/// <summary>
/// 球员编号
/// </summary>
public int PlayerID
{
get { return playerID; }
set { playerID = value; this.RaisePropertyChanged(nameof(PlayerID)); }
}
#endregion
#region Name -- 名称
private string name;
/// <summary>
/// 名称
/// </summary>
public string Name
{
get { return name; }
set { name = value; this.RaisePropertyChanged(nameof(Name)); }
}
#endregion
#region HalfPicture -- 半身照
private string halfPicture;
/// <summary>
/// 半身照
/// </summary>
public string HalfPicture
{
get { return halfPicture; }
set { halfPicture = value; this.RaisePropertyChanged(nameof(HalfPicture)); }
}
#endregion
#region Strokes -- 总杆数
private int strokes;
/// <summary>
/// 总杆数
/// </summary>
public int Strokes
{
get { return strokes; }
set { strokes = value; this.RaisePropertyChanged(nameof(Strokes)); }
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -26,6 +27,11 @@ namespace VIZ.TVP.Golf.Domain
/// 球员照片集合
/// </summary>
public static ObservableCollection<string> PlayerPictures { get; set; } = new ObservableCollection<string>();
/// <summary>
/// 分组集合
/// </summary>
public static ObservableCollection<string> Groups { get; set; } = new ObservableCollection<string>();
}
}
......@@ -70,10 +70,13 @@
<Compile Include="Model\EntityModel\PlayerInfoModel.cs" />
<Compile Include="Model\EntityModel\TeamInfoModel.cs" />
<Compile Include="Model\EntityModel\TournamentInfoModel.cs" />
<Compile Include="Model\TempModel\FileTempModel.cs" />
<Compile Include="Model\TempModel\GroupTempModel.cs" />
<Compile Include="Model\RealModel\PlayerRealModel.cs" />
<Compile Include="Model\RealModel\RoundRealModel.cs" />
<Compile Include="Model\RealModel\ScoreRealModel.cs" />
<Compile Include="Model\RealModel\TeamRealModel.cs" />
<Compile Include="Model\TempModel\PlayerTempModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TvpStaticResource.cs" />
</ItemGroup>
......
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using VIZ.TVP.Golf.Domain;
namespace VIZ.TVP.Golf.Module.Resource
{
/// <summary>
/// 球员信息转化为描述的转化器
/// </summary>
public class PlayerInfos2DetailConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
IEnumerable items = value as IEnumerable;
if (items == null)
return null;
StringBuilder sb = new StringBuilder();
foreach (PlayerInfoModel model in items)
{
if (model == null)
continue;
sb.Append($" {model.Name} /");
}
if (sb.Length > 1)
{
sb.Remove(sb.Length - 1, 1);
}
if (sb.Length > 1)
{
sb.Remove(0, 1);
}
return sb.ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>
\ No newline at end of file
......@@ -37,6 +37,9 @@
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#4486abe2"></Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
......@@ -78,9 +81,58 @@
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#22ff2e63"></Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="IconButton_Green" TargetType="fcommon:IconButton">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="BorderBrush" Value="#884ec2ab"></Setter>
<Setter Property="Foreground" Value="#ff4ec2ab"></Setter>
<Setter Property="BorderThickness" Value="1"></Setter>
<Setter Property="MinWidth" Value="120"></Setter>
<Setter Property="Height" Value="40"></Setter>
<Setter Property="IconWidth" Value="16"></Setter>
<Setter Property="IconHeight" Value="16"></Setter>
<Setter Property="Padding" Value="10,0,10,0"></Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="fcommon:IconButton">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}">
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Width="{TemplateBinding IconWidth}" Height="{TemplateBinding IconHeight}"
Source="{TemplateBinding Icon}"></Image>
<ContentPresenter Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10,0,0,0"></ContentPresenter>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#444ec2ab"></Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#224ec2ab"></Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -68,6 +68,10 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Page Include="Style\Button\Button_Default.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Style\IconButton\IconButton_Default.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -82,6 +86,7 @@
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Converter\PlayerInfos2DetailConverter.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
......@@ -145,7 +150,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Converter\" />
<Resource Include="Icons\presets_16x16.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\save_16x16.png" />
......@@ -169,5 +174,11 @@
<Resource Include="Icons\add_16x16.png" />
<Resource Include="Icons\delete_16x16.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\select_16x16.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\refresh_green_16x16.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -49,8 +49,8 @@
<Border Grid.Row="1" BorderBrush="#44000000" BorderThickness="1" Margin="5" Padding="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 数据表格 -->
<DataGrid Grid.Row="1" CanUserAddRows="False" AutoGenerateColumns="False" Margin="0,0,5,0"
......
......@@ -3,6 +3,7 @@
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:behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
......@@ -49,8 +50,8 @@
<Border Grid.Row="1" BorderBrush="#44000000" BorderThickness="1" Margin="5" Padding="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 数据表格 -->
<DataGrid CanUserAddRows="False" AutoGenerateColumns="False" Margin="0,0,5,0"
......@@ -59,13 +60,19 @@
<DataGrid.Columns>
<DataGridTextColumn Header="球员编号" Width="80" Binding="{Binding Path=PlayerID,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="姓名" Width="200" Binding="{Binding Path=Name,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="年龄" Width="80" Binding="{Binding Path=Age,Mode=TwoWay}"></DataGridTextColumn>
<DataGridComboBoxColumn Header="性别" Width="80"
<DataGridTextColumn Header="年龄" Width="60" Binding="{Binding Path=Age,Mode=TwoWay}"></DataGridTextColumn>
<DataGridComboBoxColumn Header="性别" Width="60"
SelectedItemBinding="{Binding Path=Sex,Mode=TwoWay,Converter={StaticResource Enum2EnumDescriptionConverter}}"
ItemsSource="{Binding Source={x:Static Member=storage:StaticEnumInfos.SexEnumDescriptions}}"></DataGridComboBoxColumn>
<DataGridComboBoxColumn Header="照片" Width="240"
<DataGridComboBoxColumn Header="照片" Width="200"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.PlayerPictures}}"
SelectedValueBinding="{Binding Path=HalfPicture}"></DataGridComboBoxColumn>
<DataGridComboBoxColumn Header="队伍" Width="200" DisplayMemberPath="Name"
ItemsSource="{Binding Source={x:Static domain:ApplicationDomainEx.TeamInfos}}"
SelectedValueBinding="{Binding Path=TeamInfoModel}"></DataGridComboBoxColumn>
<DataGridComboBoxColumn Header="分组" Width="60"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.Groups}}"
SelectedValueBinding="{Binding Path=Group}"></DataGridComboBoxColumn>
</DataGrid.Columns>
</DataGrid>
<!-- 照片 -->
......
......@@ -122,8 +122,8 @@ namespace VIZ.TVP.Golf.Module
/// </summary>
private void LoadTestData()
{
this.PlayerInfos.Add(new PlayerInfoModel { PlayerID = 1, Name = "zhangsan", Sex = SexEnum.Female, Age = 15, Country = "China", Entity = new PlayerInfo() });
this.PlayerInfos.Add(new PlayerInfoModel { PlayerID = 1, Name = "lisi", Sex = SexEnum.Male, Age = 15, Country = "China", Entity = new PlayerInfo() });
this.PlayerInfos.Add(new PlayerInfoModel { PlayerID = 1, Name = "zhangsan", Sex = SexEnum.Female, Age = 15, Group = "1", Entity = new PlayerInfo() });
this.PlayerInfos.Add(new PlayerInfoModel { PlayerID = 1, Name = "lisi", Sex = SexEnum.Male, Age = 15, Group = "1", Entity = new PlayerInfo() });
}
#endregion
......
......@@ -49,8 +49,8 @@
<Border Grid.Row="1" BorderBrush="#44000000" BorderThickness="1" Margin="5" Padding="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 数据表格 -->
<DataGrid CanUserAddRows="False" AutoGenerateColumns="False" Margin="0,0,5,0" SelectionMode="Single"
......
......@@ -56,6 +56,8 @@
<Border Background="#ff4d449f" Height="40">
<TextBlock Text="包装" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"></TextBlock>
</Border>
<RadioButton x:Name="rb_BottomHoleInfoView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="底部洞信息版"></RadioButton>
<RadioButton x:Name="rb_BottomInformationView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="底部信息版"></RadioButton>
<RadioButton x:Name="rb_CenterPlayerRanking" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
......@@ -78,6 +80,8 @@
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.TournamentInfoView}" ViewType="{x:Type local:PlayerListView}"
IsSelected="{Binding ElementName=rb_PlayerListView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<!-- 包装 -->
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.BottomHoleInfoView}" ViewType="{x:Type local:BottomHoleInfoView}"
IsSelected="{Binding ElementName=rb_BottomHoleInfoView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.BottomInformationView}" ViewType="{x:Type local:BottomInformationView}"
IsSelected="{Binding ElementName=rb_BottomInformationView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.CenterPlayerRanking}" ViewType="{x:Type local:CenterPlayerRankingView}"
......
<UserControl x:Class="VIZ.TVP.Golf.Module.BottomHoleInfoView"
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:VIZ.TVP.Golf.Module"
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:domain="clr-namespace:VIZ.TVP.Golf.Domain;assembly=VIZ.TVP.Golf.Domain"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
d:Background="White"
d:DataContext="{d:DesignInstance Type=local:BottomHoleInfoViewModel}"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1400">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<core:String2ImageSourceConverter x:Key="String2ImageSourceConverter" Type="Relative" WorkPath="picture/hole"></core:String2ImageSourceConverter>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="600"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 版子操作 -->
<Border Grid.Row="0" Grid.ColumnSpan="2" BorderBrush="#44000000" Background="#66b6f2e3" BorderThickness="1" Margin="5" Padding="5">
<StackPanel Orientation="Horizontal">
<fcommon:IconButton Style="{StaticResource IconButton_Default}"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/db_16x16.png"
Content="加载本地数据" Command="{Binding Path=LoadLocalDataCommand}"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Default}" Margin="5,0,0,0"
IsEnabled="{Binding Path=IsLoadRemoteDataEnabled,Mode=OneWay}"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png"
Content="刷新实实数据" Command="{Binding Path=LoadRemoteDataCommand}"></fcommon:IconButton>
</StackPanel>
</Border>
<!-- 版子信息 -->
<Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="200"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 洞信息 -->
<GroupBox>
<GroupBox.Header>
<TextBlock Text="洞信息" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header>
<local:HolePickerPanel DataContext="{Binding Path=HolePickerPanelModel}"></local:HolePickerPanel>
</GroupBox>
<!-- 分组 1 -->
<GroupBox Grid.Row="1">
<GroupBox.Header>
<TextBlock Text="分组1" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header>
<local:GroupPickerPanel DataContext="{Binding GroupPickerPanelModel_1}"></local:GroupPickerPanel>
</GroupBox>
<!-- 分组 2 -->
<GroupBox Grid.Row="2">
<GroupBox.Header>
<TextBlock Text="分组2" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header>
<local:GroupPickerPanel DataContext="{Binding GroupPickerPanelModel_2}"></local:GroupPickerPanel>
</GroupBox>
</Grid>
</ScrollViewer>
</Border>
<!-- 示意图 -->
<Border Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="300"></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
</Grid.RowDefinitions>
<Image Source="pack://SiteOfOrigin:,,,/images/BottomHoleInfo.jpg" />
<StackPanel Orientation="Horizontal" Grid.Row="1">
<fcommon:IconButton Style="{StaticResource IconButton_Red}" Margin="10,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/up_16x16.png"
Content="上版子"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Red}" Margin="10,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/down_16x16.png"
Content="下版子"></fcommon:IconButton>
</StackPanel>
</Grid>
</Border>
</Grid>
</UserControl>
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;
using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// BottomHoleInfoView.xaml 的交互逻辑
/// </summary>
public partial class BottomHoleInfoView : UserControl
{
public BottomHoleInfoView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new BottomHoleInfoViewModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Documents;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Service;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 包装视图模型 -- 底部洞信息版
/// </summary>
public class BottomHoleInfoViewModel : PackageViewModelBase
{
public BottomHoleInfoViewModel()
{
// 初始化命令
this.InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.LoadLocalDataCommand = new VCommand(this.LoadLocalData);
}
// ===================================================================================
// Field
// ===================================================================================
/// <summary>
/// 赛事信息接口
/// </summary>
private readonly static string INTERFACE_TOURNAMENT = ApplicationDomainEx.IniStorage.GetValue<InterfaceConfig, string>(p => p.INTERFACE_TOURNAMENT);
/// <summary>
/// 实时数据服务
/// </summary>
private IRealDataService realDataService = new RealDataService();
// ===================================================================================
// Property
// ===================================================================================
#region HolePickerPanelModel -- 洞选择面板视图模型
private HolePickerPanelModel holePickerPanelModel = new HolePickerPanelModel();
/// <summary>
/// 洞选择面板视图模型
/// </summary>
public HolePickerPanelModel HolePickerPanelModel
{
get { return holePickerPanelModel; }
set { holePickerPanelModel = value; this.RaisePropertyChanged(nameof(HolePickerPanelModel)); }
}
#endregion
#region GroupPickerPanelModel_1 -- 分组选择面板视图模型 1
private GroupPickerPanelModel groupPickerPanelModel_1 = new GroupPickerPanelModel();
/// <summary>
/// 分组选择面板视图模型 1
/// </summary>
public GroupPickerPanelModel GroupPickerPanelModel_1
{
get { return groupPickerPanelModel_1; }
set { groupPickerPanelModel_1 = value; this.RaisePropertyChanged(nameof(GroupPickerPanelModel_1)); }
}
#endregion
#region GroupPickerPanelModel_2 -- 分组选择面板视图模型 2
private GroupPickerPanelModel groupPickerPanelModel_2 = new GroupPickerPanelModel();
/// <summary>
/// 分组选择面板视图模型 2
/// </summary>
public GroupPickerPanelModel GroupPickerPanelModel_2
{
get { return groupPickerPanelModel_2; }
set { groupPickerPanelModel_2 = value; this.RaisePropertyChanged(nameof(GroupPickerPanelModel_2)); }
}
#endregion
// ===================================================================================
// Command
// ===================================================================================
#region SendCommand -- 发送命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
{
}
#endregion
#region LoadLocalDataCommand -- 加载本地数据命令
/// <summary>
/// 加载本地数据
/// </summary>
protected override void LoadLocalData()
{
RealDataWindow window = new RealDataWindow();
window.ShowDialog();
RealDataViewModel vm = window.realDataView.DataContext as RealDataViewModel;
if (vm == null)
return;
if (!vm.IsEnter)
return;
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName);
// 分组 1
this.UpdatePlayerTempModel(this.GroupPickerPanelModel_1?.Player1, list);
this.UpdatePlayerTempModel(this.GroupPickerPanelModel_1?.Player2, list);
// 分组 2
this.UpdatePlayerTempModel(this.GroupPickerPanelModel_2?.Player1, list);
this.UpdatePlayerTempModel(this.GroupPickerPanelModel_2?.Player2, list);
}
/// <summary>
/// 更新球员临时数据
/// </summary>
/// <param name="tempModel">临时模型</param>
/// <param name="realModels">实时模型集合</param>
private void UpdatePlayerTempModel(PlayerTempModel tempModel, List<PlayerRealModel> realModels)
{
if (tempModel == null || realModels == null || tempModel.PlayerID <= 0 || realModels.Count == 0)
return;
PlayerRealModel realModel = realModels.FirstOrDefault(p => p.PlayerID == tempModel.PlayerID);
if (realModel != null)
{
tempModel.Strokes = realModel.Strokes;
}
}
#endregion
#region LoadRemoteDataCommand -- 加载远程数据命令
/// <summary>
/// 加载远程数据
/// </summary>
protected override void LoadRemoteData()
{
Task.Run(() =>
{
string fileName = this.realDataService.DownLoadData(INTERFACE_TOURNAMENT);
if (string.IsNullOrWhiteSpace(fileName))
{
MessageBox.Show("加载远程数据失败!");
return;
}
WPFHelper.BeginInvoke(() =>
{
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(fileName);
// 分组 1
this.UpdatePlayerTempModel(this.GroupPickerPanelModel_1?.Player1, list);
this.UpdatePlayerTempModel(this.GroupPickerPanelModel_1?.Player2, list);
// 分组 2
this.UpdatePlayerTempModel(this.GroupPickerPanelModel_2?.Player1, list);
this.UpdatePlayerTempModel(this.GroupPickerPanelModel_2?.Player2, list);
});
});
}
#endregion
}
}
......@@ -53,6 +53,10 @@ namespace VIZ.TVP.Golf.Module
// Command
// ===================================================================================
// ===================================================================================
// Command
// ===================================================================================
#region SendCommand -- 发送命令
/// <summary>
......@@ -64,5 +68,30 @@ namespace VIZ.TVP.Golf.Module
}
#endregion
#region LoadLocalDataCommand -- 加载本地数据命令
/// <summary>
/// 加载本地数据
/// </summary>
protected override void LoadLocalData()
{
}
#endregion
#region LoadRemoteDataCommand -- 加载远程数据命令
/// <summary>
/// 加载远程数据
/// </summary>
protected override void LoadRemoteData()
{
}
#endregion
}
}
......@@ -82,6 +82,10 @@ namespace VIZ.TVP.Golf.Module
// Command
// ===================================================================================
// ===================================================================================
// Command
// ===================================================================================
#region SendCommand -- 发送命令
/// <summary>
......@@ -94,39 +98,27 @@ namespace VIZ.TVP.Golf.Module
#endregion
#region LoadLocalDataCommand -- 加载本地数据命令
/// <summary>
/// 加载本地数据命令
/// </summary>
public VCommand LoadLocalDataCommand { get; set; }
#region LoadLocalDataCommand -- 加载本地数据命令
/// <summary>
/// 加载本地数据
/// </summary>
private void LoadLocalData()
protected override void LoadLocalData()
{
string path = "E:\\Projects\\VIZ.TVP.Golf\\高尔夫球数据获取api.xml";
using (StreamReader sr = new StreamReader(path))
{
XElement root = XElement.Load(sr);
TournamentNode node = new TournamentNode();
node.FromXElement(root);
}
ObservableCollection<PlayerRealModel> rankings = new ObservableCollection<PlayerRealModel>();
#endregion
foreach (PlayerNode player in node.Players)
{
PlayerRealModel model = new PlayerRealModel();
model.FromNode(player);
#region LoadRemoteDataCommand -- 加载远程数据命令
rankings.Add(model);
}
/// <summary>
/// 加载远程数据
/// </summary>
protected override void LoadRemoteData()
{
this.PlayerRankings = rankings;
}
}
#endregion
......
......@@ -108,52 +108,27 @@ namespace VIZ.TVP.Golf.Module
#endregion
#region LoadLocalDataCommand -- 加载本地数据命令
/// <summary>
/// 加载本地数据命令
/// </summary>
public VCommand LoadLocalDataCommand { get; set; }
#region LoadLocalDataCommand -- 加载本地数据命令
/// <summary>
/// 加载本地数据
/// </summary>
private void LoadLocalData()
protected override void LoadLocalData()
{
string path = "E:\\Projects\\VIZ.TVP.Golf\\高尔夫球数据获取api.xml";
using (StreamReader sr = new StreamReader(path))
{
XElement root = XElement.Load(sr);
TournamentNode node = new TournamentNode();
node.FromXElement(root);
ObservableCollection<PlayerRealModel> rankings = new ObservableCollection<PlayerRealModel>();
foreach (PlayerNode player in node.Players)
{
PlayerRealModel model = new PlayerRealModel();
model.FromNode(player);
}
rankings.Add(model);
}
#endregion
ObservableCollection<TeamRealModel> teamRankings = new ObservableCollection<TeamRealModel>();
foreach (TeamInfoModel teamModel in ApplicationDomainEx.TeamInfos)
{
TeamRealModel realModel = new TeamRealModel();
realModel.FromModel(teamModel);
for (int i = 0; i < 12; i++)
{
realModel.Players.Add(rankings[i]);
}
#region LoadRemoteDataCommand -- 加载远程数据命令
teamRankings.Add(realModel);
}
/// <summary>
/// 加载远程数据
/// </summary>
protected override void LoadRemoteData()
{
this.TeamRankings = teamRankings;
}
}
#endregion
......
using System;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
namespace VIZ.TVP.Golf.Module
{
......@@ -13,12 +15,41 @@ namespace VIZ.TVP.Golf.Module
/// </summary>
public abstract class PackageViewModelBase : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(PackageViewModelBase));
public PackageViewModelBase()
{
this.SendCommand = new VCommand(this.Send);
this.LoadLocalDataCommand = new VCommand(this.LoadLocalData);
this.LoadRemoteDataCommand = new VCommand(this.LoadRemoteDataShell);
}
#region Command -- 命令
// ===================================================================================
// Property
// ===================================================================================
#region IsLoadRemoteDataEnabled -- 加载远程数据是否可用
private bool isLoadRemoteDataEnabled = true;
/// <summary>
/// 加载远程数据是否可用
/// </summary>
public bool IsLoadRemoteDataEnabled
{
get { return isLoadRemoteDataEnabled; }
set { isLoadRemoteDataEnabled = value; this.RaisePropertySaveChanged(nameof(IsLoadRemoteDataEnabled)); }
}
#endregion
// ===================================================================================
// Command
// ===================================================================================
#region SendCommand -- 发送命令
/// <summary>
/// 发送命令
......@@ -31,5 +62,55 @@ namespace VIZ.TVP.Golf.Module
protected abstract void Send();
#endregion
#region LoadLocalDataCommand -- 加载本地数据命令
/// <summary>
/// 加载本地数据命令
/// </summary>
public VCommand LoadLocalDataCommand { get; set; }
/// <summary>
/// 加载本地数据
/// </summary>
protected abstract void LoadLocalData();
#endregion
#region LoadRemoteDataCommand -- 加载远程数据命令
/// <summary>
/// 加载远程数据命令
/// </summary>
public VCommand LoadRemoteDataCommand { get; set; }
/// <summary>
/// 执行加载远程数据壳
/// </summary>
private void LoadRemoteDataShell()
{
try
{
this.IsLoadRemoteDataEnabled = false;
ApplicationDomainEx.DelayManager.Wait("PackageViewModelBase.LoadRemoteDataShell", 2, () =>
{
this.IsLoadRemoteDataEnabled = true;
});
this.LoadRemoteData();
}
catch (Exception ex)
{
log.Error(ex);
}
}
/// <summary>
/// 加载远程数据
/// </summary>
protected abstract void LoadRemoteData();
#endregion
}
}
using log4net;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;
using VIZ.Framework.Core;
using VIZ.Framework.Module;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 应用程序启动 -- 清理本地数据
/// </summary>
public class AppSetup_ClearLocalData : AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private static ILog log = LogManager.GetLogger(typeof(AppSetup_ClearLocalData));
/// <summary>
/// 描述
/// </summary>
public override string Detail { get; } = "应用程序启动 -- 清理本地数据";
/// <summary>
/// 接口数据保存数量
/// </summary>
private readonly static int INTERFACE_SAVE_COUNT = ApplicationDomainEx.IniStorage.GetValue<InterfaceConfig, int>(p => p.INTERFACE_SAVE_COUNT);
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public override bool Setup(AppSetupContext context)
{
ApplicationDomainEx.LoopManager.Register("AppSetup_ClearLocalData.ExecuteClear", 60, this.ExecuteClear);
return true;
}
/// <summary>
/// 执行关闭
/// </summary>
/// <param name="context">应用程序启动上下文</param>
public override void Shutdown(AppSetupContext context)
{
}
/// <summary>
/// 执行清理
/// </summary>
private void ExecuteClear()
{
string[] files = Directory.GetFiles(ApplicationDomainEx.REMOTE_DATA_WORK_PATH);
List<string> times = new List<string>();
List<FileTempModel> list = new List<FileTempModel>();
// yyyy_MM_dd__HH_mm_ss
foreach (string file in files)
{
FileTempModel model = new FileTempModel();
model.FullPath = file;
model.FileName = Path.GetFileName(file);
string[] parts = Path.GetFileNameWithoutExtension(file).Split(new string[] { "__" }, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length != 2)
continue;
model.Time = $"{parts[0].Replace("_", "-")} {parts[1].Replace("_", ":")}";
list.Add(model);
}
list = list.OrderByDescending(p => p.Time).Skip(INTERFACE_SAVE_COUNT).ToList();
foreach (FileTempModel item in list)
{
try
{
File.Delete(item.FullPath);
}
catch (Exception ex)
{
log.Error(ex);
}
}
}
}
}
\ No newline at end of file
......@@ -45,12 +45,12 @@ namespace VIZ.TVP.Golf.Module
ApplicationDomainEx.LiteDBContext = new LiteDBContext(path);
// 初始化球员信息
this.InitPlayerInfos();
// 初始化球队信息
this.InitTeamInfos();
// 初始化球员信息
this.InitPlayerInfos();
// 初始化球洞信息
this.InitHoleInfos();
......@@ -78,6 +78,8 @@ namespace VIZ.TVP.Golf.Module
PlayerInfoModel model = new PlayerInfoModel();
model.Entity = entity;
model.UpdatePropertyFromEntity();
model.TeamInfoModel = ApplicationDomainEx.TeamInfos.FirstOrDefault(p => p.TeamID == entity.TeamID);
model.TeamID = entity.TeamID;
list.Add(model);
}
......
......@@ -44,6 +44,9 @@ namespace VIZ.TVP.Golf.Module
// 初始化球员图片
this.InitPlayerPicture();
// 初始化分组信息
this.InitGroups();
return true;
}
......@@ -106,5 +109,19 @@ namespace VIZ.TVP.Golf.Module
TvpStaticResource.PlayerPictures = players;
}
/// <summary>
/// 初始化分组信息
/// </summary>
private void InitGroups()
{
ObservableCollection<string> groups = new ObservableCollection<string>();
for (int i = 1; i <= 10; i++)
{
groups.Add(i.ToString());
}
TvpStaticResource.Groups = groups;
}
}
}
\ No newline at end of file
......@@ -56,6 +56,9 @@
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.39\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
......@@ -90,6 +93,30 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Page Include="Widgets\RealData\RealDataWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Widgets\RealData\RealDataView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Widgets\Group\GroupPickerPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Widgets\Hole\HolePickerPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Widgets\Group\GroupPickerView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Package\BottomHoleInfo\View\BottomHoleInfoView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Package\BottomInformation\View\BottomInformationView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -126,8 +153,33 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Widgets\Group\GroupPickerWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Setup\Provider\Setup\AppSetup_ClearLocalData.cs" />
<Compile Include="Widgets\RealData\RealDataWindow.xaml.cs">
<DependentUpon>RealDataWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Widgets\RealData\RealDataView.xaml.cs">
<DependentUpon>RealDataView.xaml</DependentUpon>
</Compile>
<Compile Include="Widgets\Group\GroupPickerPanel.xaml.cs">
<DependentUpon>GroupPickerPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Widgets\Group\GroupPickerPanelModel.cs" />
<Compile Include="Widgets\Hole\HolePickerPanel.xaml.cs">
<DependentUpon>HolePickerPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Widgets\Group\GroupPickerView.xaml.cs">
<DependentUpon>GroupPickerView.xaml</DependentUpon>
</Compile>
<Compile Include="Package\BottomHoleInfo\ViewModel\BottomHoleInfoViewModel.cs" />
<Compile Include="Package\BottomHoleInfo\View\BottomHoleInfoView.xaml.cs">
<DependentUpon>BottomHoleInfoView.xaml</DependentUpon>
</Compile>
<Compile Include="Package\BottomInformation\ViewModel\BottomInformationViewModel.cs" />
<Compile Include="Package\BottomInformation\View\BottomInformationView.xaml.cs">
<DependentUpon>BottomInformationView.xaml</DependentUpon>
......@@ -184,6 +236,12 @@
<Compile Include="Information\Tournament\View\TournamentInfoView.xaml.cs">
<DependentUpon>TournamentInfoView.xaml</DependentUpon>
</Compile>
<Compile Include="Widgets\Group\GroupPickerViewModel.cs" />
<Compile Include="Widgets\Group\GroupPickerWindow.xaml.cs">
<DependentUpon>GroupPickerWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Widgets\Hole\HolePickerPanelModel.cs" />
<Compile Include="Widgets\RealData\RealDataViewModel.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......@@ -240,6 +298,10 @@
<Project>{21f2a416-8d25-4ea9-8b49-23030d2e70cf}</Project>
<Name>VIZ.TVP.Golf.Module.Resource</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Golf.Service\VIZ.TVP.Golf.Service.csproj">
<Project>{1881b036-d5ee-4510-9e07-b2a1e1a4bfbf}</Project>
<Name>VIZ.TVP.Golf.Service</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Golf.Storage\VIZ.TVP.Golf.Storage.csproj">
<Project>{96040211-e7a3-4aa1-8227-529afb65fa78}</Project>
<Name>VIZ.TVP.Golf.Storage</Name>
......
<UserControl x:Class="VIZ.TVP.Golf.Module.GroupPickerPanel"
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:VIZ.TVP.Golf.Module"
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:domain="clr-namespace:VIZ.TVP.Golf.Domain;assembly=VIZ.TVP.Golf.Domain"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
d:Background="White"
d:DataContext="{d:DesignInstance Type=local:GroupPickerPanelModel}"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="700">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<core:String2ImageSourceConverter x:Key="String2ImageSourceConverter_team" Type="Relative" WorkPath="picture/team"></core:String2ImageSourceConverter>
<core:String2ImageSourceConverter x:Key="String2ImageSourceConverter_player" Type="Relative" WorkPath="picture/player"></core:String2ImageSourceConverter>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="120"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 预设 -->
<Grid Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<!-- 预设 -->
<TextBlock Text="预设:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0"></TextBlock>
<fcommon:IconButton Style="{StaticResource IconButton_Green}" VerticalAlignment="Center" HorizontalAlignment="Left"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/presets_16x16.png"
Content="选择分组" Grid.Column="1" Width="80" Height="30" Margin="5,0,0,0"
Command="{Binding SelectGroupCommand}"></fcommon:IconButton>
<!-- 名称 -->
<TextBlock Text="名称:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0" Grid.Row="1"></TextBlock>
<TextBox Grid.Row="1" Grid.Column="1" Height="30" Margin="5,0,18,0" VerticalContentAlignment="Center"
Text="{Binding Path=Name,Mode=TwoWay}" Padding="3"></TextBox>
<!-- 球队Logo -->
<TextBlock Text="球队Logo:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2"></TextBlock>
<ComboBox Height="30" Margin="5,0,18,0" VerticalContentAlignment="Center" Grid.Row="2" Grid.Column="1"
SelectedValue="{Binding Logo,Mode=TwoWay}"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.TeamLogos}}"></ComboBox>
<Border BorderBrush="#44000000" BorderThickness="1" Grid.Column="2" Grid.RowSpan="3" Margin="-13,5,46,5">
<Image Source="{Binding Path=Logo,Converter={StaticResource String2ImageSourceConverter_team}}"></Image>
</Border>
</Grid>
<!-- 球员1 -->
<GroupBox Header="球员1" Margin="5" Grid.Row="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 名称 -->
<TextBlock Text="名称:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="0" Grid.Column="0"
Margin="0,0,5,0"></TextBlock>
<TextBox Grid.Row="0" Grid.Column="1" Height="30" AcceptsReturn="False" TextWrapping="NoWrap" Padding="3"
Text="{Binding Player1.Name,Mode=TwoWay}" VerticalContentAlignment="Center"></TextBox>
<!-- 杆数 -->
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="0" Margin="0,0,5,0" Orientation="Horizontal">
<Image Width="16" Height="16" Source="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png" Margin="0,0,5,0"></Image>
<TextBlock Text="杆数:" ></TextBlock>
</StackPanel>
<TextBox Grid.Row="1" Grid.Column="1" Height="30" AcceptsReturn="False" TextWrapping="NoWrap" Padding="3"
Text="{Binding Player1.Strokes,Mode=TwoWay}" VerticalContentAlignment="Center"></TextBox>
<!-- 照片 -->
<TextBlock Text="照片:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="0"
Margin="0,0,5,0"></TextBlock>
<ComboBox Grid.Row="2" Grid.Column="1" Height="30" VerticalContentAlignment="Center"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.PlayerPictures}}"
SelectedValue="{Binding Path=Player1.HalfPicture,Mode=TwoWay}"></ComboBox>
<Border Grid.RowSpan="3" Grid.Column="2" BorderThickness="1" BorderBrush="#44000000" Margin="5">
<Image Source="{Binding Path=Player1.HalfPicture,Converter={StaticResource String2ImageSourceConverter_player}}"></Image>
</Border>
</Grid>
</GroupBox>
<!-- 球员2 -->
<GroupBox Header="球员2" Margin="5" Grid.Row="2" Grid.Column="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 名称 -->
<TextBlock Text="名称:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="0" Grid.Column="0"
Margin="0,0,5,0"></TextBlock>
<TextBox Grid.Row="0" Grid.Column="1" Height="30" AcceptsReturn="False" TextWrapping="NoWrap" Padding="3"
Text="{Binding Player2.Name,Mode=TwoWay}" VerticalContentAlignment="Center"></TextBox>
<!-- 杆数 -->
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="0" Margin="0,0,5,0" Orientation="Horizontal">
<Image Width="16" Height="16" Source="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png" Margin="0,0,5,0"></Image>
<TextBlock Text="杆数:" ></TextBlock>
</StackPanel>
<TextBox Grid.Row="1" Grid.Column="1" Height="30" AcceptsReturn="False" TextWrapping="NoWrap" Padding="3"
Text="{Binding Player2.Strokes,Mode=TwoWay}" VerticalContentAlignment="Center"></TextBox>
<!-- 照片 -->
<TextBlock Text="照片:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="0"
Margin="0,0,5,0"></TextBlock>
<ComboBox Grid.Row="2" Grid.Column="1" Height="30" VerticalContentAlignment="Center"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.PlayerPictures}}"
SelectedValue="{Binding Path=Player2.HalfPicture,Mode=TwoWay}"></ComboBox>
<Border Grid.RowSpan="3" Grid.Column="2" BorderThickness="1" BorderBrush="#44000000" Margin="5">
<Image Source="{Binding Path=Player2.HalfPicture,Converter={StaticResource String2ImageSourceConverter_player}}"></Image>
</Border>
</Grid>
</GroupBox>
</Grid>
</UserControl>
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 VIZ.TVP.Golf.Module
{
/// <summary>
/// GroupPickerPanel.xaml 的交互逻辑
/// </summary>
public partial class GroupPickerPanel : UserControl
{
public GroupPickerPanel()
{
InitializeComponent();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.HtmlControls;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 组选择面板视图模型
/// </summary>
public class GroupPickerPanelModel : ModelBase
{
/// <summary>
/// 组选择面板视图模型
/// </summary>
public GroupPickerPanelModel()
{
// 初始化命令
this.InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.SelectGroupCommand = new VCommand(this.SelectGroup);
}
// ===================================================================================
// Property
// ===================================================================================
#region Name -- 名称
private string name;
/// <summary>
/// 名称
/// </summary>
public string Name
{
get { return name; }
set { name = value; this.RaisePropertyChanged(nameof(Name)); }
}
#endregion
#region Logo -- Logo
private string logo;
/// <summary>
/// 分组1 Logo
/// </summary>
public string Logo
{
get { return logo; }
set { logo = value; this.RaisePropertyChanged(nameof(Logo)); }
}
#endregion
#region Player1 -- 队员1
private PlayerTempModel player1 = new PlayerTempModel();
/// <summary>
/// 队员1
/// </summary>
public PlayerTempModel Player1
{
get { return player1; }
set { player1 = value; this.RaisePropertyChanged(nameof(Player1)); }
}
#endregion
#region Player2 -- 队员2
private PlayerTempModel player2 = new PlayerTempModel();
/// <summary>
/// 队员2
/// </summary>
public PlayerTempModel Player2
{
get { return player2; }
set { player2 = value; this.RaisePropertyChanged(nameof(Player2)); }
}
#endregion
// ===================================================================================
// Command
// ===================================================================================
#region SelectGroupCommand -- 选择分组1命令
/// <summary>
/// 选择分组1 命令
/// </summary>
public VCommand SelectGroupCommand { get; set; }
/// <summary>
/// 选择分组1
/// </summary>
private void SelectGroup()
{
GroupPickerWindow window = new GroupPickerWindow();
window.ShowDialog();
GroupPickerViewModel vm = window.groupPickerView.DataContext as GroupPickerViewModel;
if (vm == null || !vm.IsEnter || vm.SelectedGroupInfo == null)
return;
this.Name = vm.SelectedGroupInfo.TeamInfo.Name;
this.Logo = vm.SelectedGroupInfo.TeamInfo.Logo;
if (vm.SelectedGroupInfo.Players.Count > 0)
{
PlayerInfoModel player = vm.SelectedGroupInfo.Players[0];
this.Player1.PlayerID = player.PlayerID;
this.Player1.Name = player.Name;
this.Player1.HalfPicture = player.HalfPicture;
}
if (vm.SelectedGroupInfo.Players.Count > 1)
{
PlayerInfoModel player = vm.SelectedGroupInfo.Players[1];
this.player2.PlayerID = player.PlayerID;
this.Player2.Name = player.Name;
this.Player2.HalfPicture = player.HalfPicture;
}
}
#endregion
}
}
<UserControl x:Class="VIZ.TVP.Golf.Module.GroupPickerView"
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:VIZ.TVP.Golf.Module"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:storage="clr-namespace:VIZ.TVP.Golf.Storage;assembly=VIZ.TVP.Golf.Storage"
xmlns:domain="clr-namespace:VIZ.TVP.Golf.Domain;assembly=VIZ.TVP.Golf.Domain"
xmlns:resource="clr-namespace:VIZ.TVP.Golf.Module.Resource;assembly=VIZ.TVP.Golf.Module.Resource"
d:DataContext="{d:DesignInstance Type=local:GroupPickerViewModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<resource:PlayerInfos2DetailConverter x:Key="PlayerInfos2DetailConverter"></resource:PlayerInfos2DetailConverter>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 球队 -->
<DataGrid AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" Margin="5"
ItemsSource="{Binding Source={x:Static domain:ApplicationDomainEx.TeamInfos}}"
SelectedValue="{Binding Path=SelectedTeamInfo,Mode=TwoWay}">
<DataGrid.Columns>
<DataGridTextColumn Header="球队编号" Width="80" Binding="{Binding Path=TeamID,Mode=TwoWay}" IsReadOnly="True"></DataGridTextColumn>
<DataGridTextColumn Header="名称" Width="200" Binding="{Binding Path=Name,Mode=TwoWay}" IsReadOnly="True"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<!-- 分组 -->
<DataGrid AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" Margin="5" Grid.Column="1"
ItemsSource="{Binding Path=GroupInfos}"
SelectedValue="{Binding Path=SelectedGroupInfo,Mode=TwoWay}">
<DataGrid.Columns>
<DataGridTextColumn Header="分组" Width="80" Binding="{Binding Path=TeamInfo.Name,Mode=OneWay}" IsReadOnly="True"></DataGridTextColumn>
<DataGridTextColumn Header="成员" Width="240" Binding="{Binding Path=Players,Mode=OneWay,Converter={StaticResource PlayerInfos2DetailConverter}}" IsReadOnly="True"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<!-- 按钮组 -->
<Grid Grid.Row="1" Grid.Column="1">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width="100" Height="30" Content="确定" Margin="5" Command="{Binding EnterCommand}"></Button>
<Button Width="100" Height="30" Content="取消" Margin="5" Command="{Binding CancelCommand}"></Button>
</StackPanel>
</Grid>
</Grid>
</UserControl>
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;
using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// GroupPickerView.xaml 的交互逻辑
/// </summary>
public partial class GroupPickerView : UserControl
{
public GroupPickerView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new GroupPickerViewModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 组筛选器
/// </summary>
public class GroupPickerViewModel : ViewModelBase
{
public GroupPickerViewModel()
{
// 初始化命令
this.InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.EnterCommand = new VCommand(this.Enter);
this.CancelCommand = new VCommand(this.Cancel);
}
// =====================================================================================
// Property
// =====================================================================================
#region IsEnter -- 是否点击确定按钮
private bool isEnter;
/// <summary>
/// 是否点击确定按钮
/// </summary>
public bool IsEnter
{
get { return isEnter; }
set { isEnter = value; this.RaisePropertyChanged(nameof(IsEnter)); }
}
#endregion
#region SelectedTeamInfo -- 选中的队伍信息
private TeamInfoModel selectedTeamInfo;
/// <summary>
/// 选中的队伍信息
/// </summary>
public TeamInfoModel SelectedTeamInfo
{
get { return selectedTeamInfo; }
set
{
selectedTeamInfo = value;
this.RaisePropertyChanged(nameof(SelectedTeamInfo));
this.UpdateGroupInfos();
}
}
#endregion
#region GroupInfos -- 分组信息集合
private ObservableCollection<GroupTempModel> groupInfos;
/// <summary>
/// 分组信息集合
/// </summary>
public ObservableCollection<GroupTempModel> GroupInfos
{
get { return groupInfos; }
set { groupInfos = value; this.RaisePropertyChanged(nameof(GroupInfos)); }
}
#endregion
#region SelectedGroupInfo -- 选中的分组信息
private GroupTempModel selectedGroupInfo;
/// <summary>
/// 选中的分组信息
/// </summary>
public GroupTempModel SelectedGroupInfo
{
get { return selectedGroupInfo; }
set { selectedGroupInfo = value; this.RaisePropertyChanged(nameof(SelectedGroupInfo)); }
}
#endregion
// =====================================================================================
// Command
// =====================================================================================
#region EnterCommand -- 确定命令
/// <summary>
/// 确定命令
/// </summary>
public VCommand EnterCommand { get; set; }
/// <summary>
/// 确定
/// </summary>
private void Enter()
{
if (this.SelectedGroupInfo == null)
{
MessageBox.Show("请选择分组信息");
return;
}
this.IsEnter = true;
this.GetWindow()?.Close();
}
#endregion
#region CnacelCommand -- 取消命令
/// <summary>
/// 取消命令
/// </summary>
public VCommand CancelCommand { get; set; }
/// <summary>
/// 取消
/// </summary>
private void Cancel()
{
this.IsEnter = false;
this.GetWindow()?.Close();
}
#endregion
/// <summary>
/// 更新分组信息结合
/// </summary>
private void UpdateGroupInfos()
{
if (this.SelectedTeamInfo == null)
{
this.GroupInfos = null;
this.SelectedGroupInfo = null;
return;
}
ObservableCollection<GroupTempModel> groupInfos = new ObservableCollection<GroupTempModel>();
var groups = ApplicationDomainEx.PlayerInfos.Where(p => p.TeamInfoModel == this.SelectedTeamInfo).GroupBy(p => p.Group);
foreach (var group in groups)
{
GroupTempModel model = new GroupTempModel();
model.TeamInfo = this.SelectedTeamInfo;
foreach (PlayerInfoModel item in group)
{
model.Players.Add(item);
}
groupInfos.Add(model);
}
this.GroupInfos = groupInfos;
}
}
}
<Window x:Class="VIZ.TVP.Golf.Module.GroupPickerWindow"
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:VIZ.TVP.Golf.Module"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Title="高尔夫工具 分组选择" Height="450" Width="800">
<Grid>
<local:GroupPickerView x:Name="groupPickerView" Margin="5"></local:GroupPickerView>
</Grid>
</Window>
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 VIZ.TVP.Golf.Module
{
/// <summary>
/// GroupPickerWindow.xaml 的交互逻辑
/// </summary>
public partial class GroupPickerWindow : Window
{
public GroupPickerWindow()
{
InitializeComponent();
}
}
}
<UserControl x:Class="VIZ.TVP.Golf.Module.HolePickerPanel"
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:VIZ.TVP.Golf.Module"
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:domain="clr-namespace:VIZ.TVP.Golf.Domain;assembly=VIZ.TVP.Golf.Domain"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
mc:Ignorable="d" d:Background="White"
d:DataContext="{d:DesignInstance Type=local:HolePickerPanelModel}"
d:DesignHeight="160" d:DesignWidth="600">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<core:String2ImageSourceConverter x:Key="String2ImageSourceConverter" Type="Relative" WorkPath="picture/hole"></core:String2ImageSourceConverter>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 预设洞信息 -->
<TextBlock Text="预设洞信息:" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<ComboBox Grid.Column="1" Margin="5,0,0,0" Height="30" ItemsSource="{Binding Source={x:Static domain:ApplicationDomainEx.HoleInfos}}" VerticalContentAlignment="Center"
SelectedValue="{Binding Path=SelectedHoleInfo,Mode=TwoWay}" DisplayMemberPath="HoleID"></ComboBox>
<fcommon:IconButton Style="{StaticResource IconButton_Green}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/presets_16x16.png"
Content="采用预设" Grid.Column="2" Width="120" Height="30"
Command="{Binding PresetHoleCommand}"></fcommon:IconButton>
<!-- 洞编号 -->
<TextBlock Text="洞编号:" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0"></TextBlock>
<TextBox Text="{Binding Path=HoleID,Mode=TwoWay}" AcceptsReturn="False" VerticalContentAlignment="Center"
Padding="3,0,3,0" Margin="5,0,0,0" Grid.Row="1" Grid.Column="1" Height="30"></TextBox>
<!-- 标准杆 -->
<TextBlock Text="标准杆:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0"></TextBlock>
<TextBox Grid.Row="2" Grid.Column="1" Height="30" AcceptsReturn="False" VerticalContentAlignment="Center"
Text="{Binding Path=Par,Mode=TwoWay}" Padding="3,0,3,0" Margin="5,0,0,0"></TextBox>
<!-- 洞图片 -->
<TextBlock Text="洞图片:" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0"></TextBlock>
<ComboBox Grid.Row="3" Grid.Column="1" Margin="5,0,0,0" Height="30" VerticalContentAlignment="Center"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.HolePictures}}"
SelectedValue="{Binding Path=HolePicture,Mode=TwoWay}"></ComboBox>
<!-- 洞图片预览 -->
<Border Grid.Column="2" Grid.Row="1" Grid.RowSpan="3" BorderThickness="1" BorderBrush="#44000000" Margin="10,5,10,5">
<Image Source="{Binding Path=HolePicture,Converter={StaticResource String2ImageSourceConverter}}"></Image>
</Border>
</Grid>
</UserControl>
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 VIZ.TVP.Golf.Module
{
/// <summary>
/// HolePickerPanel.xaml 的交互逻辑
/// </summary>
public partial class HolePickerPanel : UserControl
{
public HolePickerPanel()
{
InitializeComponent();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 洞选择面板视图模型
/// </summary>
public class HolePickerPanelModel : ViewModelBase
{
public HolePickerPanelModel()
{
// 初始化命令
this.InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.PresetHoleCommand = new VCommand(this.PresetHole);
}
#region SelectedHoleInfo -- 选中的洞信息
private HoleInfoModel selectedHoleInfo;
/// <summary>
/// 选中的洞信息
/// </summary>
public HoleInfoModel SelectedHoleInfo
{
get { return selectedHoleInfo; }
set { selectedHoleInfo = value; this.RaisePropertyChanged(nameof(SelectedHoleInfo)); }
}
#endregion
#region HoleID -- 洞编号
private string holeID;
/// <summary>
/// 洞编号
/// </summary>
public string HoleID
{
get { return holeID; }
set { holeID = value; this.RaisePropertyChanged(nameof(HoleID)); }
}
#endregion
#region Par -- 标准杆
private string par;
/// <summary>
/// 标准杆
/// </summary>
public string Par
{
get { return par; }
set { par = value; this.RaisePropertyChanged(nameof(Par)); }
}
#endregion
#region HolePicture -- 洞图片
private string holePicture;
/// <summary>
/// 洞图片
/// </summary>
public string HolePicture
{
get { return holePicture; }
set { holePicture = value; this.RaisePropertyChanged(nameof(HolePicture)); }
}
#endregion
#region PresetHoleCommand -- 预设洞命令
/// <summary>
/// 预设洞命令
/// </summary>
public VCommand PresetHoleCommand { get; set; }
/// <summary>
/// 预设洞
/// </summary>
private void PresetHole()
{
if (this.SelectedHoleInfo == null)
{
this.HoleID = null;
this.Par = null;
this.HolePicture = null;
}
else
{
this.HoleID = this.SelectedHoleInfo.HoleID.ToString();
this.Par = this.SelectedHoleInfo.Par.ToString();
this.HolePicture = this.SelectedHoleInfo.Picture;
}
}
#endregion
}
}
<UserControl x:Class="VIZ.TVP.Golf.Module.RealDataView"
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:behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:VIZ.TVP.Golf.Module"
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:domain="clr-namespace:VIZ.TVP.Golf.Domain;assembly=VIZ.TVP.Golf.Domain"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
d:Background="White"
d:DataContext="{d:DesignInstance Type=local:RealDataViewModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="Loaded">
<behaviors:InvokeCommandAction Command="{Binding LoadedCommand}" />
</behaviors:EventTrigger>
</behaviors:Interaction.Triggers>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<!-- 文件清单 -->
<DataGrid AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False"
ItemsSource="{Binding Path=Files}" SelectedValue="{Binding Path=SelectedFile,Mode=TwoWay}">
<DataGrid.Columns>
<DataGridTextColumn Header="时间" Width="200" Binding="{Binding Path=Time}" IsReadOnly="True"></DataGridTextColumn>
<DataGridTextColumn Header="完整路径" Width="500" Binding="{Binding Path=FullPath}" IsReadOnly="True"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<!-- 按钮组 -->
<Grid Grid.Row="1" Grid.Column="1">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width="100" Height="30" Content="确定" Margin="5" Command="{Binding EnterCommand}"></Button>
<Button Width="100" Height="30" Content="取消" Margin="5" Command="{Binding CancelCommand}"></Button>
</StackPanel>
</Grid>
</Grid>
</UserControl>
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;
using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// RealDataView.xaml 的交互逻辑
/// </summary>
public partial class RealDataView : UserControl
{
public RealDataView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new RealDataViewModel());
}
}
}
using log4net;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Service;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 真实数据视图模型
/// </summary>
public class RealDataViewModel : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(RealDataViewModel));
public RealDataViewModel()
{
// 初始化命令
this.InitCommnad();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommnad()
{
this.LoadedCommand = new VCommand(this.Loaded);
this.RefreshCommand = new VCommand(this.Refresh);
this.EnterCommand = new VCommand(this.Enter);
this.CancelCommand = new VCommand(this.Cancel);
}
// ===================================================================================
// Field
// ===================================================================================
/// <summary>
/// 实时数据服务
/// </summary>
private IRealDataService realDataService = new RealDataService();
// ===================================================================================
// Property
// ===================================================================================
#region Files -- 文件集合
private List<FileTempModel> files;
/// <summary>
/// 文件集合
/// </summary>
public List<FileTempModel> Files
{
get { return files; }
set { files = value; this.RaisePropertyChanged(nameof(Files)); }
}
#endregion
#region SelectedFile -- 选中的文件
private FileTempModel selectedFile;
/// <summary>
/// 选中的文件
/// </summary>
public FileTempModel SelectedFile
{
get { return selectedFile; }
set { selectedFile = value; this.RaisePropertyChanged(nameof(SelectedFile)); }
}
#endregion
#region IsEnter -- 是否确定
private bool isEnter;
/// <summary>
/// 是否确定
/// </summary>
public bool IsEnter
{
get { return isEnter; }
set { isEnter = value; this.RaisePropertyChanged(nameof(IsEnter)); }
}
#endregion
// ===================================================================================
// Command
// ===================================================================================
#region LoadedCommand -- 加载命令
/// <summary>
/// 加载命令
/// </summary>
public VCommand LoadedCommand { get; set; }
/// <summary>
/// 加载
/// </summary>
private void Loaded()
{
this.Refresh();
}
#endregion
#region RefreshCommand -- 刷新命令
/// <summary>
/// 刷新命令
/// </summary>
public VCommand RefreshCommand { get; set; }
/// <summary>
/// 刷新
/// </summary>
private void Refresh()
{
List<string> files = this.realDataService.GetLocalDataFiles(ApplicationDomainEx.REMOTE_DATA_WORK_PATH);
if (files == null)
return;
List<FileTempModel> list = new List<FileTempModel>();
// yyyy_MM_dd__HH_mm_ss
foreach (string file in files)
{
FileTempModel model = new FileTempModel();
model.FullPath = file;
model.FileName = Path.GetFileName(file);
string[] parts = Path.GetFileNameWithoutExtension(file).Split(new string[] { "__" }, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length != 2)
continue;
model.Time = $"{parts[0].Replace("_", "-")} {parts[1].Replace("_", ":")}";
list.Add(model);
}
this.Files = list.OrderByDescending(p => p.Time).ToList();
}
#endregion
#region EnterCommand -- 确定命令
/// <summary>
/// 确定
/// </summary>
public VCommand EnterCommand { get; set; }
/// <summary>
/// 确定
/// </summary>
private void Enter()
{
if (this.SelectedFile == null)
{
MessageBox.Show("请选择本地实时数据文件");
return;
}
this.IsEnter = true;
this.GetWindow()?.Close();
}
#endregion
#region CancelCommand -- 取消命令
/// <summary>
/// 取消命令
/// </summary>
public VCommand CancelCommand { get; set; }
/// <summary>
/// 取消
/// </summary>
private void Cancel()
{
this.IsEnter = false;
this.GetWindow()?.Close();
}
#endregion
}
}
<Window x:Class="VIZ.TVP.Golf.Module.RealDataWindow"
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:VIZ.TVP.Golf.Module"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Title="高尔夫工具 本地实时数据选择" Height="450" Width="800">
<Grid>
<local:RealDataView x:Name="realDataView" Margin="5"></local:RealDataView>
</Grid>
</Window>
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 VIZ.TVP.Golf.Module
{
/// <summary>
/// RealDataWindow.xaml 的交互逻辑
/// </summary>
public partial class RealDataWindow : Window
{
public RealDataWindow()
{
InitializeComponent();
}
}
}
......@@ -3,4 +3,5 @@
<package id="Extended.Wpf.Toolkit" version="4.4.0" targetFramework="net48" />
<package id="LiteDB" version="5.0.12" targetFramework="net48" />
<package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.39" targetFramework="net48" />
</packages>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("VIZ.TVP.Golf.Service")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VIZ.TVP.Golf.Service")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("1881b036-d5ee-4510-9e07-b2a1e1a4bfbf")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using log4net;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Service
{
/// <summary>
/// 真实数据服务
/// </summary>
public class RealDataService : IRealDataService
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(RealDataService));
/// <summary>
/// 文件锁对象
/// </summary>
private readonly object file_lock_object = new object();
/// <summary>
/// 加载球员数据
/// </summary>
/// <param name="fileName">文件名</param>
/// <returns>球员实时数据</returns>
public List<PlayerRealModel> LoadPlayerRealModelFormLocal(string fileName)
{
try
{
string path = Path.Combine(ApplicationDomainEx.REMOTE_DATA_WORK_PATH, fileName);
if (!File.Exists(path))
return null;
lock (this.file_lock_object)
{
using (StreamReader sr = new StreamReader(path))
{
XElement root = XElement.Load(sr);
TournamentNode node = new TournamentNode();
node.FromXElement(root);
List<PlayerRealModel> list = new List<PlayerRealModel>();
foreach (PlayerNode player in node.Players)
{
PlayerRealModel model = new PlayerRealModel();
model.FromNode(player);
model.PlayerInfoModel = ApplicationDomainEx.PlayerInfos.FirstOrDefault(p => p.PlayerID == model.Node.id);
if (model.PlayerInfoModel != null)
{
model.TeamInfoModel = ApplicationDomainEx.TeamInfos.FirstOrDefault(p => p.TeamID == model.PlayerInfoModel.TeamID);
}
list.Add(model);
}
return list;
}
}
}
catch (Exception ex)
{
log.Error(ex);
return null;
}
}
/// <summary>
/// 下载数据
/// </summary>
/// <param name="url">接口地址</param>
/// <returns>球员实时数据</returns>
public string DownLoadData(string url)
{
try
{
if (!Directory.Exists(ApplicationDomainEx.REMOTE_DATA_WORK_PATH))
{
Directory.CreateDirectory(ApplicationDomainEx.REMOTE_DATA_WORK_PATH);
}
string path = Path.Combine(ApplicationDomainEx.REMOTE_DATA_WORK_PATH, $"{DateTime.Now.ToString("yyyy_MM_dd__HH_mm_ss")}.xml");
// 获取xml
string xml = HttpHelper.Get(url, null);
if (string.IsNullOrWhiteSpace(xml))
return null;
// 保存文件
lock (this.file_lock_object)
{
using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
{
byte[] buffer = Encoding.UTF8.GetBytes(xml);
fs.Write(buffer, 0, buffer.Length);
}
}
return Path.GetFileName(path);
}
catch (Exception ex)
{
log.Error(ex);
return null;
}
}
/// <summary>
/// 获取本地数据集合
/// </summary>
/// <param name="dir">工作文件夹</param>
/// <returns>本地数据文件名</returns>
public List<string> GetLocalDataFiles(string dir)
{
string[] files = Directory.GetFiles(dir, "*.xml");
return files.ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Service
{
/// <summary>
/// 真实数据服务
/// </summary>
public interface IRealDataService
{
/// <summary>
/// 加载球员数据
/// </summary>
/// <param name="fileName">文件名</param>
/// <returns>球员实时数据</returns>
List<PlayerRealModel> LoadPlayerRealModelFormLocal(string fileName);
/// <summary>
/// 下载数据
/// </summary>
/// <param name="url">接口地址</param>
/// <returns>最新的文件名</returns>
string DownLoadData(string url);
/// <summary>
/// 获取本地数据集合
/// </summary>
/// <param name="dir">工作文件夹</param>
/// <returns>本地数据文件名</returns>
List<string> GetLocalDataFiles(string dir);
}
}
<?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>{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VIZ.TVP.Golf.Service</RootNamespace>
<AssemblyName>VIZ.TVP.Golf.Service</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="LiteDB, Version=5.0.12.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.12\lib\net45\LiteDB.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RealData\Implementation\RealDataService.cs" />
<Compile Include="RealData\Interface\IRealDataService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Core\VIZ.Framework.Core.csproj">
<Project>{75b39591-4bc3-4b09-bd7d-ec9f67efa96e}</Project>
<Name>VIZ.Framework.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Domain\VIZ.Framework.Domain.csproj">
<Project>{28661e82-c86a-4611-a028-c34f6ac85c97}</Project>
<Name>VIZ.Framework.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Storage\VIZ.Framework.Storage.csproj">
<Project>{06b80c09-343d-4bb2-aeb1-61cfbfbf5cad}</Project>
<Name>VIZ.Framework.Storage</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Golf.Core\VIZ.TVP.Golf.Core.csproj">
<Project>{56d41597-a835-4195-a53f-ce7b3fc27839}</Project>
<Name>VIZ.TVP.Golf.Core</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Golf.Domain\VIZ.TVP.Golf.Domain.csproj">
<Project>{455e59f6-e208-4dea-bb36-b419dee0133f}</Project>
<Name>VIZ.TVP.Golf.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Golf.Storage\VIZ.TVP.Golf.Storage.csproj">
<Project>{96040211-e7a3-4aa1-8227-529afb65fa78}</Project>
<Name>VIZ.TVP.Golf.Storage</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LiteDB" version="5.0.12" targetFramework="net48" />
<package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
</packages>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Storage;
namespace VIZ.TVP.Golf.Storage
{
/// <summary>
/// 接口配置
/// </summary>
public class InterfaceConfig : IniConfigBase
{
/// <summary>
/// 竞标赛接口地址
/// </summary>
[Ini(Section = "Interface", DefaultValue = "https://lianmeng.scoringchina.com/data/api.xmlmatch/xml?matchid=31", Type = typeof(string))]
public string INTERFACE_TOURNAMENT { get; set; }
/// <summary>
/// 接口数据保存数量
/// </summary>
[Ini(Section = "Interface", DefaultValue = "50", Type = typeof(int))]
public string INTERFACE_SAVE_COUNT { get; set; }
}
}
......@@ -24,6 +24,11 @@ namespace VIZ.TVP.Golf.Storage
public int HoleID { get; set; }
/// <summary>
/// 标准杆
/// </summary>
public int Par { get; set; }
/// <summary>
/// 照片
/// </summary>
public string Picture { get; set; }
......
......@@ -44,9 +44,9 @@ namespace VIZ.TVP.Golf.Storage
public SexEnum Sex { get; set; }
/// <summary>
/// 国家
/// 分组
/// </summary>
public string Country { get; set; }
public string Group { get; set; }
/// <summary>
/// 全身照路径(相对路径)
......
......@@ -73,6 +73,7 @@
<ItemGroup>
<Compile Include="Enum\StaticEnumInfos.cs" />
<Compile Include="Enum\SexEnum.cs" />
<Compile Include="Ini\InterfaceConfig.cs" />
<Compile Include="Ini\ClientConfig.cs" />
<Compile Include="LiteDB\Entity\HoleInfo.cs" />
<Compile Include="LiteDB\Entity\TournamentInfo.cs" />
......
......@@ -66,6 +66,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.TVP.Golf.UnitTest", "VI
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.Framework.TVP", "..\VIZ.Framework\VIZ.Framework.TVP\VIZ.Framework.TVP.csproj", "{3E7AF8B3-24AA-44EE-A242-30E4E3DCC20C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "55-Service", "55-Service", "{E5A04BFA-CFDE-411F-BFCE-42F1C4637999}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.TVP.Golf.Service", "VIZ.TVP.Golf.Service\VIZ.TVP.Golf.Service.csproj", "{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -292,6 +296,18 @@ Global
{3E7AF8B3-24AA-44EE-A242-30E4E3DCC20C}.Release|x64.Build.0 = Release|Any CPU
{3E7AF8B3-24AA-44EE-A242-30E4E3DCC20C}.Release|x86.ActiveCfg = Release|Any CPU
{3E7AF8B3-24AA-44EE-A242-30E4E3DCC20C}.Release|x86.Build.0 = Release|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Debug|x64.ActiveCfg = Debug|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Debug|x64.Build.0 = Debug|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Debug|x86.ActiveCfg = Debug|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Debug|x86.Build.0 = Debug|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Release|Any CPU.Build.0 = Release|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Release|x64.ActiveCfg = Release|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Release|x64.Build.0 = Release|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Release|x86.ActiveCfg = Release|Any CPU
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -315,6 +331,7 @@ Global
{21F2A416-8D25-4EA9-8B49-23030D2E70CF} = {97EF3462-638D-43A2-91F0-A8711C3B2441}
{31C30CEE-6C67-4501-9D27-FE1434F0022F} = {C8BC2310-EC1F-4740-B0E1-5D1970CB8ABC}
{3E7AF8B3-24AA-44EE-A242-30E4E3DCC20C} = {B2591788-4947-4FE8-9BCE-D19402638450}
{1881B036-D5EE-4510-9E07-B2A1E1A4BFBF} = {E5A04BFA-CFDE-411F-BFCE-42F1C4637999}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {707D0154-A468-43A1-B3B7-C21E1B09C409}
......
......@@ -21,6 +21,8 @@ namespace VIZ.TVP.Golf
AppSetup.AppendSetup(new AppSetup_InitLiteDB());
// 初始化 包装资源
AppSetup.AppendSetup(new AppSetup_InitResource());
// 初始化 清理远程数据
AppSetup.AppendSetup(new AppSetup_ClearLocalData());
// 启动
AppSetupContext context = AppSetup.Setup();
......
......@@ -61,6 +61,9 @@
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.39\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
......@@ -204,41 +207,25 @@
</None>
</ItemGroup>
<ItemGroup>
<None Include="images\Weather.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="images\begin.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="images\CenterInformation.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="images\Countdown.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="images\FourNameBar.jpg">
<None Include="images\CenterPlayerRanking.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="images\CenterPlayerRanking.jpg">
<None Include="images\CenterTeamRanking.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="images\CenterTeamRanking.jpg">
<None Include="images\BottomHoleInfo.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="picture\team\东北大学.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
......
......@@ -7,6 +7,7 @@ APPLICATION_IS_DEBUG=false
; ============================================================
; === Client ===
; ============================================================
[Client]
; VIZ IP地址
CLIENT_VIZ_IP=127.0.0.1
; VIZ端口
......@@ -14,4 +15,12 @@ CLIENT_VIZ_PORT=6100
; 备库 VIZ IP地址
CLIENT_VIZ_IP_STANDBY=127.0.0.1
; 备库 VIZ端口
CLIENT_VIZ_PORT_STANDBY=6100
\ No newline at end of file
CLIENT_VIZ_PORT_STANDBY=6100
; ============================================================
; === Intereface ===
; ============================================================
[Intereface]
; 赛事接口
INTERFACE_TOURNAMENT=https://lianmeng.scoringchina.com/data/api.xmlmatch/xml?matchid=31
; 接口数据保存数量
INTERFACE_SAVE_COUNT=50
\ No newline at end of file
......@@ -2,4 +2,5 @@
<packages>
<package id="Extended.Wpf.Toolkit" version="4.4.0" targetFramework="net48" />
<package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.39" targetFramework="net48" />
</packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment