Commit 07671740 by liulongfei

1. 调整样式

2. 添加天气版
parent f2c9a05f
......@@ -25,6 +25,16 @@ namespace VIZ.TVP.Golf.Domain
public static ObservableCollection<TeamInfoModel> TeamInfos { get; set; }
/// <summary>
/// 洞信息列表
/// </summary>
public static ObservableCollection<HoleInfoModel> HoleInfos { get; set; }
/// <summary>
/// 赛事信息
/// </summary>
public static TournamentInfoModel TournamentInfo { get; set; }
/// <summary>
/// LiteDB数据库
/// </summary>
public static LiteDBContext LiteDBContext { get; set; }
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Golf.Domain
{
/// <summary>
/// 视图键
/// </summary>
public static class ViewKeys
{
// ====================================================================================
// 数据准备
// ====================================================================================
/// <summary>
/// 赛事信息视图
/// </summary>
public const string TournamentInfoView = "TournamentInfoView";
/// <summary>
/// 洞列表视图
/// </summary>
public const string HoleListView = "HoleListView";
/// <summary>
/// 队伍列表视图
/// </summary>
public const string TeamListView = "TeamListView";
/// <summary>
/// 球员列表视图
/// </summary>
public const string PlayerListView = "PlayerListView";
// ====================================================================================
// 包装
// ====================================================================================
/// <summary>
/// 底部信息版
/// </summary>
public const string BottomInformationView = "BottomInformationView";
/// <summary>
/// 天气版
/// </summary>
public const string WeatherView = "WeatherView";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Domain
{
/// <summary>
/// 洞信息
/// </summary>
public class HoleInfoModel : ModelBase
{
/// <summary>
/// 实体
/// </summary>
public HoleInfo Entity { get; set; }
#region HoleID -- 洞编号
private int holeID;
/// <summary>
/// 洞编号
/// </summary>
public int HoleID
{
get { return holeID; }
set { holeID = value; this.RaisePropertyChanged(nameof(HoleID)); }
}
#endregion
#region Picture -- 照片
private string pictire;
/// <summary>
/// 照片
/// </summary>
public string Picture
{
get { return pictire; }
set { pictire = value; this.RaisePropertyChanged(nameof(Picture)); }
}
#endregion
/// <summary>
/// 更新属性值实体模型
/// </summary>
public void UpdatePropertyToEntity()
{
this.Entity.HoleID = this.HoleID;
this.Entity.Picture = this.Picture;
}
/// <summary>
/// 从实体模型更新数据
/// </summary>
public void UpdatePropertyFromEntity()
{
this.HoleID = this.Entity.HoleID;
this.Picture = this.Entity.Picture;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Domain
{
/// <summary>
/// 赛事信息模型
/// </summary>
public class TournamentInfoModel : ModelBase
{
/// <summary>
/// 实体
/// </summary>
public TournamentInfo Entity { get; set; }
#region TournamentID -- 赛事ID
private int tournamentID;
/// <summary>
/// 赛事ID
/// </summary>
public int TournamentID
{
get { return tournamentID; }
set { tournamentID = value; this.RaisePropertyChanged(nameof(TournamentID)); }
}
#endregion
#region TournamentName -- 赛事名称
private string tournamentName;
/// <summary>
/// 赛事名称
/// </summary>
public string TournamentName
{
get { return tournamentName; }
set { tournamentName = value; this.RaisePropertyChanged(nameof(TournamentName)); }
}
#endregion
#region BeginTime -- 开始时间
private DateTime beginTime;
/// <summary>
/// 开始时间
/// </summary>
public DateTime BeginTime
{
get { return beginTime; }
set { beginTime = value; this.RaisePropertyChanged(nameof(BeginTime)); }
}
#endregion
#region EndTime -- 结束时间
private DateTime endTime;
/// <summary>
/// 结束时间
/// </summary>
public DateTime EndTime
{
get { return endTime; }
set { endTime = value; this.RaisePropertyChanged(nameof(EndTime)); }
}
#endregion
/// <summary>
/// 更新属性值实体模型
/// </summary>
public void UpdatePropertyToEntity()
{
this.Entity.TournamentID = this.TournamentID;
this.Entity.TournamentName = this.TournamentName;
this.Entity.BeginTime = this.BeginTime;
this.Entity.EndTime = this.EndTime;
}
/// <summary>
/// 从实体模型更新数据
/// </summary>
public void UpdatePropertyFromEntity()
{
this.TournamentID = this.Entity.TournamentID;
this.TournamentName = this.Entity.TournamentName;
this.BeginTime = this.Entity.BeginTime;
this.EndTime = this.Entity.EndTime;
}
}
}
......@@ -65,8 +65,11 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationDomainEx.cs" />
<Compile Include="Enum\ViewKeys.cs" />
<Compile Include="Model\EntityModel\HoleInfoModel.cs" />
<Compile Include="Model\EntityModel\PlayerInfoModel.cs" />
<Compile Include="Model\EntityModel\TeamInfoModel.cs" />
<Compile Include="Model\EntityModel\TournamentInfoModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
......
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common">
<Style x:Key="IconButton_Default" TargetType="fcommon:IconButton">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="BorderBrush" Value="#88000000"></Setter>
<Setter Property="BorderThickness" Value="1"></Setter>
<Setter Property="MinWidth" Value="80"></Setter>
<Setter Property="Height" Value="30"></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="5,0,0,0"></ContentPresenter>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#aa86abe2"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="RadioButton_MainView" TargetType="RadioButton">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border x:Name="bd" Background="Transparent">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"></ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="#444ec2ab"></Setter>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="bd" Property="Background" Value="#ff4ec2ab"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -68,6 +68,14 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Page Include="Style\IconButton\IconButton_Default.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Style\RadioButton\RadioButton_MainView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......@@ -99,6 +107,14 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Common.Resource\VIZ.Framework.Common.Resource.csproj">
<Project>{76ef480a-e486-41b7-b7a5-2a849fc8d5bf}</Project>
<Name>VIZ.Framework.Common.Resource</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Common\VIZ.Framework.Common.csproj">
<Project>{92834c05-703e-4f05-9224-f36220939d8f}</Project>
<Name>VIZ.Framework.Common</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Core\VIZ.Framework.Core.csproj">
<Project>{75b39591-4bc3-4b09-bd7d-ec9f67efa96e}</Project>
<Name>VIZ.Framework.Core</Name>
......@@ -123,10 +139,6 @@
<Project>{455e59f6-e208-4dea-bb36-b419dee0133f}</Project>
<Name>VIZ.TVP.Golf.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Golf.Module\VIZ.TVP.Golf.Module.csproj">
<Project>{f9f79f33-b05f-40ec-8099-ece3fb61446f}</Project>
<Name>VIZ.TVP.Golf.Module</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>
......@@ -135,5 +147,20 @@
<ItemGroup>
<Folder Include="Converter\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\save_16x16.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\db_16x16.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\remote_16x16.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\up_16x16.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\down_16x16.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<UserControl x:Class="VIZ.TVP.Golf.Module.HoleListView"
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"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
</UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 洞列表支持
/// </summary>
public class HoleListController
{
/// <summary>
/// 洞列表支持
/// </summary>
/// <param name="support">洞列表支持</param>
public HoleListController(IHoleListSupport support)
{
this.Support = support;
}
/// <summary>
/// 支持
/// </summary>
public IHoleListSupport Support { get; private set; }
/// <summary>
/// 将数据保存值数据库
/// </summary>
public void SaveToDB()
{
lock (ApplicationDomainEx.HoleInfos)
{
foreach (HoleInfoModel model in ApplicationDomainEx.HoleInfos)
{
model.UpdatePropertyToEntity();
ApplicationDomainEx.LiteDBContext.HoleInfos.Upsert(model.Entity);
}
}
}
/// <summary>
/// 从数据库中加载数据
/// </summary>
public void LoadFromDB()
{
lock (ApplicationDomainEx.HoleInfos)
{
Dictionary<int, HoleInfoModel> dic = ApplicationDomainEx.HoleInfos.ToDictionary(p => p.Entity.ID);
var query = ApplicationDomainEx.LiteDBContext.HoleInfos.FindAll();
foreach (HoleInfo entity in query)
{
if (!dic.TryGetValue(entity.ID, out HoleInfoModel model))
{
model = new HoleInfoModel();
ApplicationDomainEx.HoleInfos.Add(model);
}
model.Entity = entity;
model.UpdatePropertyFromEntity();
}
}
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 洞列表支持
/// </summary>
public interface IHoleListSupport
{
}
}
<UserControl x:Class="VIZ.TVP.Golf.Module.HoleListView"
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"
mc:Ignorable="d"
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"
d:DataContext="{d:DesignInstance Type=local:HoleListViewModel}"
d:Background="White"
x:Name="uc"
d:DesignHeight="800" d:DesignWidth="1200">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 操作项 -->
<Border BorderBrush="#44000000" BorderThickness="1" Background="#66b6f2e3" Margin="5" Padding="5">
<StackPanel Orientation="Horizontal">
<fcommon:IconButton Style="{StaticResource IconButton_Default}"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/remote_16x16.png"
Content="加载远程数据"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Default}" Margin="5,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/db_16x16.png"
Content="加载本地数据"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Default}" Margin="5,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/save_16x16.png"
Content="保存"></fcommon:IconButton>
</StackPanel>
</Border>
<!-- 内容 -->
<Border Grid.Row="1" BorderBrush="#44000000" BorderThickness="1" Margin="5" Padding="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="400"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 数据表格 -->
<DataGrid Grid.Row="1" CanUserAddRows="False" AutoGenerateColumns="False"
ItemsSource="{Binding Path=HoleInfos,Mode=OneWay}" FontSize="14"
SelectedValue="{Binding Path=SelectedHoleInfo,Mode=TwoWay}">
<DataGrid.Columns>
<DataGridTextColumn Header="编号" Width="80" Binding="{Binding Path=HoleID,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="照片" Width="200" Binding="{Binding Path=Picture,Mode=TwoWay}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</Grid>
</UserControl>
......@@ -12,6 +12,7 @@ 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
{
......@@ -23,6 +24,8 @@ namespace VIZ.TVP.Golf.Module
public HoleListView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new HoleListViewModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 洞 列表视图模型
/// </summary>
public class HoleListViewModel : ViewModelBase, IHoleListSupport
{
public HoleListViewModel()
{
// 初始化属性
this.InitProperty();
// 初始化控制器
this.InitController();
// 初始化命令
this.InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.LoadTestDataCommand = new VCommand(this.LoadTestData);
this.LoadLocalDataCommand = new VCommand(this.LoadLocalData);
this.LoadRemoteDataCommand = new VCommand(this.LoadRemoteData);
this.SaveLocalDataCommand = new VCommand(this.SaveLocalData);
}
/// <summary>
/// 初始化属性
/// </summary>
private void InitProperty()
{
this.HoleInfos = ApplicationDomainEx.HoleInfos;
}
/// <summary>
/// 初始化控制器
/// </summary>
private void InitController()
{
this.holeListController = new HoleListController(this);
}
// =====================================================================================
// Controller
// =====================================================================================
/// <summary>
/// 球员列表控制器
/// </summary>
private HoleListController holeListController;
// =====================================================================================
// Property
// =====================================================================================
#region HoleInfos -- 球员信息列表
private ObservableCollection<HoleInfoModel> holeInfos;
/// <summary>
/// 球员信息列表
/// </summary>
public ObservableCollection<HoleInfoModel> HoleInfos
{
get { return holeInfos; }
set { holeInfos = value; this.RaisePropertyChanged(nameof(HoleInfos)); }
}
#endregion
#region SelectedHoleInfo -- 选中的球员信息
private HoleInfoModel selectedHoleInfo;
/// <summary>
/// 选中的球员信息
/// </summary>
public HoleInfoModel SelectedHoleInfo
{
get { return selectedHoleInfo; }
set { selectedHoleInfo = value; this.RaisePropertyChanged(nameof(SelectedHoleInfo)); }
}
#endregion
// =====================================================================================
// Command
// =====================================================================================
#region LoadTestDataCommand -- 加载测试数据命令
/// <summary>
/// 加载测试数据命令
/// </summary>
public VCommand LoadTestDataCommand { get; set; }
/// <summary>
/// 加载测试
/// </summary>
private void LoadTestData()
{
this.HoleInfos.Add(new HoleInfoModel { HoleID = 1, Picture = "test1" });
this.HoleInfos.Add(new HoleInfoModel { HoleID = 2, Picture = "test2" });
}
#endregion
#region LoadLocalDataCommand -- 加载本地数据命令
/// <summary>
/// 加载本地数据命令
/// </summary>
public VCommand LoadLocalDataCommand { get; set; }
/// <summary>
/// 加载本地数据命令
/// </summary>
private void LoadLocalData()
{
this.holeListController.LoadFromDB();
}
#endregion
#region LoadRemoteDataCommand -- 加载远程数据命令
/// <summary>
/// 加载远程数据命令
/// </summary>
public VCommand LoadRemoteDataCommand { get; set; }
/// <summary>
/// 加载远程数据
/// </summary>
private void LoadRemoteData()
{
}
#endregion
#region SaveLocalDataCommand -- 保存本地数据命令
/// <summary>
/// 保存本地数据命令
/// </summary>
public VCommand SaveLocalDataCommand { get; set; }
/// <summary>
/// 保存本地数据
/// </summary>
private void SaveLocalData()
{
this.holeListController.SaveToDB();
}
#endregion
}
}
\ No newline at end of file
......@@ -4,6 +4,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
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:local="clr-namespace:VIZ.TVP.Golf.Module"
d:DataContext="{d:DesignInstance Type=local:PlayerListViewModel}"
......@@ -11,41 +13,52 @@
x:Name="uc"
d:DesignHeight="800" d:DesignWidth="1200">
<UserControl.Resources>
<core:Enum2EnumDescriptionConverter x:Key="Enum2EnumDescriptionConverter" EnumType="{x:Type storage:SexEnum}"></core:Enum2EnumDescriptionConverter>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<core:Enum2EnumDescriptionConverter x:Key="Enum2EnumDescriptionConverter" EnumType="{x:Type storage:SexEnum}"></core:Enum2EnumDescriptionConverter>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="300"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<Button Width="120" Height="30" Content="加载测试数据" Command="{Binding LoadTestDataCommand}"></Button>
<Button Width="120" Height="30" Content="加载远程数据" Command="{Binding LoadRemoteDataCommand}" Margin="20,0,0,0"></Button>
<Button Width="120" Height="30" Content="加载本地数据" Command="{Binding LoadLocalDataCommand}" Margin="20,0,0,0"></Button>
<Button Width="120" Height="30" Content="保存数据" Command="{Binding SaveLocalDataCommand}" Margin="20,0,0,0"></Button>
</StackPanel>
<!-- 数据表格 -->
<DataGrid Grid.Row="1" CanUserAddRows="False" AutoGenerateColumns="False"
<!-- 操作项 -->
<Border BorderBrush="#44000000" BorderThickness="1" Background="#66b6f2e3" Margin="5" Padding="5">
<StackPanel Orientation="Horizontal">
<fcommon:IconButton Style="{StaticResource IconButton_Default}"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/remote_16x16.png"
Content="加载远程数据"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Default}" Margin="5,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/db_16x16.png"
Content="加载本地数据"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Default}" Margin="5,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/save_16x16.png"
Content="保存"></fcommon:IconButton>
</StackPanel>
</Border>
<!-- 内容 -->
<Border Grid.Row="1" BorderBrush="#44000000" BorderThickness="1" Margin="5" Padding="5">
<Grid>
<!-- 数据表格 -->
<DataGrid CanUserAddRows="False" AutoGenerateColumns="False"
ItemsSource="{Binding Path=PlayerInfos,Mode=OneWay}" FontSize="14"
SelectedValue="{Binding Path=SelectedPlayerInfo,Mode=TwoWay}">
<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"
SelectedItemBinding="{Binding Path=Sex,Mode=TwoWay,Converter={StaticResource Enum2EnumDescriptionConverter}}"
ItemsSource="{Binding Source={x:Static Member=storage:StaticEnumInfos.SexEnumDescriptions}}"></DataGridComboBoxColumn>
<DataGridTextColumn Header="国家" Width="120" Binding="{Binding Path=Country,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="全身照" Width="200" Binding="{Binding Path=FullPicture,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="半身照" Width="200" Binding="{Binding Path=HalfPicture,Mode=TwoWay}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<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"
SelectedItemBinding="{Binding Path=Sex,Mode=TwoWay,Converter={StaticResource Enum2EnumDescriptionConverter}}"
ItemsSource="{Binding Source={x:Static Member=storage:StaticEnumInfos.SexEnumDescriptions}}"></DataGridComboBoxColumn>
<DataGridTextColumn Header="国家" Width="120" Binding="{Binding Path=Country,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="全身照" Width="200" Binding="{Binding Path=FullPicture,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="半身照" Width="200" Binding="{Binding Path=HalfPicture,Mode=TwoWay}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</Grid>
</UserControl>
......@@ -4,39 +4,55 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
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:local="clr-namespace:VIZ.TVP.Golf.Module"
d:DataContext="{d:DesignInstance Type=local:TeamListViewModel}"
mc:Ignorable="d"
x:Name="uc"
d:DesignHeight="800" d:DesignWidth="1200">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<core:Enum2EnumDescriptionConverter x:Key="Enum2EnumDescriptionConverter" EnumType="{x:Type storage:SexEnum}"></core:Enum2EnumDescriptionConverter>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="300"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<Button Width="120" Height="30" Content="加载测试数据" Command="{Binding LoadTestDataCommand}"></Button>
<Button Width="120" Height="30" Content="加载远程数据" Command="{Binding LoadRemoteDataCommand}" Margin="20,0,0,0"></Button>
<Button Width="120" Height="30" Content="加载本地数据" Command="{Binding LoadLocalDataCommand}" Margin="20,0,0,0"></Button>
<Button Width="120" Height="30" Content="保存数据" Command="{Binding SaveLocalDataCommand}" Margin="20,0,0,0"></Button>
</StackPanel>
<!-- 数据表格 -->
<DataGrid Grid.Row="1" CanUserAddRows="False" AutoGenerateColumns="False"
<!-- 操作项 -->
<Border BorderBrush="#44000000" BorderThickness="1" Background="#66b6f2e3" Margin="5" Padding="5">
<StackPanel Orientation="Horizontal">
<fcommon:IconButton Style="{StaticResource IconButton_Default}"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/remote_16x16.png"
Content="加载远程数据"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Default}" Margin="5,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/db_16x16.png"
Content="加载本地数据"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Default}" Margin="5,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/save_16x16.png"
Content="保存"></fcommon:IconButton>
</StackPanel>
</Border>
<!-- 内容 -->
<Border Grid.Row="1" BorderBrush="#44000000" BorderThickness="1" Margin="5" Padding="5">
<Grid>
<!-- 数据表格 -->
<DataGrid CanUserAddRows="False" AutoGenerateColumns="False"
ItemsSource="{Binding Path=TeamInfos,Mode=OneWay}" FontSize="14"
SelectedValue="{Binding Path=SelectedTeamInfo,Mode=TwoWay}">
<DataGrid.Columns>
<DataGridTextColumn Header="球队编号" Width="80" Binding="{Binding Path=TeamID,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="名称" Width="200" Binding="{Binding Path=Name,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="照片" Width="80" Binding="{Binding Path=Picture,Mode=TwoWay}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<DataGrid.Columns>
<DataGridTextColumn Header="球队编号" Width="80" Binding="{Binding Path=TeamID,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="名称" Width="200" Binding="{Binding Path=Name,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="照片" Width="80" Binding="{Binding Path=Picture,Mode=TwoWay}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</Grid>
</UserControl>
\ No newline at end of file
......@@ -3,15 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 洞 列表视图模型
/// 赛事信息支持
/// </summary>
public class HoleListViewModel : ViewModelBase
public interface ITournamentInfoSupport
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 赛事信息控制器
/// </summary>
public class TournamentInfoController
{
/// <summary>
/// 赛事信息控制器
/// </summary>
/// <param name="support">支持</param>
public TournamentInfoController(ITournamentInfoSupport support)
{
this.Support = support;
}
/// <summary>
/// 支持
/// </summary>
public ITournamentInfoSupport Support { get; private set; }
/// <summary>
/// 将数据保存值数据库
/// </summary>
public void SaveToDB()
{
lock (ApplicationDomainEx.TournamentInfo)
{
ApplicationDomainEx.LiteDBContext.TournamentInfos.Upsert(ApplicationDomainEx.TournamentInfo.Entity);
}
}
/// <summary>
/// 从数据库中加载数据
/// </summary>
public void LoadFromDB()
{
TournamentInfo entity = ApplicationDomainEx.LiteDBContext.TournamentInfos.FindAll().FirstOrDefault();
if (ApplicationDomainEx.TournamentInfo == null)
{
ApplicationDomainEx.TournamentInfo = new TournamentInfoModel();
ApplicationDomainEx.TournamentInfo.Entity = entity;
}
ApplicationDomainEx.TournamentInfo.UpdatePropertyFromEntity();
}
}
}
\ No newline at end of file
<UserControl x:Class="VIZ.TVP.Golf.Module.TournamentInfoView"
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"
d:DataContext="{d:DesignInstance Type=local:TournamentInfoViewModel}"
mc:Ignorable="d"
d:Background="White"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 操作项 -->
<Border BorderBrush="#44000000" BorderThickness="1" Background="#66b6f2e3" Margin="5" Padding="5">
<StackPanel Orientation="Horizontal">
<fcommon:IconButton Style="{StaticResource IconButton_Default}"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/save_16x16.png"
Content="保存"></fcommon:IconButton>
</StackPanel>
</Border>
<!-- 内容 -->
<Border Grid.Row="1" BorderBrush="#44000000" BorderThickness="1" Margin="5" Padding="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="120"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="400"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 赛事ID -->
<TextBlock Text="赛事ID:" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"></TextBlock>
<toolkit:IntegerUpDown Grid.Column="1" Height="30"></toolkit:IntegerUpDown>
<!-- 赛事名称 -->
<TextBlock Text="赛事名称:" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0"
Grid.Row="1"></TextBlock>
<TextBox Grid.Row="1" Grid.Column="1" Height="120" Padding="3" AcceptsReturn="True"></TextBox>
</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>
/// TournamentInfoView.xaml 的交互逻辑
/// </summary>
public partial class TournamentInfoView : UserControl
{
public TournamentInfoView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new TournamentInfoViewModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 赛事信息视图模型
/// </summary>
public class TournamentInfoViewModel : ViewModelBase
{
#region TournamentID -- 赛事ID
private int tournamentID;
/// <summary>
/// 赛事ID
/// </summary>
public int TournamentID
{
get { return tournamentID; }
set { tournamentID = value; this.RaisePropertyChanged(nameof(TournamentID)); }
}
#endregion
#region TournamentName -- 赛事名称
private string tournamentName;
/// <summary>
/// 赛事名称
/// </summary>
public string TournamentName
{
get { return tournamentName; }
set { tournamentName = value; this.RaisePropertyChanged(nameof(TournamentName)); }
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Common;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
namespace VIZ.TVP.Golf.Module
{
......@@ -12,6 +15,9 @@ namespace VIZ.TVP.Golf.Module
/// </summary>
public class MainViewModel : ViewModelBase
{
public MainViewModel()
{
}
}
}
<UserControl x:Class="VIZ.TVP.Golf.Module.BottomInformationView"
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"
d:Background="White"
d:DataContext="{d:DesignInstance Type=local:BottomInformationViewModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="1200">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</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/up_16x16.png"
Content="上版子"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Default}" Margin="5,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/down_16x16.png"
Content="下版子"></fcommon:IconButton>
</StackPanel>
</Border>
<!-- 版子信息 -->
<Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="240"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 标题 -->
<TextBlock Text="标题:" HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,10,10,0" Grid.Row="0"></TextBlock>
<TextBox Grid.Column="1" Padding="3" AcceptsReturn="True" Margin="5"></TextBox>
<!-- 内容 -->
<TextBlock Text="内容:" HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,10,10,0" Grid.Row="1"></TextBlock>
<TextBox Grid.Column="1" Padding="3" AcceptsReturn="True" Margin="5" Grid.Row="1"></TextBox>
</Grid>
</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="*"></RowDefinition>
</Grid.RowDefinitions>
<Image Source="pack://SiteOfOrigin:,,,/images/BottomInformation.jpg" />
<TextBlock Grid.Row="1" Margin="5"></TextBlock>
</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>
/// BottomInformationView.xaml 的交互逻辑
/// </summary>
public partial class BottomInformationView : UserControl
{
public BottomInformationView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new BottomInformationViewModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 包装视图模型 -- 底部信息版
/// </summary>
public class BottomInformationViewModel : PackageViewModelBase
{
public BottomInformationViewModel()
{
}
// ===================================================================================
// Property
// ===================================================================================
#region Title -- 标题
private string title;
/// <summary>
/// 标题
/// </summary>
public string Title
{
get { return title; }
set { title = value; this.RaisePropertyChanged(nameof(Title)); }
}
#endregion
#region Content -- 内容
private string content;
/// <summary>
/// 内容
/// </summary>
public string Content
{
get { return content; }
set { content = value; this.RaisePropertyChanged(nameof(Content)); }
}
#endregion
// ===================================================================================
// Command
// ===================================================================================
#region SendCommand -- 发送命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
{
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 包装视图模型基类
/// </summary>
public abstract class PackageViewModelBase : ViewModelBase
{
public PackageViewModelBase()
{
this.SendCommand = new VCommand(this.Send);
}
#region Command -- 命令
/// <summary>
/// 发送命令
/// </summary>
public VCommand SendCommand { get; set; }
/// <summary>
/// 发送指令
/// </summary>
protected abstract void Send();
#endregion
}
}
<UserControl x:Class="VIZ.TVP.Golf.Module.WeatherView"
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"
d:Background="White"
d:DataContext="{d:DesignInstance Type=local:WeatherViewModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="1200">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</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/up_16x16.png"
Content="上版子"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Default}" Margin="5,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/down_16x16.png"
Content="下版子"></fcommon:IconButton>
</StackPanel>
</Border>
<!-- 版子信息 -->
<Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 温度 -->
<TextBlock Text="温度:" HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,10,0" Grid.Row="0"></TextBlock>
<TextBox Grid.Column="1" Padding="3" AcceptsReturn="False" Margin="5" Height="30"
TextWrapping="NoWrap" VerticalContentAlignment="Center"
Text="{Binding Path=Temperature,Mode=TwoWay}"></TextBox>
<!-- 风力 -->
<TextBlock Text="风力:" HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,10,0" Grid.Row="1"></TextBlock>
<TextBox Grid.Column="1" Padding="3" AcceptsReturn="True" Margin="5" Height="30"
TextWrapping="NoWrap" VerticalContentAlignment="Center" Grid.Row="1"
Text="{Binding Path=Wind,Mode=TwoWay}"></TextBox>
<!-- 湿度 -->
<TextBlock Text="湿度:" HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,10,0" Grid.Row="2"></TextBlock>
<TextBox Grid.Column="1" Padding="3" AcceptsReturn="True" Margin="5" Height="30"
TextWrapping="NoWrap" VerticalContentAlignment="Center" Grid.Row="2"
Text="{Binding Path=Humidity,Mode=TwoWay}"></TextBox>
</Grid>
</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="*"></RowDefinition>
</Grid.RowDefinitions>
<Image Source="pack://SiteOfOrigin:,,,/images/Weather.jpg" />
<TextBlock Grid.Row="1" Margin="5"></TextBlock>
</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>
/// WeatherView.xaml 的交互逻辑
/// </summary>
public partial class WeatherView : UserControl
{
public WeatherView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new WeatherViewModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 包装视图模型 -- 天气版
/// </summary>
public class WeatherViewModel : PackageViewModelBase
{
public WeatherViewModel()
{
}
// ===================================================================================
// Property
// ===================================================================================
#region Temperature -- 温度
private string temperature;
/// <summary>
/// 温度
/// </summary>
public string Temperature
{
get { return temperature; }
set { temperature = value; this.RaisePropertyChanged(nameof(Temperature)); }
}
#endregion
#region Wind --
private string wind;
/// <summary>
/// 风
/// </summary>
public string Wind
{
get { return wind; }
set { wind = value; this.RaisePropertyChanged(nameof(Wind)); }
}
#endregion
#region Humidity -- 湿度
private string humidity;
/// <summary>
/// 湿度
/// </summary>
public string Humidity
{
get { return humidity; }
set { humidity = value; this.RaisePropertyChanged(nameof(Humidity)); }
}
#endregion
// ===================================================================================
// Command
// ===================================================================================
#region SendCommand -- 发送命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
{
}
#endregion
}
}
......@@ -51,6 +51,9 @@ namespace VIZ.TVP.Golf.Module
// 初始化球队信息
this.InitTeamInfos();
// 初始化球洞信息
this.InitHoleInfos();
return true;
}
......@@ -99,5 +102,23 @@ namespace VIZ.TVP.Golf.Module
ApplicationDomainEx.TeamInfos = list;
}
/// <summary>
/// 初始化球洞信息
/// </summary>
private void InitHoleInfos()
{
ObservableCollection<HoleInfoModel> list = new ObservableCollection<HoleInfoModel>();
foreach (HoleInfo entity in ApplicationDomainEx.LiteDBContext.HoleInfos.FindAll())
{
HoleInfoModel model = new HoleInfoModel();
model.Entity = entity;
model.UpdatePropertyFromEntity();
list.Add(model);
}
ApplicationDomainEx.HoleInfos = list;
}
}
}
\ No newline at end of file
......@@ -90,7 +90,11 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Page Include="Hole\View\HoleListView.xaml">
<Page Include="Package\BottomInformation\View\BottomInformationView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Information\Hole\View\HoleListView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
......@@ -98,34 +102,56 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Player\View\PlayerListView.xaml">
<Page Include="Information\Player\View\PlayerListView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Team\View\TeamListView.xaml">
<Page Include="Information\Team\View\TeamListView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Package\Weather\View\WeatherView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Information\Tournament\View\TournamentInfoView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Hole\ViewModel\HoleListViewModel.cs" />
<Compile Include="Hole\View\HoleListView.xaml.cs">
<Compile Include="Package\BottomInformation\ViewModel\BottomInformationViewModel.cs" />
<Compile Include="Package\BottomInformation\View\BottomInformationView.xaml.cs">
<DependentUpon>BottomInformationView.xaml</DependentUpon>
</Compile>
<Compile Include="Information\Hole\Controller\HoleListController.cs" />
<Compile Include="Information\Hole\Controller\IHoleListSupport.cs" />
<Compile Include="Information\Hole\ViewModel\HoleListViewModel.cs" />
<Compile Include="Information\Hole\View\HoleListView.xaml.cs">
<DependentUpon>HoleListView.xaml</DependentUpon>
</Compile>
<Compile Include="Information\Tournament\Controller\ITournamentInfoSupport.cs" />
<Compile Include="Information\Tournament\Controller\TournamentInfoController.cs" />
<Compile Include="Information\Tournament\ViewModel\TournamentInfoViewModel.cs" />
<Compile Include="Main\ViewModel\MainViewModel.cs" />
<Compile Include="Main\View\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
</Compile>
<Compile Include="Player\Controller\IPlayerListSupport.cs" />
<Compile Include="Player\Controller\PlayerListController.cs" />
<Compile Include="Player\View\PlayerListView.xaml.cs">
<Compile Include="Information\Player\Controller\IPlayerListSupport.cs" />
<Compile Include="Information\Player\Controller\PlayerListController.cs" />
<Compile Include="Information\Player\View\PlayerListView.xaml.cs">
<DependentUpon>PlayerListView.xaml</DependentUpon>
</Compile>
<Compile Include="Player\ViewModel\PlayerListViewModel.cs" />
<Compile Include="Information\Player\ViewModel\PlayerListViewModel.cs" />
<Compile Include="Package\PackageViewModelBase.cs" />
<Compile Include="Package\Weather\ViewModel\WeatherViewModel.cs" />
<Compile Include="Package\Weather\View\WeatherView.xaml.cs">
<DependentUpon>WeatherView.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
......@@ -140,12 +166,15 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Setup\Provider\Setup\AppSetup_InitLiteDB.cs" />
<Compile Include="Team\Controller\ITeamListSupport.cs" />
<Compile Include="Team\Controller\TeamListController.cs" />
<Compile Include="Team\ViewModel\TeamListViewModel.cs" />
<Compile Include="Team\View\TeamListView.xaml.cs">
<Compile Include="Information\Team\Controller\ITeamListSupport.cs" />
<Compile Include="Information\Team\Controller\TeamListController.cs" />
<Compile Include="Information\Team\ViewModel\TeamListViewModel.cs" />
<Compile Include="Information\Team\View\TeamListView.xaml.cs">
<DependentUpon>TeamListView.xaml</DependentUpon>
</Compile>
<Compile Include="Information\Tournament\View\TournamentInfoView.xaml.cs">
<DependentUpon>TournamentInfoView.xaml</DependentUpon>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......@@ -198,6 +227,10 @@
<Project>{455e59f6-e208-4dea-bb36-b419dee0133f}</Project>
<Name>VIZ.TVP.Golf.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Golf.Module.Resource\VIZ.TVP.Golf.Module.Resource.csproj">
<Project>{21f2a416-8d25-4ea9-8b49-23030d2e70cf}</Project>
<Name>VIZ.TVP.Golf.Module.Resource</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>
......
......@@ -12,6 +12,28 @@ namespace VIZ.TVP.Golf.Storage
/// </summary>
public class ClientConfig : IniConfigBase
{
/// <summary>
/// VIZ IP地址
/// </summary>
[Ini(Section = "Client", DefaultValue = "127.0.0.1", Type = typeof(string))]
public string CLIENT_VIZ_IP { get; set; }
/// <summary>
/// VIZ端口
/// </summary>
[Ini(Section = "Client", DefaultValue = "6100", Type = typeof(int))]
public string CLIENT_VIZ_PORT { get; set; }
/// <summary>
/// 备库 VIZ IP地址
/// </summary>
[Ini(Section = "Client", DefaultValue = "127.0.0.1", Type = typeof(string))]
public string CLIENT_VIZ_IP_STANDBY { get; set; }
/// <summary>
/// 备库 VIZ端口
/// </summary>
[Ini(Section = "Client", DefaultValue = "6100", Type = typeof(int))]
public string CLIENT_VIZ_PORT_STANDBY { get; set; }
}
}
......@@ -24,8 +24,8 @@ namespace VIZ.TVP.Golf.Storage
public int HoleID { get; set; }
/// <summary>
/// 名称
/// 照片
/// </summary>
public string Name { get; set; }
public string Picture { get; set; }
}
}
using LiteDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Golf.Storage
{
/// <summary>
/// 赛事信息
/// </summary>
public class TournamentInfo
{
/// <summary>
/// 编号
/// </summary>
[BsonId(autoId: true)]
public int ID { get; set; }
/// <summary>
/// 赛事ID
/// </summary>
public int TournamentID { get; set; }
/// <summary>
/// 赛事名称
/// </summary>
public string TournamentName { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime BeginTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime EndTime { get; set; }
}
}
......@@ -36,6 +36,7 @@ namespace VIZ.TVP.Golf.Storage
this.PlayerInfos = this.Database.GetCollection<PlayerInfo>();
this.RankingInfos = this.Database.GetCollection<RankingInfo>();
this.TeamInfos = this.Database.GetCollection<TeamInfo>();
this.TournamentInfos = this.Database.GetCollection<TournamentInfo>();
}
/// <summary>
......@@ -64,6 +65,11 @@ namespace VIZ.TVP.Golf.Storage
public ILiteCollection<TeamInfo> TeamInfos { get; private set; }
/// <summary>
/// 赛事信息
/// </summary>
public ILiteCollection<TournamentInfo> TournamentInfos { get; private set; }
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
......@@ -72,6 +78,7 @@ namespace VIZ.TVP.Golf.Storage
this.PlayerInfos = null;
this.RankingInfos = null;
this.TeamInfos = null;
this.TournamentInfos = null;
this.Database?.Dispose();
this.Database = null;
......
......@@ -75,6 +75,7 @@
<Compile Include="Enum\SexEnum.cs" />
<Compile Include="Ini\ClientConfig.cs" />
<Compile Include="LiteDB\Entity\HoleInfo.cs" />
<Compile Include="LiteDB\Entity\TournamentInfo.cs" />
<Compile Include="LiteDB\LiteDBContext.cs" />
<Compile Include="LiteDB\Entity\PlayerInfo.cs" />
<Compile Include="LiteDB\Entity\RankingInfo.cs" />
......
......@@ -6,8 +6,9 @@
xmlns:local="clr-namespace:VIZ.TVP.Golf"
xmlns:module="clr-namespace:VIZ.TVP.Golf.Module;assembly=VIZ.TVP.Golf.Module"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Title="MainWindow" Height="800" Width="1400">
Icon="logo.ico"
Title="高尔夫包装工具" Height="900" Width="1700">
<Grid>
<module:MainView Margin="20"></module:MainView>
<module:MainView Margin="10"></module:MainView>
</Grid>
</Window>
......@@ -54,6 +54,9 @@
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>logo.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<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>
......@@ -126,6 +129,9 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="config\config.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......@@ -176,6 +182,10 @@
<Project>{455e59f6-e208-4dea-bb36-b419dee0133f}</Project>
<Name>VIZ.TVP.Golf.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Golf.Module.Resource\VIZ.TVP.Golf.Module.Resource.csproj">
<Project>{21f2a416-8d25-4ea9-8b49-23030d2e70cf}</Project>
<Name>VIZ.TVP.Golf.Module.Resource</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.TVP.Golf.Module\VIZ.TVP.Golf.Module.csproj">
<Project>{f9f79f33-b05f-40ec-8099-ece3fb61446f}</Project>
<Name>VIZ.TVP.Golf.Module</Name>
......@@ -185,5 +195,18 @@
<Name>VIZ.TVP.Golf.Storage</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="logo.ico" />
</ItemGroup>
<ItemGroup>
<None Include="images\BottomInformation.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="images\Weather.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
; ============================================================
; === Application ===
; ============================================================
[Application]
; 是否是调试模式
APPLICATION_IS_DEBUG=false
; ============================================================
; === Client ===
; ============================================================
; VIZ IP地址
CLIENT_VIZ_IP=127.0.0.1
; VIZ端口
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
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