Commit 31a82455 by liulongfei

洞信息版完善

parent d54a3b81
......@@ -40,6 +40,11 @@ namespace VIZ.TVP.Golf.Domain
// ====================================================================================
/// <summary>
/// 人名条
/// </summary>
public const string NameBar = "NameBar";
/// <summary>
/// 底部洞信息版
/// </summary>
public const string BottomHoleInfoView = "BottomHoleInfoView";
......
......@@ -56,6 +56,8 @@
<Border Background="#ff4d449f" Height="40">
<TextBlock Text="包装" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"></TextBlock>
</Border>
<RadioButton x:Name="rb_NameBarView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="人名条"></RadioButton>
<RadioButton x:Name="rb_BottomHoleInfoView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="底部洞信息版"></RadioButton>
<RadioButton x:Name="rb_BottomInformationView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
......@@ -80,6 +82,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.NameBar}" ViewType="{x:Type local:NameBarView}"
IsSelected="{Binding ElementName=rb_NameBarView,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}"
......
......@@ -38,7 +38,7 @@
<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>
Content="刷新实数据" Command="{Binding Path=LoadRemoteDataCommand}"></fcommon:IconButton>
</StackPanel>
</Border>
<!-- 版子信息 -->
......
......@@ -20,32 +20,13 @@ namespace VIZ.TVP.Golf.Module
{
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
// ===================================================================================
......@@ -136,24 +117,6 @@ namespace VIZ.TVP.Golf.Module
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 -- 加载远程数据命令
......
<UserControl x:Class="VIZ.TVP.Golf.Module.NameBarView"
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:NameBarViewModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="1500">
<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/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">
<local:GroupPickerPanel DataContext="{Binding GroupPickerPanelModel}" VerticalAlignment="Top"></local:GroupPickerPanel>
</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/NameBar1.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>
/// NameBarView.xaml 的交互逻辑
/// </summary>
public partial class NameBarView : UserControl
{
public NameBarView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new NameBarViewModel());
}
}
}
using System;
using System.Collections.Generic;
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 NameBarViewModel : PackageViewModelBase
{
public NameBarViewModel()
{
}
// ===================================================================================
// Property
// ===================================================================================
#region GroupPickerPanelModel -- 组选择面板视图模型
private GroupPickerPanelModel groupPickerPanelModel = new GroupPickerPanelModel();
/// <summary>
/// 组选择面板视图模型
/// </summary>
public GroupPickerPanelModel GroupPickerPanelModel
{
get { return groupPickerPanelModel; }
set { groupPickerPanelModel = value; this.RaisePropertyChanged(nameof(GroupPickerPanelModel)); }
}
#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);
this.UpdatePlayerTempModel(this.GroupPickerPanelModel?.Player1, list);
this.UpdatePlayerTempModel(this.GroupPickerPanelModel?.Player2, list);
}
#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);
this.UpdatePlayerTempModel(this.GroupPickerPanelModel?.Player1, list);
this.UpdatePlayerTempModel(this.GroupPickerPanelModel?.Player2, list);
});
});
}
#endregion
}
}
......@@ -7,6 +7,8 @@ using System.Threading.Tasks;
using System.Windows.Media;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Service;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Module
{
......@@ -27,6 +29,20 @@ namespace VIZ.TVP.Golf.Module
this.LoadRemoteDataCommand = new VCommand(this.LoadRemoteDataShell);
}
/// <summary>
/// 赛事信息接口
/// </summary>
protected readonly static string INTERFACE_TOURNAMENT = ApplicationDomainEx.IniStorage.GetValue<InterfaceConfig, string>(p => p.INTERFACE_TOURNAMENT);
// ===================================================================================
// Field
// ===================================================================================
/// <summary>
/// 实时数据服务
/// </summary>
protected IRealDataService realDataService = new RealDataService();
// ===================================================================================
// Property
// ===================================================================================
......@@ -112,5 +128,27 @@ namespace VIZ.TVP.Golf.Module
protected abstract void LoadRemoteData();
#endregion
// ===================================================================================
// Action
// ===================================================================================
/// <summary>
/// 更新球员临时数据
/// </summary>
/// <param name="tempModel">临时模型</param>
/// <param name="realModels">实时模型集合</param>
protected 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;
}
}
}
}
......@@ -93,6 +93,10 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Page Include="Package\NameBar\View\NameBarView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Widgets\RealData\RealDataWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -159,6 +163,10 @@
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Package\NameBar\ViewModel\NameBarViewModel.cs" />
<Compile Include="Package\NameBar\View\NameBarView.xaml.cs">
<DependentUpon>NameBarView.xaml</DependentUpon>
</Compile>
<Compile Include="Setup\Provider\Setup\AppSetup_ClearLocalData.cs" />
<Compile Include="Widgets\RealData\RealDataWindow.xaml.cs">
<DependentUpon>RealDataWindow.xaml</DependentUpon>
......
......@@ -319,5 +319,10 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="images\NameBar1.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ 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