Commit 28be732c by liulongfei

添加版子

parent 96cb7990
...@@ -70,6 +70,22 @@ namespace VIZ.TVP.Golf.Domain ...@@ -70,6 +70,22 @@ namespace VIZ.TVP.Golf.Domain
public const string AfterMatchTeamRanking = "AfterMatchTeamRanking"; public const string AfterMatchTeamRanking = "AfterMatchTeamRanking";
/// <summary> /// <summary>
/// 短板球队排名
/// </summary>
public const string ShortTeamRanking = "ShortTeamRanking";
/// <summary>
/// 长版球队排名
/// </summary>
public const string LongTeamRankingView = "LongTeamRankingView";
/// <summary>
/// 赛后
/// </summary>
public const string AfterMatchGroupRanking = "AfterMatchGroupRanking";
/// <summary>
/// 人名条 /// 人名条
/// </summary> /// </summary>
public const string NameBarView = "NameBarView"; public const string NameBarView = "NameBarView";
......
...@@ -41,6 +41,20 @@ namespace VIZ.TVP.Golf.Domain ...@@ -41,6 +41,20 @@ namespace VIZ.TVP.Golf.Domain
#endregion #endregion
#region Position -- 排名
private string position;
/// <summary>
/// 排名
/// </summary>
public string Position
{
get { return position; }
set { position = value; this.RaisePropertyChanged(nameof(Position)); }
}
#endregion
#region Players -- 球员信息 #region Players -- 球员信息
private ObservableCollection<PlayerInfoModel> players = new ObservableCollection<PlayerInfoModel>(); private ObservableCollection<PlayerInfoModel> players = new ObservableCollection<PlayerInfoModel>();
......
...@@ -64,11 +64,21 @@ ...@@ -64,11 +64,21 @@
Content="分组洞信息版"></RadioButton> Content="分组洞信息版"></RadioButton>
<RadioButton x:Name="rb_BottomHoleInfoView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}" <RadioButton x:Name="rb_BottomHoleInfoView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="底部洞信息版"></RadioButton> Content="底部洞信息版"></RadioButton>
<!-- 队伍排名 -->
<Rectangle Height="1" Fill="#44000000" Margin="0,5,0,5"></Rectangle>
<RadioButton x:Name="rb_BeforeMatchTeamRankingView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}" <RadioButton x:Name="rb_BeforeMatchTeamRankingView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="赛前队伍排名"></RadioButton> Content="赛前队伍排名"></RadioButton>
<RadioButton x:Name="rb_AfterMatchTeamRankingView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}" <RadioButton x:Name="rb_AfterMatchTeamRankingView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="赛后队伍排名"></RadioButton> Content="赛后队伍排名"></RadioButton>
<RadioButton x:Name="rb_ShortTeamRankingView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="短版队伍排名"></RadioButton>
<RadioButton x:Name="rb_LongTeamRankingView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="长版队伍排名"></RadioButton>
<Rectangle Height="1" Fill="#44000000" Margin="0,5,0,5"></Rectangle>
<RadioButton x:Name="rb_AfterMatchGroupRankingView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="赛后分组排名"></RadioButton>
<Rectangle Height="1" Fill="#44000000" Margin="0,5,0,5"></Rectangle>
<RadioButton x:Name="rb_NameBarView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}" <RadioButton x:Name="rb_NameBarView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="人名条"></RadioButton> Content="人名条"></RadioButton>
<RadioButton x:Name="rb_NameBarBottomView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}" <RadioButton x:Name="rb_NameBarBottomView" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
...@@ -105,17 +115,18 @@ ...@@ -105,17 +115,18 @@
IsSelected="{Binding ElementName=rb_BeforeMatchTeamRankingView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl> IsSelected="{Binding ElementName=rb_BeforeMatchTeamRankingView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.AfterMatchTeamRanking}" ViewType="{x:Type local:AfterMatchTeamRankingView}" <fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.AfterMatchTeamRanking}" ViewType="{x:Type local:AfterMatchTeamRankingView}"
IsSelected="{Binding ElementName=rb_AfterMatchTeamRankingView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl> IsSelected="{Binding ElementName=rb_AfterMatchTeamRankingView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.ShortTeamRanking}" ViewType="{x:Type local:ShortTeamRankingView}"
IsSelected="{Binding ElementName=rb_ShortTeamRankingView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.LongTeamRankingView}" ViewType="{x:Type local:LongTeamRankingView}"
IsSelected="{Binding ElementName=rb_LongTeamRankingView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.AfterMatchGroupRanking}" ViewType="{x:Type local:AfterMatchGroupRankingView}"
IsSelected="{Binding ElementName=rb_AfterMatchGroupRankingView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.NameBarView}" ViewType="{x:Type local:NameBarView}" <fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.NameBarView}" ViewType="{x:Type local:NameBarView}"
IsSelected="{Binding ElementName=rb_NameBarView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl> IsSelected="{Binding ElementName=rb_NameBarView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.NameBarBottomView}" ViewType="{x:Type local:NameBarBottomView}" <fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.NameBarBottomView}" ViewType="{x:Type local:NameBarBottomView}"
IsSelected="{Binding ElementName=rb_NameBarBottomView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl> IsSelected="{Binding ElementName=rb_NameBarBottomView,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.CenterPlayerRanking}" ViewType="{x:Type local:CenterPlayerRankingView}"
IsSelected="{Binding ElementName=rb_CenterPlayerRanking,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.CenterTeamRanking}" ViewType="{x:Type local:CenterTeamRankingView}"
IsSelected="{Binding ElementName=rb_CenterTeamRanking,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
</fcommon:NavigationControl> </fcommon:NavigationControl>
</Border> </Border>
</Grid> </Grid>
......
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.Xml.Linq;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
using Xceed.Wpf.Toolkit;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 包装视图模型 -- 中间队伍排名版
/// </summary>
public class CenterTeamRankingViewModel : PackageViewModelBase
{
public CenterTeamRankingViewModel()
{
// 初始化命令
this.InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.LoadLocalDataCommand = new VCommand(this.LoadLocalData);
}
// ===================================================================================
// Property
// ===================================================================================
#region CurrentRound -- 当前轮次
private int currentRound;
/// <summary>
/// 当前轮次
/// </summary>
public int CurrentRound
{
get { return currentRound; }
set { currentRound = value; this.RaisePropertyChanged(nameof(CurrentRound)); }
}
#endregion
#region TotalHole -- 总洞数
private int totalHole;
/// <summary>
/// 总洞数
/// </summary>
public int TotalHole
{
get { return totalHole; }
set { totalHole = value; this.RaisePropertyChanged(nameof(TotalHole)); }
}
#endregion
#region TeamRankings -- 队伍排名
private ObservableCollection<TeamRealModel> teamRankings;
/// <summary>
/// 队伍排名
/// </summary>
public ObservableCollection<TeamRealModel> TeamRankings
{
get { return teamRankings; }
set { teamRankings = value; this.RaisePropertyChanged(nameof(TeamRankings)); }
}
#endregion
#region SelectedTeamRanking -- 当前选中的队伍
private TeamRealModel selectedTeamRanking;
/// <summary>
/// 当前选中的队伍
/// </summary>
public TeamRealModel SelectedTeamRanking
{
get { return selectedTeamRanking; }
set { selectedTeamRanking = value; this.RaisePropertyChanged(nameof(SelectedTeamRanking)); }
}
#endregion
// ===================================================================================
// Command
// ===================================================================================
#region SendCommand -- 发送命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
{
}
#endregion
#region LoadLocalDataCommand -- 加载本地数据命令
/// <summary>
/// 加载本地数据
/// </summary>
protected override void LoadLocalData()
{
}
#endregion
#region LoadRemoteDataCommand -- 加载远程数据命令
/// <summary>
/// 加载远程数据
/// </summary>
protected override void LoadRemoteData()
{
}
#endregion
}
}
...@@ -264,6 +264,9 @@ namespace VIZ.TVP.Golf.Module ...@@ -264,6 +264,9 @@ namespace VIZ.TVP.Golf.Module
} }
this.GroupHoleTempModels = groupHoleTempModels; this.GroupHoleTempModels = groupHoleTempModels;
// 统计
this.Summary();
} }
} }
} }
<UserControl x:Class="VIZ.TVP.Golf.Module.AfterMatchGroupRankingView"
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"
xmlns:resource="clr-namespace:VIZ.TVP.Golf.Module.Resource;assembly=VIZ.TVP.Golf.Module.Resource"
d:Background="White"
d:DataContext="{d:DesignInstance Type=local:AfterMatchGroupRankingViewModel}"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1700">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<resource:Round2RoundDetailConverter x:Key="Round2RoundDetailConverter"></resource:Round2RoundDetailConverter>
</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">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 轮次信息 -->
<GroupBox Padding="10">
<GroupBox.Header>
<TextBlock Text="轮次信息" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="轮次:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1"></TextBlock>
<StackPanel Grid.Column="1" Margin="10,0,10,0" HorizontalAlignment="Left" Orientation="Horizontal">
<ComboBox Height="30" Width="220" VerticalContentAlignment="Center"
SelectedValue="{Binding Path=SelectedRound,Mode=TwoWay}"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.Rounds}}"></ComboBox>
</StackPanel>
</Grid>
</GroupBox>
<!-- 排名 -->
<GroupBox Padding="10" Grid.Row="1">
<GroupBox.Header>
<TextBlock Text="排名" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Width="16" Height="16" Source="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png"
VerticalAlignment="Top" Margin="0,5,0,0"></Image>
<DataGrid Grid.Column="1" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="False"
ItemsSource="{Binding Path=GroupTempModels}">
<DataGrid.Columns>
<DataGridTextColumn Header="排名" Width="100" Binding="{Binding Path=Position}" IsReadOnly="True"></DataGridTextColumn>
<DataGridTextColumn Header="成员" Width="200" Binding="{Binding Path=PlayersDisplayName}"></DataGridTextColumn>
<DataGridTextColumn Header="总杆数" Width="100" Binding="{Binding Path=PlayersStrokes}"></DataGridTextColumn>
<DataGridComboBoxColumn x:Name="Logo" Header="Logo" Width="240"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.TeamLogos}}"
SelectedValueBinding="{Binding Path=TeamLogo}"></DataGridComboBoxColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</GroupBox>
</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="80"></RowDefinition>
</Grid.RowDefinitions>
<Image Source="pack://SiteOfOrigin:,,,/images/AfterMatchGroupRanking.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>
/// AfterMatchGroupRankingView.xaml 的交互逻辑
/// </summary>
public partial class AfterMatchGroupRankingView : UserControl
{
public AfterMatchGroupRankingView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new AfterMatchGroupRankingViewModel());
}
}
}
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 AfterMatchGroupRankingViewModel : GroupRankingViewModelBase
{
public AfterMatchGroupRankingViewModel()
{
}
// ===================================================================================
// Property
// ===================================================================================
// ===================================================================================
// Command
// ===================================================================================
// ===================================================================================
// Private Function
// ===================================================================================
}
}
\ No newline at end of file
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Linq; using System.Windows;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain; using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
using Xceed.Wpf.Toolkit;
namespace VIZ.TVP.Golf.Module namespace VIZ.TVP.Golf.Module
{ {
/// <summary> /// <summary>
/// 包装视图模型 -- 中间球员排名版 /// 分组排名视图模型基类
/// </summary> /// </summary>
public class CenterPlayerRankingViewModel : PackageViewModelBase public abstract class GroupRankingViewModelBase : PackageViewModelBase
{ {
public CenterPlayerRankingViewModel()
{
// 初始化命令
this.InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.LoadLocalDataCommand = new VCommand(this.LoadLocalData);
}
// =================================================================================== // ===================================================================================
// Property // Property
// =================================================================================== // ===================================================================================
#region CurrentRound -- 当前轮次 #region GroupTempModels -- 分组临时模型集合
private int currentRound;
/// <summary>
/// 当前轮次
/// </summary>
public int CurrentRound
{
get { return currentRound; }
set { currentRound = value; this.RaisePropertyChanged(nameof(CurrentRound)); }
}
#endregion private ObservableCollection<GroupTempModel> groupTempModels;
#region TotalHole -- 总洞数
private int totalHole;
/// <summary> /// <summary>
/// 总洞数 /// 分组临时模型集合
/// </summary> /// </summary>
public int TotalHole public ObservableCollection<GroupTempModel> GroupTempModels
{ {
get { return totalHole; } get { return groupTempModels; }
set { totalHole = value; this.RaisePropertyChanged(nameof(TotalHole)); } set { groupTempModels = value; this.RaisePropertyChanged(nameof(GroupTempModels)); }
} }
#endregion #endregion
#region PlayerRankings -- 球员排名 #region SelectedRound -- 选中的轮次
private ObservableCollection<PlayerRealModel> playerRankings; private int selectedRound;
/// <summary> /// <summary>
/// 球员排名 /// 选中的轮次信息
/// </summary> /// </summary>
public ObservableCollection<PlayerRealModel> PlayerRankings public int SelectedRound
{ {
get { return playerRankings; } get { return selectedRound; }
set { playerRankings = value; this.RaisePropertyChanged(nameof(PlayerRankings)); } set { selectedRound = value; this.RaisePropertyChanged(nameof(SelectedRound)); }
} }
#endregion #endregion
...@@ -82,10 +51,6 @@ namespace VIZ.TVP.Golf.Module ...@@ -82,10 +51,6 @@ namespace VIZ.TVP.Golf.Module
// Command // Command
// =================================================================================== // ===================================================================================
// ===================================================================================
// Command
// ===================================================================================
#region SendCommand -- 发送命令 #region SendCommand -- 发送命令
/// <summary> /// <summary>
...@@ -98,7 +63,6 @@ namespace VIZ.TVP.Golf.Module ...@@ -98,7 +63,6 @@ namespace VIZ.TVP.Golf.Module
#endregion #endregion
#region LoadLocalDataCommand -- 加载本地数据命令 #region LoadLocalDataCommand -- 加载本地数据命令
/// <summary> /// <summary>
...@@ -106,7 +70,19 @@ namespace VIZ.TVP.Golf.Module ...@@ -106,7 +70,19 @@ namespace VIZ.TVP.Golf.Module
/// </summary> /// </summary>
protected override void LoadLocalData() 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.UpdateGroupTempModels(list);
} }
#endregion #endregion
...@@ -118,9 +94,62 @@ namespace VIZ.TVP.Golf.Module ...@@ -118,9 +94,62 @@ namespace VIZ.TVP.Golf.Module
/// </summary> /// </summary>
protected override void LoadRemoteData() 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.UpdateGroupTempModels(list);
});
});
} }
#endregion #endregion
// ===================================================================================
// Private Function
// ===================================================================================
/// <summary>
/// 更新组临时模型
/// </summary>
/// <param name="list">球员真实模型</param>
protected virtual void UpdateGroupTempModels(List<PlayerRealModel> list)
{
ObservableCollection<GroupTempModel> groupTempModels = new ObservableCollection<GroupTempModel>();
var groups = ApplicationDomainEx.PlayerInfos.GroupBy(p => p.Group);
foreach (var group in groups)
{
foreach (var team_group in group.GroupBy(p => p.TeamID))
{
GroupTempModel temp_model = new GroupTempModel();
temp_model.Group = group.Key;
foreach (PlayerInfoModel player in team_group)
{
temp_model.Players.Add(player);
}
temp_model.PlayersDisplayName = string.Join(" / ", temp_model.Players.Select(p => p.Name));
List<int> player_ids = temp_model.Players.Select(p => p.PlayerID).ToList();
temp_model.PlayersStrokes = list.Where(p => player_ids.Contains(p.PlayerID)).Sum(p => p.Strokes).ToString();
temp_model.TeamLogo = ApplicationDomainEx.TeamInfos.FirstOrDefault(p => p.TeamID == team_group.Key)?.Logo;
groupTempModels.Add(temp_model);
}
}
this.GroupTempModels = groupTempModels;
}
} }
} }
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<Image Width="16" Height="16" Source="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png" <Image Width="16" Height="16" Source="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png"
VerticalAlignment="Top" Margin="0,5,0,0"></Image> VerticalAlignment="Top" Margin="0,5,0,0"></Image>
<DataGrid Grid.Column="1" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="False" <DataGrid Grid.Column="1" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="False"
ItemsSource="{Binding Path=GroupTempModels}"> ItemsSource="{Binding Path=TeamTempModels}">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="排名" Width="100" Binding="{Binding Path=Position}" IsReadOnly="True"></DataGridTextColumn> <DataGridTextColumn Header="排名" Width="100" Binding="{Binding Path=Position}" IsReadOnly="True"></DataGridTextColumn>
<DataGridTextColumn Header="队伍名称" Width="100" Binding="{Binding Path=Name}"></DataGridTextColumn> <DataGridTextColumn Header="队伍名称" Width="100" Binding="{Binding Path=Name}"></DataGridTextColumn>
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<Image Width="16" Height="16" Source="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png" <Image Width="16" Height="16" Source="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png"
VerticalAlignment="Top" Margin="0,5,0,0"></Image> VerticalAlignment="Top" Margin="0,5,0,0"></Image>
<DataGrid Grid.Column="1" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="False" <DataGrid Grid.Column="1" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="False"
ItemsSource="{Binding Path=GroupTempModels}"> ItemsSource="{Binding Path=TeamTempModels}">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="排名" Width="100" Binding="{Binding Path=Position}" IsReadOnly="True"></DataGridTextColumn> <DataGridTextColumn Header="排名" Width="100" Binding="{Binding Path=Position}" IsReadOnly="True"></DataGridTextColumn>
<DataGridTextColumn Header="队伍名称" Width="100" Binding="{Binding Path=Name}"></DataGridTextColumn> <DataGridTextColumn Header="队伍名称" Width="100" Binding="{Binding Path=Name}"></DataGridTextColumn>
......
...@@ -17,15 +17,15 @@ using VIZ.Framework.Core; ...@@ -17,15 +17,15 @@ using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Module namespace VIZ.TVP.Golf.Module
{ {
/// <summary> /// <summary>
/// CenterPlayerRankingView.xaml 的交互逻辑 /// ShortTeamRankingView.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class CenterPlayerRankingView : UserControl public partial class LongTeamRankingView : UserControl
{ {
public CenterPlayerRankingView() public LongTeamRankingView()
{ {
InitializeComponent(); InitializeComponent();
WPFHelper.BindingViewModel(this, new CenterPlayerRankingViewModel()); WPFHelper.BindingViewModel(this, new LongTeamRankingViewModel());
} }
} }
} }
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 LongTeamRankingViewModel : TeamRankingViewModelBase
{
public LongTeamRankingViewModel()
{
}
// ===================================================================================
// Property
// ===================================================================================
// ===================================================================================
// Command
// ===================================================================================
// ===================================================================================
// Private Function
// ===================================================================================
}
}
...@@ -17,15 +17,15 @@ using VIZ.Framework.Core; ...@@ -17,15 +17,15 @@ using VIZ.Framework.Core;
namespace VIZ.TVP.Golf.Module namespace VIZ.TVP.Golf.Module
{ {
/// <summary> /// <summary>
/// CenterTeamRankingView.xaml 的交互逻辑 /// ShortTeamRankingView.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class CenterTeamRankingView : UserControl public partial class ShortTeamRankingView : UserControl
{ {
public CenterTeamRankingView() public ShortTeamRankingView()
{ {
InitializeComponent(); InitializeComponent();
WPFHelper.BindingViewModel(this, new CenterTeamRankingViewModel()); WPFHelper.BindingViewModel(this, new ShortTeamRankingViewModel());
} }
} }
} }
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 ShortTeamRankingViewModel : TeamRankingViewModelBase
{
public ShortTeamRankingViewModel()
{
}
// ===================================================================================
// Property
// ===================================================================================
// ===================================================================================
// Command
// ===================================================================================
// ===================================================================================
// Private Function
// ===================================================================================
/// <summary>
/// 更新组临时模型
/// </summary>
/// <param name="list">球员真实模型</param>
protected void UpdateGroupTempModels(List<PlayerRealModel> list)
{
ObservableCollection<TeamTempModel> teamTempModels = new ObservableCollection<TeamTempModel>();
List<TeamTempModel> temp_list = new List<TeamTempModel>();
foreach (TeamInfoModel info_model in ApplicationDomainEx.TeamInfos)
{
TeamTempModel temp_model = new TeamTempModel();
temp_model.FromInfoModel(info_model);
var real_players = list.Where(p => p.TeamInfoModel != null && p.TeamInfoModel.TeamID == temp_model.TeamID).ToList();
temp_model.TotalStrokes = real_players.Sum(p => p.Strokes).ToString();
temp_list.Add(temp_model);
}
temp_list = temp_list.Take(5).ToList();
foreach (TeamTempModel temp in temp_list)
{
teamTempModels.Add(temp);
}
this.TeamTempModels = teamTempModels;
}
}
}
...@@ -34,16 +34,16 @@ namespace VIZ.TVP.Golf.Module ...@@ -34,16 +34,16 @@ namespace VIZ.TVP.Golf.Module
#endregion #endregion
#region GroupTempModels -- 分组临时模型集合 #region TeamTempModels -- 队伍临时模型集合
private ObservableCollection<TeamTempModel> groupTempModels; private ObservableCollection<TeamTempModel> teamTempModels;
/// <summary> /// <summary>
/// 分组临时模型集合 /// 分组临时模型集合
/// </summary> /// </summary>
public ObservableCollection<TeamTempModel> GroupTempModels public ObservableCollection<TeamTempModel> TeamTempModels
{ {
get { return groupTempModels; } get { return teamTempModels; }
set { groupTempModels = value; this.RaisePropertyChanged(nameof(GroupTempModels)); } set { teamTempModels = value; this.RaisePropertyChanged(nameof(TeamTempModels)); }
} }
#endregion #endregion
...@@ -83,7 +83,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -83,7 +83,7 @@ namespace VIZ.TVP.Golf.Module
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName); List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName);
this.UpdateGroupTempModels(list); this.UpdateTeamTempModels(list);
} }
#endregion #endregion
...@@ -110,7 +110,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -110,7 +110,7 @@ namespace VIZ.TVP.Golf.Module
{ {
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(fileName); List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(fileName);
this.UpdateGroupTempModels(list); this.UpdateTeamTempModels(list);
}); });
}); });
} }
...@@ -122,12 +122,12 @@ namespace VIZ.TVP.Golf.Module ...@@ -122,12 +122,12 @@ namespace VIZ.TVP.Golf.Module
// =================================================================================== // ===================================================================================
/// <summary> /// <summary>
/// 更新临时模型 /// 更新队伍临时模型
/// </summary> /// </summary>
/// <param name="list">球员真实模型</param> /// <param name="list">球员真实模型</param>
private void UpdateGroupTempModels(List<PlayerRealModel> list) protected virtual void UpdateTeamTempModels(List<PlayerRealModel> list)
{ {
ObservableCollection<TeamTempModel> groupTempModels = new ObservableCollection<TeamTempModel>(); ObservableCollection<TeamTempModel> teamTempModels = new ObservableCollection<TeamTempModel>();
foreach (TeamInfoModel info_model in ApplicationDomainEx.TeamInfos) foreach (TeamInfoModel info_model in ApplicationDomainEx.TeamInfos)
{ {
...@@ -137,10 +137,10 @@ namespace VIZ.TVP.Golf.Module ...@@ -137,10 +137,10 @@ namespace VIZ.TVP.Golf.Module
var real_players = list.Where(p => p.TeamInfoModel != null && p.TeamInfoModel.TeamID == temp_model.TeamID).ToList(); var real_players = list.Where(p => p.TeamInfoModel != null && p.TeamInfoModel.TeamID == temp_model.TeamID).ToList();
temp_model.TotalStrokes = real_players.Sum(p => p.Strokes).ToString(); temp_model.TotalStrokes = real_players.Sum(p => p.Strokes).ToString();
groupTempModels.Add(temp_model); teamTempModels.Add(temp_model);
} }
this.GroupTempModels = groupTempModels; this.TeamTempModels = teamTempModels;
} }
} }
} }
\ No newline at end of file
...@@ -93,7 +93,19 @@ ...@@ -93,7 +93,19 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Page Include="Package\AfterMatchTeamRanking\View\AfterMatchTeamRankingView.xaml"> <Page Include="Package\GroupRanking\AfterMatchGroupRanking\View\AfterMatchGroupRankingView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Package\TeamRanking\LongTeamRanking\View\LongTeamRankingView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Package\TeamRanking\ShortTeamRanking\View\ShortTeamRankingView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Package\TeamRanking\AfterMatchTeamRanking\View\AfterMatchTeamRankingView.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
...@@ -157,7 +169,7 @@ ...@@ -157,7 +169,7 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Package\BeforeMatchTeamRanking\View\BeforeMatchTeamRankingView.xaml"> <Page Include="Package\TeamRanking\BeforeMatchTeamRanking\View\BeforeMatchTeamRankingView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
...@@ -177,14 +189,6 @@ ...@@ -177,14 +189,6 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Package\CenterPlayerRanking\View\CenterPlayerRankingView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Package\CenterTeamRanking\View\CenterTeamRankingView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Generic.xaml"> <Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
...@@ -203,8 +207,21 @@ ...@@ -203,8 +207,21 @@
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Package\AfterMatchTeamRanking\ViewModel\AfterMatchTeamRankingViewModel.cs" /> <Compile Include="Package\GroupRanking\AfterMatchGroupRanking\View\AfterMatchGroupRankingView.xaml.cs">
<Compile Include="Package\AfterMatchTeamRanking\View\AfterMatchTeamRankingView.xaml.cs"> <DependentUpon>AfterMatchGroupRankingView.xaml</DependentUpon>
</Compile>
<Compile Include="Package\GroupRanking\AfterMatchGroupRanking\ViewModel\AfterMatchGroupRankingViewModel.cs" />
<Compile Include="Package\GroupRanking\GroupRankingViewModelBase.cs" />
<Compile Include="Package\TeamRanking\LongTeamRanking\ViewModel\LongTeamRankingViewModel.cs" />
<Compile Include="Package\TeamRanking\LongTeamRanking\View\LongTeamRankingView.xaml.cs">
<DependentUpon>LongTeamRankingView.xaml</DependentUpon>
</Compile>
<Compile Include="Package\TeamRanking\ShortTeamRanking\ViewModel\ShortTeamRankingViewModel.cs" />
<Compile Include="Package\TeamRanking\ShortTeamRanking\View\ShortTeamRankingView.xaml.cs">
<DependentUpon>ShortTeamRankingView.xaml</DependentUpon>
</Compile>
<Compile Include="Package\TeamRanking\AfterMatchTeamRanking\ViewModel\AfterMatchTeamRankingViewModel.cs" />
<Compile Include="Package\TeamRanking\AfterMatchTeamRanking\View\AfterMatchTeamRankingView.xaml.cs">
<DependentUpon>AfterMatchTeamRankingView.xaml</DependentUpon> <DependentUpon>AfterMatchTeamRankingView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Package\GroupHoleInfo\ViewModel\GroupHoleInfoViewModel.cs" /> <Compile Include="Package\GroupHoleInfo\ViewModel\GroupHoleInfoViewModel.cs" />
...@@ -227,7 +244,7 @@ ...@@ -227,7 +244,7 @@
<Compile Include="Package\NameBar\View\NameBarBottomView.xaml.cs"> <Compile Include="Package\NameBar\View\NameBarBottomView.xaml.cs">
<DependentUpon>NameBarBottomView.xaml</DependentUpon> <DependentUpon>NameBarBottomView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Package\TeamRankingViewModelBase.cs" /> <Compile Include="Package\TeamRanking\TeamRankingViewModelBase.cs" />
<Compile Include="Widgets\Detail\DetailPanel.xaml.cs"> <Compile Include="Widgets\Detail\DetailPanel.xaml.cs">
<DependentUpon>DetailPanel.xaml</DependentUpon> <DependentUpon>DetailPanel.xaml</DependentUpon>
</Compile> </Compile>
...@@ -264,8 +281,8 @@ ...@@ -264,8 +281,8 @@
<Compile Include="Package\BottomHoleInfo\View\BottomHoleInfoView.xaml.cs"> <Compile Include="Package\BottomHoleInfo\View\BottomHoleInfoView.xaml.cs">
<DependentUpon>BottomHoleInfoView.xaml</DependentUpon> <DependentUpon>BottomHoleInfoView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Package\BeforeMatchTeamRanking\ViewModel\BeforeMatchTeamRankingViewModel.cs" /> <Compile Include="Package\TeamRanking\BeforeMatchTeamRanking\ViewModel\BeforeMatchTeamRankingViewModel.cs" />
<Compile Include="Package\BeforeMatchTeamRanking\View\BeforeMatchTeamRankingView.xaml.cs"> <Compile Include="Package\TeamRanking\BeforeMatchTeamRanking\View\BeforeMatchTeamRankingView.xaml.cs">
<DependentUpon>BeforeMatchTeamRankingView.xaml</DependentUpon> <DependentUpon>BeforeMatchTeamRankingView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Information\Hole\Controller\HoleListController.cs" /> <Compile Include="Information\Hole\Controller\HoleListController.cs" />
...@@ -284,14 +301,6 @@ ...@@ -284,14 +301,6 @@
<DependentUpon>PlayerListView.xaml</DependentUpon> <DependentUpon>PlayerListView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Information\Player\ViewModel\PlayerListViewModel.cs" /> <Compile Include="Information\Player\ViewModel\PlayerListViewModel.cs" />
<Compile Include="Package\CenterPlayerRanking\ViewModel\CenterPlayerRankingViewModel.cs" />
<Compile Include="Package\CenterPlayerRanking\View\CenterPlayerRankingView.xaml.cs">
<DependentUpon>CenterPlayerRankingView.xaml</DependentUpon>
</Compile>
<Compile Include="Package\CenterTeamRanking\ViewModel\CenterTeamRankingViewModel.cs" />
<Compile Include="Package\CenterTeamRanking\View\CenterTeamRankingView.xaml.cs">
<DependentUpon>CenterTeamRankingView.xaml</DependentUpon>
</Compile>
<Compile Include="Package\PackageViewModelBase.cs" /> <Compile Include="Package\PackageViewModelBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
......
...@@ -367,5 +367,20 @@ ...@@ -367,5 +367,20 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="images\LongTeamRanking.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="images\BeforeMatchGroupRanking.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="images\AfterMatchGroupRanking.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </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