Commit 680d247f by liulongfei

分组信息版子

parent 7632bd5c
...@@ -55,6 +55,20 @@ namespace VIZ.TVP.Golf.Domain ...@@ -55,6 +55,20 @@ namespace VIZ.TVP.Golf.Domain
#endregion #endregion
#region PositionValue -- 排名值
private int? positionValue;
/// <summary>
/// 排名值
/// </summary>
public int? PositionValue
{
get { return positionValue; }
set { positionValue = value; this.RaisePropertyChanged(nameof(PositionValue)); }
}
#endregion
#region Player1 -- 球员1 #region Player1 -- 球员1
private PlayerInfoModel player1; private PlayerInfoModel player1;
......
...@@ -82,6 +82,20 @@ namespace VIZ.TVP.Golf.Domain ...@@ -82,6 +82,20 @@ namespace VIZ.TVP.Golf.Domain
#endregion #endregion
#region PositionValue -- 排名值
private int positionValue;
/// <summary>
/// 排名值
/// </summary>
public int PositionValue
{
get { return positionValue; }
set { positionValue = value; this.RaisePropertyChanged(nameof(PositionValue)); }
}
#endregion
#region TotalScoreValue -- 总得分值 #region TotalScoreValue -- 总得分值
private int? totalScoreValue; private int? totalScoreValue;
......
...@@ -87,9 +87,8 @@ ...@@ -87,9 +87,8 @@
<DataGridComboBoxColumn Header="性别" Width="60" <DataGridComboBoxColumn Header="性别" Width="60"
SelectedItemBinding="{Binding Path=Sex,Mode=TwoWay,Converter={StaticResource Enum2EnumDescriptionConverter}}" SelectedItemBinding="{Binding Path=Sex,Mode=TwoWay,Converter={StaticResource Enum2EnumDescriptionConverter}}"
ItemsSource="{Binding Source={x:Static Member=storage:StaticEnumInfos.SexEnumDescriptions}}"></DataGridComboBoxColumn> ItemsSource="{Binding Source={x:Static Member=storage:StaticEnumInfos.SexEnumDescriptions}}"></DataGridComboBoxColumn>
<DataGridComboBoxColumn Header="照片" Width="200" <DataGridTextColumn Header="照片" Width="200"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.PlayerPictures}}" Binding="{Binding Path=HalfPicture}"></DataGridTextColumn>
SelectedValueBinding="{Binding Path=HalfPicture}"></DataGridComboBoxColumn>
<DataGridComboBoxColumn Header="队伍" Width="200" DisplayMemberPath="Name" CanUserSort="True" <DataGridComboBoxColumn Header="队伍" Width="200" DisplayMemberPath="Name" CanUserSort="True"
ItemsSource="{Binding Source={x:Static domain:ApplicationDomainEx.TeamInfos}}" ItemsSource="{Binding Source={x:Static domain:ApplicationDomainEx.TeamInfos}}"
SelectedValueBinding="{Binding Path=TeamInfoModel}"></DataGridComboBoxColumn> SelectedValueBinding="{Binding Path=TeamInfoModel}"></DataGridComboBoxColumn>
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<GroupBox.Header> <GroupBox.Header>
<TextBlock Text="分组冠军" FontSize="18" FontWeight="Bold"></TextBlock> <TextBlock Text="分组冠军" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header> </GroupBox.Header>
<local:GroupPickerPanelNoPlayer DataContext="{Binding Path=GroupPickerPanelModel}"></local:GroupPickerPanelNoPlayer> <local:GroupPickerPanelNoPlayer DataContext="{Binding Path=GroupPickerPanelModel}" IsShowScore="False"></local:GroupPickerPanelNoPlayer>
</GroupBox> </GroupBox>
</Grid> </Grid>
</Border> </Border>
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5"> <Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="220"></RowDefinition> <RowDefinition Height="260"></RowDefinition>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="80"></RowDefinition> <RowDefinition Height="80"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
......
...@@ -143,9 +143,9 @@ namespace VIZ.TVP.Golf.Module ...@@ -143,9 +143,9 @@ namespace VIZ.TVP.Golf.Module
Dictionary<string, IVizControlObjctsValue> dic = new Dictionary<string, IVizControlObjctsValue>(); Dictionary<string, IVizControlObjctsValue> dic = new Dictionary<string, IVizControlObjctsValue>();
// 队伍图标 // 队伍图标
dic["1"] = new VizControlObjectsStringValue(this.realDataService.GetImageName(this.GroupPickerPanelModel.SelectedGroupInfo.TeamLogo)); dic["1"] = new VizControlObjectsStringValue(this.resourceService.GetImageName(this.GroupPickerPanelModel.SelectedGroupInfo.TeamLogo));
// 得分 // 分组
dic["NUMBER"] = new VizControlObjectsStringValue(this.GroupPickerPanelModel.PlayersScore); dic["NUMBER"] = new VizControlObjectsStringValue(this.GroupPickerPanelModel.SelectedGroupInfo.Group);
// 队员 // 队员
dic["PLAYERNAME"] = new VizControlObjectsStringValue(this.GroupPickerPanelModel.PlayersDisplayName); dic["PLAYERNAME"] = new VizControlObjectsStringValue(this.GroupPickerPanelModel.PlayersDisplayName);
// 得分 // 得分
...@@ -191,6 +191,9 @@ namespace VIZ.TVP.Golf.Module ...@@ -191,6 +191,9 @@ namespace VIZ.TVP.Golf.Module
item["PAR"] = hole.Par.ToString(); item["PAR"] = hole.Par.ToString();
// 总杆数 // 总杆数
item["SCORE"] = hole.TotalStrokes; item["SCORE"] = hole.TotalStrokes;
// 图标
int.TryParse(hole.TotalScore, out int score);
item["DBAN"] = this.resourceService.GetToParBgIconValue(score);
} }
md_itms.Add(item); md_itms.Add(item);
...@@ -218,7 +221,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -218,7 +221,7 @@ namespace VIZ.TVP.Golf.Module
if (!vm.IsEnter) if (!vm.IsEnter)
return; return;
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName);
this.UpdateGroupHoleTempModels(list); this.UpdateGroupHoleTempModels(list);
} }
...@@ -234,7 +237,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -234,7 +237,7 @@ namespace VIZ.TVP.Golf.Module
{ {
Task.Run(() => Task.Run(() =>
{ {
string fileName = this.realDataService.DownLoadData(INTERFACE_TOURNAMENT); string fileName = this.fileDataService.DownLoadData(INTERFACE_TOURNAMENT);
if (string.IsNullOrWhiteSpace(fileName)) if (string.IsNullOrWhiteSpace(fileName))
{ {
...@@ -245,7 +248,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -245,7 +248,7 @@ namespace VIZ.TVP.Golf.Module
WPFHelper.BeginInvoke(() => WPFHelper.BeginInvoke(() =>
{ {
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(fileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(fileName);
this.UpdateGroupHoleTempModels(list); this.UpdateGroupHoleTempModels(list);
}); });
...@@ -309,7 +312,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -309,7 +312,7 @@ namespace VIZ.TVP.Golf.Module
PlayerRealModel player1 = list.FirstOrDefault(p => this.GroupPickerPanelModel.SelectedGroupInfo.Player1.PlayerID == p.PlayerID); PlayerRealModel player1 = list.FirstOrDefault(p => this.GroupPickerPanelModel.SelectedGroupInfo.Player1.PlayerID == p.PlayerID);
PlayerRealModel player2 = list.FirstOrDefault(p => this.GroupPickerPanelModel.SelectedGroupInfo.Player2.PlayerID == p.PlayerID); PlayerRealModel player2 = list.FirstOrDefault(p => this.GroupPickerPanelModel.SelectedGroupInfo.Player2.PlayerID == p.PlayerID);
var dic = this.realDataService.GetGroupHoleStatisticsDataDic(this.GroupPickerPanelModel.SelectedGroupInfo.Group, player1, player2, this.SelectedRound); var dic = this.realDataService.GetGroupHoleStatisticsDataDic(this.GroupPickerPanelModel.SelectedGroupInfo.Group, player1, player2, 2);
foreach (HoleInfoModel holeInfo in ApplicationDomainEx.HoleInfos) foreach (HoleInfoModel holeInfo in ApplicationDomainEx.HoleInfos)
{ {
...@@ -321,7 +324,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -321,7 +324,7 @@ namespace VIZ.TVP.Golf.Module
continue; continue;
model.TotalStrokes = data.Strokes.ToString(); model.TotalStrokes = data.Strokes.ToString();
model.TotalScore = this.realDataService.GetScoreString(data.Score); model.TotalScore = this.resourceService.GetScoreString(data.Score);
groupHoleTempModels.Add(model); groupHoleTempModels.Add(model);
} }
...@@ -332,7 +335,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -332,7 +335,7 @@ namespace VIZ.TVP.Golf.Module
this.Summary(); this.Summary();
// 更新其他信息 // 更新其他信息
this.GroupPickerPanelModel.UpdatePlayersScore(list, this.SelectedRound); this.GroupPickerPanelModel.UpdatePlayersScore(list);
} }
} }
} }
...@@ -46,8 +46,8 @@ ...@@ -46,8 +46,8 @@
<Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5"> <Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="100"></RowDefinition> <RowDefinition Height="80"></RowDefinition>
<RowDefinition Height="220"></RowDefinition> <RowDefinition Height="260"></RowDefinition>
<RowDefinition Height="120"></RowDefinition> <RowDefinition Height="120"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 洞号 --> <!-- 洞号 -->
......
...@@ -46,35 +46,12 @@ ...@@ -46,35 +46,12 @@
<Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5"> <Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="90"></RowDefinition>
<RowDefinition Height="80"></RowDefinition> <RowDefinition Height="80"></RowDefinition>
<RowDefinition Height="220"></RowDefinition> <RowDefinition Height="260"></RowDefinition>
<RowDefinition Height="220"></RowDefinition> <RowDefinition Height="260"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 轮次与洞号 -->
<GroupBox Padding="10" Grid.Row="0">
<GroupBox.Header>
<TextBlock Text="轮次与洞号" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<!-- 轮次 -->
<TextBlock Text="轮次:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0"></TextBlock>
<StackPanel Grid.Column="1" Margin="5,0,10,0" HorizontalAlignment="Left" Orientation="Horizontal">
<ComboBox Height="30" Width="240" 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 Padding="10" Grid.Row="0">
<GroupBox.Header> <GroupBox.Header>
<TextBlock Text="预设" FontSize="18" FontWeight="Bold"></TextBlock> <TextBlock Text="预设" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header> </GroupBox.Header>
...@@ -98,18 +75,18 @@ ...@@ -98,18 +75,18 @@
</Grid> </Grid>
</GroupBox> </GroupBox>
<!-- 分组1 --> <!-- 分组1 -->
<GroupBox Grid.Row="2" Padding="10"> <GroupBox Grid.Row="1" Padding="10">
<GroupBox.Header> <GroupBox.Header>
<TextBlock Text="分组1" FontSize="18" FontWeight="Bold"></TextBlock> <TextBlock Text="分组1" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header> </GroupBox.Header>
<local:GroupPickerPanelNoPlayer DataContext="{Binding GroupPickerPanelModel1}"></local:GroupPickerPanelNoPlayer> <local:GroupPickerPanelNoPlayer DataContext="{Binding GroupPickerPanelModel1}" IsShowPosition="True"></local:GroupPickerPanelNoPlayer>
</GroupBox> </GroupBox>
<!-- 分组2 --> <!-- 分组2 -->
<GroupBox Grid.Row="3" Padding="10"> <GroupBox Grid.Row="2" Padding="10">
<GroupBox.Header> <GroupBox.Header>
<TextBlock Text="分组2" FontSize="18" FontWeight="Bold"></TextBlock> <TextBlock Text="分组2" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header> </GroupBox.Header>
<local:GroupPickerPanelNoPlayer DataContext="{Binding GroupPickerPanelModel2}"></local:GroupPickerPanelNoPlayer> <local:GroupPickerPanelNoPlayer DataContext="{Binding GroupPickerPanelModel2}" IsShowPosition="True"></local:GroupPickerPanelNoPlayer>
</GroupBox> </GroupBox>
</Grid> </Grid>
</Border> </Border>
...@@ -119,14 +96,14 @@ ...@@ -119,14 +96,14 @@
<StackPanel> <StackPanel>
<GroupBox Padding="10"> <GroupBox Padding="10">
<GroupBox.Header> <GroupBox.Header>
<TextBlock Text="组队版子" FontSize="18" FontWeight="Bold"></TextBlock> <TextBlock Text="分组信息" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header> </GroupBox.Header>
<StackPanel> <StackPanel>
<Image Source="pack://SiteOfOrigin:,,,/images/team_group_info.jpg" Height="300" /> <Image Source="pack://SiteOfOrigin:,,,/images/team_group_info.jpg" Height="300" />
<StackPanel Orientation="Horizontal" Margin="0,10,0,10"> <StackPanel Orientation="Horizontal" Margin="0,10,0,10">
<fcommon:IconButton Style="{StaticResource IconButton_Red}" Margin="10,0,0,0" <fcommon:IconButton Style="{StaticResource IconButton_Red}" Margin="10,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/up_16x16.png" Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/up_16x16.png"
Content="上组队版子" Content="上版子"
Command="{Binding StartCommand}"></fcommon:IconButton> Command="{Binding StartCommand}"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Red}" Margin="10,0,0,0" <fcommon:IconButton Style="{StaticResource IconButton_Red}" Margin="10,0,0,0"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/down_16x16.png" Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/down_16x16.png"
......
...@@ -189,9 +189,9 @@ namespace VIZ.TVP.Golf.Module ...@@ -189,9 +189,9 @@ namespace VIZ.TVP.Golf.Module
if (!vm.IsEnter) if (!vm.IsEnter)
return; return;
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName);
this.GroupPickerPanelModel.UpdatePlayersScore(list, this.SelectedRound); this.GroupPickerPanelModel.UpdatePlayersScore(list);
} }
#endregion #endregion
...@@ -205,7 +205,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -205,7 +205,7 @@ namespace VIZ.TVP.Golf.Module
{ {
Task.Run(() => Task.Run(() =>
{ {
string fileName = this.realDataService.DownLoadData(INTERFACE_TOURNAMENT); string fileName = this.fileDataService.DownLoadData(INTERFACE_TOURNAMENT);
if (string.IsNullOrWhiteSpace(fileName)) if (string.IsNullOrWhiteSpace(fileName))
{ {
...@@ -214,11 +214,11 @@ namespace VIZ.TVP.Golf.Module ...@@ -214,11 +214,11 @@ namespace VIZ.TVP.Golf.Module
return; return;
} }
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(fileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(fileName);
WPFHelper.BeginInvoke(() => WPFHelper.BeginInvoke(() =>
{ {
this.GroupPickerPanelModel.UpdatePlayersScore(list, this.SelectedRound); this.GroupPickerPanelModel.UpdatePlayersScore(list);
}); });
}); });
} }
......
...@@ -7,6 +7,7 @@ using System.Web.WebSockets; ...@@ -7,6 +7,7 @@ using System.Web.WebSockets;
using System.Windows; 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;
namespace VIZ.TVP.Golf.Module namespace VIZ.TVP.Golf.Module
{ {
...@@ -93,10 +94,6 @@ namespace VIZ.TVP.Golf.Module ...@@ -93,10 +94,6 @@ namespace VIZ.TVP.Golf.Module
// Command // Command
// =================================================================================== // ===================================================================================
// ===================================================================================
// Command
// ===================================================================================
#region StartCommand -- 开始命令 #region StartCommand -- 开始命令
/// <summary> /// <summary>
...@@ -104,7 +101,51 @@ namespace VIZ.TVP.Golf.Module ...@@ -104,7 +101,51 @@ namespace VIZ.TVP.Golf.Module
/// </summary> /// </summary>
protected override void Start() protected override void Start()
{ {
Dictionary<string, IVizControlObjctsValue> dic = new Dictionary<string, IVizControlObjctsValue>();
// 分组
dic["FD1"] = new VizControlObjectsStringValue($"{this.Group}组");
// 分组
dic["MD"] = this.GetTeamGroupData();
VizControlObjctsCommand cmd = new VizControlObjctsCommand(dic);
ApplicationDomainEx.VizEngineModel.STAGE_START($"{TvpStaticResource.SCENE_PATH}13-XZXXB", "OnSetData", cmd.ToString());
}
/// <summary>
/// 获取洞行数据
/// </summary>
/// <returns>分组信息版行数据</returns>
private VizControlObjectsElementValue GetTeamGroupData()
{
List<Dictionary<string, string>> md_itms = new List<Dictionary<string, string>>();
Dictionary<string, string> team1 = new Dictionary<string, string>();
// 队伍Logo
team1["FLAG"] = this.resourceService.GetImageName(this.GroupPickerPanelModel1.SelectedGroupInfo.TeamLogo);
// 排名
team1["NUMBER"] = this.GroupPickerPanelModel1.PlayersPosition;
// 得分
team1["SCORE"] = this.groupPickerPanelModel1.PlayersScore;
// 球员
team1["PLAYER"] = this.groupPickerPanelModel1.PlayersDisplayName;
md_itms.Add(team1);
Dictionary<string, string> team2 = new Dictionary<string, string>();
// 队伍Logo
team2["FLAG"] = this.resourceService.GetImageName(this.GroupPickerPanelModel2.SelectedGroupInfo.TeamLogo);
// 排名
team2["NUMBER"] = this.GroupPickerPanelModel2.PlayersPosition;
// 得分
team2["SCORE"] = this.groupPickerPanelModel2.PlayersScore;
// 球员
team2["PLAYER"] = this.groupPickerPanelModel2.PlayersDisplayName;
md_itms.Add(team2);
return new VizControlObjectsElementValue(md_itms);
} }
#endregion #endregion
...@@ -126,10 +167,11 @@ namespace VIZ.TVP.Golf.Module ...@@ -126,10 +167,11 @@ namespace VIZ.TVP.Golf.Module
if (!vm.IsEnter) if (!vm.IsEnter)
return; return;
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName);
List<GroupTempModel> tempModels = this.tempModelService.GetShortGroupTempModels(list, 2);
this.GroupPickerPanelModel1.UpdatePlayersScore(list, this.SelectedRound); this.GroupPickerPanelModel1.UpdatePlayerScoreAndPosition(tempModels);
this.GroupPickerPanelModel2.UpdatePlayersScore(list, this.SelectedRound); this.GroupPickerPanelModel2.UpdatePlayerScoreAndPosition(tempModels);
} }
#endregion #endregion
...@@ -143,7 +185,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -143,7 +185,7 @@ namespace VIZ.TVP.Golf.Module
{ {
Task.Run(() => Task.Run(() =>
{ {
string fileName = this.realDataService.DownLoadData(INTERFACE_TOURNAMENT); string fileName = this.fileDataService.DownLoadData(INTERFACE_TOURNAMENT);
if (string.IsNullOrWhiteSpace(fileName)) if (string.IsNullOrWhiteSpace(fileName))
{ {
...@@ -152,10 +194,13 @@ namespace VIZ.TVP.Golf.Module ...@@ -152,10 +194,13 @@ namespace VIZ.TVP.Golf.Module
return; return;
} }
List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(fileName);
List<GroupTempModel> tempModels = this.tempModelService.GetShortGroupTempModels(list, 2);
WPFHelper.BeginInvoke(() => WPFHelper.BeginInvoke(() =>
{ {
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(fileName); this.GroupPickerPanelModel1.UpdatePlayerScoreAndPosition(tempModels);
this.GroupPickerPanelModel2.UpdatePlayerScoreAndPosition(tempModels);
}); });
}); });
} }
......
...@@ -75,7 +75,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -75,7 +75,7 @@ namespace VIZ.TVP.Golf.Module
if (!vm.IsEnter) if (!vm.IsEnter)
return; return;
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName);
this.GroupPickerPanelModel1.UpdatePlayersScore(list, this.SelectedRound, this.SelectedHoleInfo.HoleID); this.GroupPickerPanelModel1.UpdatePlayersScore(list, this.SelectedRound, this.SelectedHoleInfo.HoleID);
this.GroupPickerPanelModel2.UpdatePlayersScore(list, this.SelectedRound, this.SelectedHoleInfo.HoleID); this.GroupPickerPanelModel2.UpdatePlayersScore(list, this.SelectedRound, this.SelectedHoleInfo.HoleID);
...@@ -92,7 +92,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -92,7 +92,7 @@ namespace VIZ.TVP.Golf.Module
{ {
Task.Run(() => Task.Run(() =>
{ {
string fileName = this.realDataService.DownLoadData(INTERFACE_TOURNAMENT); string fileName = this.fileDataService.DownLoadData(INTERFACE_TOURNAMENT);
if (string.IsNullOrWhiteSpace(fileName)) if (string.IsNullOrWhiteSpace(fileName))
{ {
...@@ -103,7 +103,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -103,7 +103,7 @@ namespace VIZ.TVP.Golf.Module
WPFHelper.BeginInvoke(() => WPFHelper.BeginInvoke(() =>
{ {
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(fileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(fileName);
}); });
}); });
......
...@@ -46,30 +46,8 @@ ...@@ -46,30 +46,8 @@
<!-- 版子信息 --> <!-- 版子信息 -->
<Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5"> <Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5">
<Grid> <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 Padding="10">
<GroupBox.Header> <GroupBox.Header>
<TextBlock Text="排名" FontSize="18" FontWeight="Bold"></TextBlock> <TextBlock Text="排名" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header> </GroupBox.Header>
......
...@@ -80,7 +80,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -80,7 +80,7 @@ namespace VIZ.TVP.Golf.Module
// 得分 // 得分
item["D2"] = grpup.PlayersScore; item["D2"] = grpup.PlayersScore;
// 球队logo // 球队logo
item["FLAGE"] = this.realDataService.GetImageName(grpup.TeamLogo); item["FLAGE"] = this.resourceService.GetImageName(grpup.TeamLogo);
// ?? // ??
item["KG.active"] = "true"; item["KG.active"] = "true";
// 排名 // 排名
...@@ -101,5 +101,14 @@ namespace VIZ.TVP.Golf.Module ...@@ -101,5 +101,14 @@ namespace VIZ.TVP.Golf.Module
// Private Function // Private Function
// =================================================================================== // ===================================================================================
/// <summary>
/// 获取组临时模型集合
/// </summary>
/// <param name="list">球员真实模型</param>
/// <returns>组临时模型集合</returns>
protected override ObservableCollection<GroupTempModel> GetGroupTempModels(List<PlayerRealModel> list)
{
return this.tempModelService.GetShortGroupTempModels(list, this.SelectedRound).ToObservableCollection();
}
} }
} }
\ No newline at end of file
<UserControl x:Class="VIZ.TVP.Golf.Module.BeforeMatchGroupRankingView"
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:BeforeMatchGroupRankingViewModel}"
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>
<!-- 排名 -->
<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=PlayersScore}"></DataGridTextColumn>
</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 BeforeMatchGroupRankingView : UserControl
{
public BeforeMatchGroupRankingView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new BeforeMatchGroupRankingViewModel());
}
}
}
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 BeforeMatchGroupRankingViewModel : GroupRankingViewModelBase
{
public BeforeMatchGroupRankingViewModel()
{
}
// ===================================================================================
// Property
// ===================================================================================
// ===================================================================================
// Command
// ===================================================================================
// ===================================================================================
// Private Function
// ===================================================================================
}
}
\ No newline at end of file
...@@ -74,9 +74,9 @@ namespace VIZ.TVP.Golf.Module ...@@ -74,9 +74,9 @@ namespace VIZ.TVP.Golf.Module
if (!vm.IsEnter) if (!vm.IsEnter)
return; return;
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName);
this.ConstrrastGroupTempModels = this.GetGroupTempModels(list); this.ConstrrastGroupTempModels = this.tempModelService.GetShortGroupTempModels(list, this.SelectedRound).ToObservableCollection();
this.realDataService.UpdateGroupPosition(this.ConstrrastGroupTempModels); this.realDataService.UpdateGroupPosition(this.ConstrrastGroupTempModels);
this.realDataService.UpdateGroupPositionChanged(this.ConstrrastGroupTempModels, this.GroupTempModels); this.realDataService.UpdateGroupPositionChanged(this.ConstrrastGroupTempModels, this.GroupTempModels);
......
...@@ -82,7 +82,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -82,7 +82,7 @@ namespace VIZ.TVP.Golf.Module
if (!vm.IsEnter) if (!vm.IsEnter)
return; return;
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName);
this.GroupTempModels = this.GetGroupTempModels(list); this.GroupTempModels = this.GetGroupTempModels(list);
} }
...@@ -98,7 +98,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -98,7 +98,7 @@ namespace VIZ.TVP.Golf.Module
{ {
Task.Run(() => Task.Run(() =>
{ {
string fileName = this.realDataService.DownLoadData(INTERFACE_TOURNAMENT); string fileName = this.fileDataService.DownLoadData(INTERFACE_TOURNAMENT);
if (string.IsNullOrWhiteSpace(fileName)) if (string.IsNullOrWhiteSpace(fileName))
{ {
...@@ -109,7 +109,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -109,7 +109,7 @@ namespace VIZ.TVP.Golf.Module
WPFHelper.BeginInvoke(() => WPFHelper.BeginInvoke(() =>
{ {
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(fileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(fileName);
this.GroupTempModels = this.GetGroupTempModels(list); this.GroupTempModels = this.GetGroupTempModels(list);
}); });
...@@ -127,60 +127,6 @@ namespace VIZ.TVP.Golf.Module ...@@ -127,60 +127,6 @@ namespace VIZ.TVP.Golf.Module
/// </summary> /// </summary>
/// <param name="list">球员真实模型</param> /// <param name="list">球员真实模型</param>
/// <returns>组临时模型集合</returns> /// <returns>组临时模型集合</returns>
protected virtual ObservableCollection<GroupTempModel> GetGroupTempModels(List<PlayerRealModel> list) protected abstract ObservableCollection<GroupTempModel> GetGroupTempModels(List<PlayerRealModel> list);
{
List<GroupTempModel> groupTempModels = new List<GroupTempModel>();
IEnumerable<IGrouping<string, PlayerInfoModel>> groups = null;
if (this.SelectedRound == 1)
{
groups = ApplicationDomainEx.PlayerInfos.Where(p => !string.IsNullOrWhiteSpace(p.Group_First)).GroupBy(p => p.Group_First);
}
else
{
groups = ApplicationDomainEx.PlayerInfos.Where(p => !string.IsNullOrWhiteSpace(p.Group)).GroupBy(p => p.Group);
}
foreach (var group in groups)
{
foreach (var team_group in group.GroupBy(p => p.TeamID))
{
PlayerRealModel player1 = null;
PlayerRealModel player2 = null;
List<PlayerInfoModel> players = team_group.ToList();
GroupTempModel temp_model = new GroupTempModel();
temp_model.Group = group.Key;
temp_model.TeamInfo = ApplicationDomainEx.TeamInfos.FirstOrDefault(p => p.TeamID == team_group.Key);
temp_model.TeamLogo = temp_model.TeamInfo?.Logo;
if (players.Count > 0)
{
player1 = list.FirstOrDefault(p => p.PlayerID == players[0].PlayerID);
temp_model.Player1 = players[0];
}
if (players.Count > 1)
{
player2 = list.FirstOrDefault(p => p.PlayerID == players[1].PlayerID);
temp_model.Player2 = players[1];
}
temp_model.PlayersDisplayName = this.realDataService.GetGroupName(temp_model.Player1?.Name, temp_model.Player2?.Name);
int score = this.realDataService.GetGroupRoundScore(group.Key, player1, player2, this.SelectedRound);
temp_model.PlayersScore = this.realDataService.GetScoreString(score);
temp_model.PlayerScoreValue = score;
groupTempModels.Add(temp_model);
}
}
// 排序
GroupTempModelComparer comparer = new GroupTempModelComparer(list, this.SelectedRound);
groupTempModels.Sort(comparer);
this.realDataService.UpdateGroupPosition(groupTempModels);
return groupTempModels.ToObservableCollection();
}
} }
} }
...@@ -75,5 +75,14 @@ namespace VIZ.TVP.Golf.Module ...@@ -75,5 +75,14 @@ namespace VIZ.TVP.Golf.Module
// Private Function // Private Function
// =================================================================================== // ===================================================================================
/// <summary>
/// 获取组临时模型集合
/// </summary>
/// <param name="list">球员真实模型</param>
/// <returns>组临时模型集合</returns>
protected override ObservableCollection<GroupTempModel> GetGroupTempModels(List<PlayerRealModel> list)
{
return this.tempModelService.GetShortGroupTempModels(list, this.SelectedRound).ToObservableCollection();
}
} }
} }
\ No newline at end of file
...@@ -53,31 +53,8 @@ ...@@ -53,31 +53,8 @@
<!-- 版子信息 --> <!-- 版子信息 -->
<Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5"> <Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5">
<Grid> <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 Padding="10">
<GroupBox.Header> <GroupBox.Header>
<TextBlock Text="排名" FontSize="18" FontWeight="Bold"></TextBlock> <TextBlock Text="排名" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header> </GroupBox.Header>
......
...@@ -32,5 +32,14 @@ namespace VIZ.TVP.Golf.Module ...@@ -32,5 +32,14 @@ namespace VIZ.TVP.Golf.Module
// Private Function // Private Function
// =================================================================================== // ===================================================================================
/// <summary>
/// 获取组临时模型集合
/// </summary>
/// <param name="list">球员真实模型</param>
/// <returns>组临时模型集合</returns>
protected override ObservableCollection<GroupTempModel> GetGroupTempModels(List<PlayerRealModel> list)
{
return this.tempModelService.GetShortGroupTempModels(list, 2).Take(TvpStaticResource.DEFALUT_TOP_GROUP).ToObservableCollection();
}
} }
} }
\ No newline at end of file
...@@ -44,6 +44,21 @@ namespace VIZ.TVP.Golf.Module ...@@ -44,6 +44,21 @@ namespace VIZ.TVP.Golf.Module
/// </summary> /// </summary>
protected IRealDataService realDataService = new RealDataService(); protected IRealDataService realDataService = new RealDataService();
/// <summary>
/// 资源服务
/// </summary>
protected IResourceService resourceService = new ResourceService();
/// <summary>
/// 文件数据服务
/// </summary>
protected IFileDataService fileDataService = new FileDataService();
/// <summary>
/// 临时模型服务
/// </summary>
protected ITempModelService tempModelService = new TempModelService();
// =================================================================================== // ===================================================================================
// Property // Property
// =================================================================================== // ===================================================================================
......
...@@ -156,9 +156,9 @@ namespace VIZ.TVP.Golf.Module ...@@ -156,9 +156,9 @@ namespace VIZ.TVP.Golf.Module
// 球员2 姓名 // 球员2 姓名
item["PLAYER2"] = players[1].Name; item["PLAYER2"] = players[1].Name;
// 球员1 照片 // 球员1 照片
item["PLAYERPHOTOLEFT"] = this.realDataService.GetImageName(players[0].HalfPicture); item["PLAYERPHOTOLEFT"] = this.resourceService.GetImageName(players[0].HalfPicture);
// 球员2 照片 // 球员2 照片
item["PLAYERPHOTORIGHT"] = this.realDataService.GetImageName(players[1].HalfPicture); item["PLAYERPHOTORIGHT"] = this.resourceService.GetImageName(players[1].HalfPicture);
} }
} }
...@@ -219,13 +219,17 @@ namespace VIZ.TVP.Golf.Module ...@@ -219,13 +219,17 @@ namespace VIZ.TVP.Golf.Module
item["PLAYER1"] = string.Empty; item["PLAYER1"] = string.Empty;
// 球员 照片 // 球员 照片
item["PLAYERPHOTOLEFT"] = string.Empty; item["PLAYERPHOTOLEFT"] = string.Empty;
// 是否显示
item["SHOW"] = string.Empty;
if (players.Count > i) if (players.Count > i)
{ {
// 球员 姓名 // 球员 姓名
item["PLAYER1"] = players[i].Name; item["PLAYER1"] = players[i].Name;
// 球员 照片 // 球员 照片
item["PLAYERPHOTOLEFT"] = this.realDataService.GetImageName(players[i].HalfPicture); item["PLAYERPHOTOLEFT"] = this.resourceService.GetImageName(players[i].HalfPicture);
// 是否显示
item["SHOW"] = "1";
} }
md_itms.Add(item); md_itms.Add(item);
......
...@@ -82,7 +82,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -82,7 +82,7 @@ namespace VIZ.TVP.Golf.Module
// 得分 // 得分
item["D2"] = team.TotalScore; item["D2"] = team.TotalScore;
// 球队logo // 球队logo
item["FLAGE"] = this.realDataService.GetImageName(team.Logo); item["FLAGE"] = this.resourceService.GetImageName(team.Logo);
// ?? // ??
item["KG.active"] = "true"; item["KG.active"] = "true";
// 排名 // 排名
...@@ -110,30 +110,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -110,30 +110,7 @@ namespace VIZ.TVP.Golf.Module
/// <returns>队伍临时模型集合</returns> /// <returns>队伍临时模型集合</returns>
protected override ObservableCollection<TeamTempModel> GetTeamTempModels(List<PlayerRealModel> list) protected override ObservableCollection<TeamTempModel> GetTeamTempModels(List<PlayerRealModel> list)
{ {
List<TeamTempModel> teamTempModels = new List<TeamTempModel>(); return this.tempModelService.GetShortTeamTempModels(list, 2).ToObservableCollection();
foreach (TeamInfoModel info_model in ApplicationDomainEx.TeamInfos)
{
TeamTempModel temp_model = new TeamTempModel();
temp_model.FromInfoModel(info_model);
TeamRoundStatisticsData data1 = this.realDataService.GetTeamRoundStatisticsData(list, info_model.TeamID, 1);
TeamRoundStatisticsData data2 = this.realDataService.GetTeamRoundStatisticsData(list, info_model.TeamID, 2);
if (data1 != null && data2 != null)
{
temp_model.TotalScoreValue = data1.Score + data2.Score;
temp_model.TotalScore = this.realDataService.GetScoreString(data1.Score + data2.Score);
}
teamTempModels.Add(temp_model);
}
// 赛前比较第一轮
TeamTempModelComparer comparer = new TeamTempModelComparer(list);
teamTempModels.Sort(comparer);
this.realDataService.UpdateTeamPosition(teamTempModels);
return teamTempModels.ToObservableCollection();
} }
} }
} }
...@@ -82,7 +82,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -82,7 +82,7 @@ namespace VIZ.TVP.Golf.Module
// 得分 // 得分
item["D2"] = team.TotalScore; item["D2"] = team.TotalScore;
// 球队logo // 球队logo
item["FLAGE"] = this.realDataService.GetImageName(team.Logo); item["FLAGE"] = this.resourceService.GetImageName(team.Logo);
// ?? // ??
item["KG.active"] = "true"; item["KG.active"] = "true";
// 排名 // 排名
...@@ -110,29 +110,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -110,29 +110,7 @@ namespace VIZ.TVP.Golf.Module
/// <returns>队伍临时模型集合</returns> /// <returns>队伍临时模型集合</returns>
protected override ObservableCollection<TeamTempModel> GetTeamTempModels(List<PlayerRealModel> list) protected override ObservableCollection<TeamTempModel> GetTeamTempModels(List<PlayerRealModel> list)
{ {
List<TeamTempModel> teamTempModels = new List<TeamTempModel>(); return this.tempModelService.GetShortTeamTempModels(list, 1).ToObservableCollection();
foreach (TeamInfoModel info_model in ApplicationDomainEx.TeamInfos)
{
TeamTempModel temp_model = new TeamTempModel();
temp_model.FromInfoModel(info_model);
TeamRoundStatisticsData data = this.realDataService.GetTeamRoundStatisticsData(list, info_model.TeamID, 1);
if (data != null)
{
temp_model.TotalScoreValue = data.Score;
temp_model.TotalScore = this.realDataService.GetScoreString(data.Score);
}
teamTempModels.Add(temp_model);
}
// 赛前比较第一轮
TeamTempModelComparer comparer = new TeamTempModelComparer(list);
teamTempModels.Sort(comparer);
this.realDataService.UpdateTeamPosition(teamTempModels);
return teamTempModels.ToObservableCollection();
} }
} }
} }
...@@ -42,30 +42,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -42,30 +42,7 @@ namespace VIZ.TVP.Golf.Module
/// <returns>队伍临时模型集合</returns> /// <returns>队伍临时模型集合</returns>
protected override ObservableCollection<TeamTempModel> GetTeamTempModels(List<PlayerRealModel> list) protected override ObservableCollection<TeamTempModel> GetTeamTempModels(List<PlayerRealModel> list)
{ {
List<TeamTempModel> teamTempModels = new List<TeamTempModel>(); return this.tempModelService.GetShortTeamTempModels(list, 2).ToObservableCollection();
foreach (TeamInfoModel info_model in ApplicationDomainEx.TeamInfos)
{
TeamTempModel temp_model = new TeamTempModel();
temp_model.FromInfoModel(info_model);
TeamRoundStatisticsData data1 = this.realDataService.GetTeamRoundStatisticsData(list, info_model.TeamID, 1);
TeamRoundStatisticsData data2 = this.realDataService.GetTeamRoundStatisticsData(list, info_model.TeamID, 2);
if (data1 != null && data2 != null)
{
temp_model.TotalScoreValue = data1.Score + data2.Score;
temp_model.TotalScore = this.realDataService.GetScoreString(data1.Score + data2.Score);
}
teamTempModels.Add(temp_model);
}
// 赛前比较第一轮
TeamTempModelComparer comparer = new TeamTempModelComparer(list);
teamTempModels.Sort(comparer);
this.realDataService.UpdateTeamPosition(teamTempModels);
return teamTempModels.ToObservableCollection();
} }
} }
} }
...@@ -79,7 +79,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -79,7 +79,7 @@ namespace VIZ.TVP.Golf.Module
// 得分 // 得分
item["SCORE"] = team.TotalScore; item["SCORE"] = team.TotalScore;
// 球队logo // 球队logo
item["1"] = this.realDataService.GetImageName(team.Logo); item["1"] = this.resourceService.GetImageName(team.Logo);
// ?? // ??
//item["HL.active"] = string.Empty; //item["HL.active"] = string.Empty;
// 排名 // 排名
...@@ -107,29 +107,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -107,29 +107,7 @@ namespace VIZ.TVP.Golf.Module
/// <returns>队伍临时模型集合</returns> /// <returns>队伍临时模型集合</returns>
protected override ObservableCollection<TeamTempModel> GetTeamTempModels(List<PlayerRealModel> list) protected override ObservableCollection<TeamTempModel> GetTeamTempModels(List<PlayerRealModel> list)
{ {
List<TeamTempModel> teamTempModels = new List<TeamTempModel>(); return this.tempModelService.GetShortTeamTempModels(list, 2).Take(TvpStaticResource.DEFALUT_SHORT_TEAM_RANKING).ToObservableCollection();
foreach (TeamInfoModel info_model in ApplicationDomainEx.TeamInfos)
{
TeamTempModel temp_model = new TeamTempModel();
temp_model.FromInfoModel(info_model);
TeamRoundStatisticsData data1 = this.realDataService.GetTeamRoundStatisticsData(list, info_model.TeamID, 1);
TeamRoundStatisticsData data2 = this.realDataService.GetTeamRoundStatisticsData(list, info_model.TeamID, 2);
if (data1 != null && data2 != null)
{
temp_model.TotalScoreValue = data1.Score + data2.Score;
temp_model.TotalScore = this.realDataService.GetScoreString(data1.Score + data2.Score);
}
teamTempModels.Add(temp_model);
}
TeamTempModelComparer comparer = new TeamTempModelComparer(list);
teamTempModels.Sort(comparer);
this.realDataService.UpdateTeamPosition(teamTempModels);
return teamTempModels.Take(TvpStaticResource.DEFALUT_SHORT_TEAM_RANKING).ToObservableCollection();
} }
} }
} }
...@@ -75,9 +75,9 @@ namespace VIZ.TVP.Golf.Module ...@@ -75,9 +75,9 @@ namespace VIZ.TVP.Golf.Module
if (!vm.IsEnter) if (!vm.IsEnter)
return; return;
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName);
this.ContrastTeamTempModels = this.GetTeamTempModels(list); this.ContrastTeamTempModels = this.tempModelService.GetShortTeamTempModels(list, 2).ToObservableCollection();
this.realDataService.UpdateTeamPosition(this.ContrastTeamTempModels); this.realDataService.UpdateTeamPosition(this.ContrastTeamTempModels);
this.realDataService.UpdateTeamPositionChanged(this.ContrastTeamTempModels, this.TeamTempModels); this.realDataService.UpdateTeamPositionChanged(this.ContrastTeamTempModels, this.TeamTempModels);
...@@ -105,40 +105,5 @@ namespace VIZ.TVP.Golf.Module ...@@ -105,40 +105,5 @@ namespace VIZ.TVP.Golf.Module
#endregion #endregion
// ===================================================================================
// Private Function
// ===================================================================================
/// <summary>
/// 获取队伍临时模型集合
/// </summary>
/// <param name="list">球员真实模型</param>
/// <returns>队伍临时模型集合</returns>
protected override ObservableCollection<TeamTempModel> GetTeamTempModels(List<PlayerRealModel> list)
{
List<TeamTempModel> teamTempModels = new List<TeamTempModel>();
foreach (TeamInfoModel info_model in ApplicationDomainEx.TeamInfos)
{
TeamTempModel temp_model = new TeamTempModel();
temp_model.FromInfoModel(info_model);
TeamRoundStatisticsData data = this.realDataService.GetTeamRoundStatisticsData(list, info_model.TeamID, this.SelectedRound);
if (data != null)
{
temp_model.TotalScoreValue = data.Score;
temp_model.TotalScore = this.realDataService.GetScoreString(data.Score);
}
teamTempModels.Add(temp_model);
}
// 赛前比较第一轮
TeamTempModelComparer comparer = new TeamTempModelComparer(list);
teamTempModels.Sort(comparer);
this.realDataService.UpdateTeamPosition(teamTempModels);
return teamTempModels.Take(TvpStaticResource.DEFALUT_SHORT_TEAM_RANKING).ToObservableCollection();
}
} }
} }
...@@ -83,7 +83,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -83,7 +83,7 @@ namespace VIZ.TVP.Golf.Module
if (!vm.IsEnter) if (!vm.IsEnter)
return; return;
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName);
this.TeamTempModels = this.GetTeamTempModels(list); this.TeamTempModels = this.GetTeamTempModels(list);
} }
...@@ -99,7 +99,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -99,7 +99,7 @@ namespace VIZ.TVP.Golf.Module
{ {
Task.Run(() => Task.Run(() =>
{ {
string fileName = this.realDataService.DownLoadData(INTERFACE_TOURNAMENT); string fileName = this.fileDataService.DownLoadData(INTERFACE_TOURNAMENT);
if (string.IsNullOrWhiteSpace(fileName)) if (string.IsNullOrWhiteSpace(fileName))
{ {
...@@ -110,7 +110,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -110,7 +110,7 @@ namespace VIZ.TVP.Golf.Module
WPFHelper.BeginInvoke(() => WPFHelper.BeginInvoke(() =>
{ {
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(fileName); List<PlayerRealModel> list = this.fileDataService.LoadPlayerRealModelFormLocal(fileName);
this.TeamTempModels = this.GetTeamTempModels(list); this.TeamTempModels = this.GetTeamTempModels(list);
}); });
......
...@@ -109,10 +109,6 @@ ...@@ -109,10 +109,6 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Package\GroupRanking\BeforeMatchGroupRanking\View\BeforeMatchGroupRankingView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Package\GroupRanking\AfterMatchGroupRanking\View\AfterMatchGroupRankingView.xaml"> <Page Include="Package\GroupRanking\AfterMatchGroupRanking\View\AfterMatchGroupRankingView.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
...@@ -240,10 +236,6 @@ ...@@ -240,10 +236,6 @@
<Compile Include="Package\GroupRanking\ShortGroupRanking\View\ShortMatchGroupRankingView.xaml.cs"> <Compile Include="Package\GroupRanking\ShortGroupRanking\View\ShortMatchGroupRankingView.xaml.cs">
<DependentUpon>ShortMatchGroupRankingView.xaml</DependentUpon> <DependentUpon>ShortMatchGroupRankingView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Package\GroupRanking\BeforeMatchGroupRanking\ViewModel\BeforeMatchGroupRankingViewModel.cs" />
<Compile Include="Package\GroupRanking\BeforeMatchGroupRanking\View\BeforeMatchGroupRankingView.xaml.cs">
<DependentUpon>BeforeMatchGroupRankingView.xaml</DependentUpon>
</Compile>
<Compile Include="Package\GroupRanking\AfterMatchGroupRanking\View\AfterMatchGroupRankingView.xaml.cs"> <Compile Include="Package\GroupRanking\AfterMatchGroupRanking\View\AfterMatchGroupRankingView.xaml.cs">
<DependentUpon>AfterMatchGroupRankingView.xaml</DependentUpon> <DependentUpon>AfterMatchGroupRankingView.xaml</DependentUpon>
</Compile> </Compile>
......
...@@ -134,6 +134,20 @@ namespace VIZ.TVP.Golf.Module ...@@ -134,6 +134,20 @@ namespace VIZ.TVP.Golf.Module
#endregion #endregion
#region PlayersPosition -- 组成员排名
private string playersPosition;
/// <summary>
/// 组成员排名
/// </summary>
public string PlayersPosition
{
get { return playersPosition; }
set { playersPosition = value; this.RaisePropertyChanged(nameof(PlayersPosition)); }
}
#endregion
// =================================================================================== // ===================================================================================
// Field // Field
// =================================================================================== // ===================================================================================
...@@ -143,6 +157,21 @@ namespace VIZ.TVP.Golf.Module ...@@ -143,6 +157,21 @@ namespace VIZ.TVP.Golf.Module
/// </summary> /// </summary>
private IRealDataService realDataService = new RealDataService(); private IRealDataService realDataService = new RealDataService();
/// <summary>
/// 资源服务
/// </summary>
private IResourceService resourceService = new ResourceService();
/// <summary>
/// 文件数据服务
/// </summary>
private IFileDataService fileDataService = new FileDataService();
/// <summary>
/// 临时模型服务
/// </summary>
private ITempModelService tempModelService = new TempModelService();
// =================================================================================== // ===================================================================================
// Command // Command
// =================================================================================== // ===================================================================================
...@@ -192,6 +221,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -192,6 +221,7 @@ namespace VIZ.TVP.Golf.Module
this.Name = groupTempModel.TeamInfo.Name; this.Name = groupTempModel.TeamInfo.Name;
this.Logo = groupTempModel.TeamInfo.Logo; this.Logo = groupTempModel.TeamInfo.Logo;
this.PlayersScore = groupTempModel.PlayersScore; this.PlayersScore = groupTempModel.PlayersScore;
this.PlayersPosition = groupTempModel.PositionValue.ToString();
if (groupTempModel.Player1 != null) if (groupTempModel.Player1 != null)
{ {
...@@ -207,7 +237,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -207,7 +237,7 @@ namespace VIZ.TVP.Golf.Module
this.Player2.HalfPicture = groupTempModel.Player2.HalfPicture; this.Player2.HalfPicture = groupTempModel.Player2.HalfPicture;
} }
this.UpdatePlayersDisplayName(); this.PlayersDisplayName = this.resourceService.GetGroupName(this.Player1?.Name, this.Player2?.Name);
} }
/// <summary> /// <summary>
...@@ -228,28 +258,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -228,28 +258,7 @@ namespace VIZ.TVP.Golf.Module
this.PlayersDisplayName = null; this.PlayersDisplayName = null;
this.PlayersScore = null; this.PlayersScore = null;
} this.PlayersPosition = null;
/// <summary>
/// 更新球员集合属性
/// </summary>
public void UpdatePlayersDisplayName()
{
// 组成员
StringBuilder sb = new StringBuilder();
if (this.Player1 != null)
{
sb.Append(this.Player1.Name);
}
if (this.Player2 != null)
{
sb.Append(" / ");
sb.Append(this.Player2.Name);
}
this.PlayersDisplayName = sb.ToString();
} }
/// <summary> /// <summary>
...@@ -270,15 +279,14 @@ namespace VIZ.TVP.Golf.Module ...@@ -270,15 +279,14 @@ namespace VIZ.TVP.Golf.Module
if (data == null) if (data == null)
return; return;
this.PlayersScore = this.realDataService.GetScoreString(data.Score); this.PlayersScore = this.resourceService.GetScoreString(data.Score);
} }
/// <summary> /// <summary>
/// 更新得分 /// 更新得分
/// </summary> /// </summary>
/// <param name="list">真实数据</param> /// <param name="list">真实数据</param>
/// <param name="round">轮次</param> public void UpdatePlayersScore(List<PlayerRealModel> list)
public void UpdatePlayersScore(List<PlayerRealModel> list, int round)
{ {
if (list == null) if (list == null)
return; return;
...@@ -286,9 +294,24 @@ namespace VIZ.TVP.Golf.Module ...@@ -286,9 +294,24 @@ namespace VIZ.TVP.Golf.Module
PlayerRealModel player1 = list.FirstOrDefault(p => p.PlayerID == this.Player1.PlayerID); PlayerRealModel player1 = list.FirstOrDefault(p => p.PlayerID == this.Player1.PlayerID);
PlayerRealModel player2 = list.FirstOrDefault(p => p.PlayerID == this.Player2.PlayerID); PlayerRealModel player2 = list.FirstOrDefault(p => p.PlayerID == this.Player2.PlayerID);
int score = this.realDataService.GetGroupRoundScore(this.SelectedGroupInfo.Group, player1, player2, round); int score = this.realDataService.GetGroupRoundScore(this.SelectedGroupInfo.Group, player1, player2, 2);
this.PlayersScore = this.resourceService.GetScoreString(score);
}
/// <summary>
/// 更新得分与排名
/// </summary>
/// <param name="tempModels">排序后的分组模型</param>
public void UpdatePlayerScoreAndPosition(IList<GroupTempModel> tempModels)
{
if (tempModels == null)
return;
var tempGroup = tempModels.FirstOrDefault(p => p.Group == this.SelectedGroupInfo.Group && p.TeamInfo.TeamID == this.SelectedGroupInfo.TeamInfo.TeamID);
this.PlayersScore = this.realDataService.GetScoreString(score); this.PlayersScore = tempGroup.PlayersScore;
this.PlayersPosition = tempGroup.PositionValue?.ToString();
} }
} }
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common" 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:domain="clr-namespace:VIZ.TVP.Golf.Domain;assembly=VIZ.TVP.Golf.Domain"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core" xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
d:Background="White" d:Background="White" x:Name="uc"
d:DataContext="{d:DesignInstance Type=local:GroupPickerPanelModel}" d:DataContext="{d:DesignInstance Type=local:GroupPickerPanelModel}"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="700"> d:DesignHeight="300" d:DesignWidth="700">
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary> <ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<core:String2ImageSourceConverter x:Key="String2ImageSourceConverter_team" Type="Relative" WorkPath="picture/team"></core:String2ImageSourceConverter> <core:String2ImageSourceConverter x:Key="String2ImageSourceConverter_team" Type="Relative" WorkPath="picture/team"></core:String2ImageSourceConverter>
<core:Bool2VisibilityConverter x:Key="Bool2VisibilityConverter" TrueVisibility="Visible" FalseVisibility="Collapsed"></core:Bool2VisibilityConverter>
</ResourceDictionary> </ResourceDictionary>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
<RowDefinition Height="40"></RowDefinition> <RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition> <RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition> <RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 预设 --> <!-- 预设 -->
<TextBlock Text="预设:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0"></TextBlock> <TextBlock Text="预设:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0"></TextBlock>
...@@ -38,24 +40,35 @@ ...@@ -38,24 +40,35 @@
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/presets_16x16.png" Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/presets_16x16.png"
Content="选择分组" Grid.Column="1" Width="80" Height="30" Margin="5,0,0,0" Content="选择分组" Grid.Column="1" Width="80" Height="30" Margin="5,0,0,0"
Command="{Binding SelectGroupCommand}"></fcommon:IconButton> Command="{Binding SelectGroupCommand}"></fcommon:IconButton>
<!-- 成员 -->
<TextBlock Text="成员:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0" Grid.Row="1"></TextBlock>
<TextBox Grid.Row="1" Grid.Column="1" Height="30" Margin="5,0,18,0" VerticalContentAlignment="Center"
Text="{Binding Path=PlayersDisplayName,Mode=TwoWay}" Padding="3"></TextBox>
<!-- 得分 -->
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="0" Margin="0,0,5,0" Orientation="Horizontal">
<Image Width="16" Height="16" Source="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png" Margin="0,0,5,0"></Image>
<TextBlock Text="得分:" ></TextBlock>
</StackPanel>
<TextBox Grid.Row="2" Grid.Column="1" Height="30" Margin="5,0,18,0" VerticalContentAlignment="Center"
Text="{Binding Path=PlayersScore,Mode=TwoWay}" Padding="3"></TextBox>
<!-- 球队Logo --> <!-- 球队Logo -->
<TextBlock Text="球队Logo:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="3"></TextBlock> <TextBlock Text="球队Logo:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1"></TextBlock>
<ComboBox Height="30" Margin="5,0,18,0" VerticalContentAlignment="Center" Grid.Row="3" Grid.Column="1" <ComboBox Height="30" Margin="5,0,18,0" VerticalContentAlignment="Center" Grid.Row="1" Grid.Column="1"
SelectedValue="{Binding Logo,Mode=TwoWay}" SelectedValue="{Binding Logo,Mode=TwoWay}"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.TeamLogos}}"></ComboBox> ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.TeamLogos}}"></ComboBox>
<Border BorderBrush="#44000000" BorderThickness="1" Grid.Column="2" Grid.RowSpan="4" Margin="5"> <Border BorderBrush="#44000000" BorderThickness="1" Grid.Column="2" Grid.RowSpan="5" Margin="5" MaxHeight="190">
<Image Source="{Binding Path=Logo,Converter={StaticResource String2ImageSourceConverter_team}}"></Image> <Image Source="{Binding Path=Logo,Converter={StaticResource String2ImageSourceConverter_team}}"></Image>
</Border> </Border>
<!-- 成员 -->
<TextBlock Text="成员:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0" Grid.Row="2"></TextBlock>
<TextBox Grid.Row="2" Grid.Column="1" Height="30" Margin="5,0,18,0" VerticalContentAlignment="Center"
Text="{Binding Path=PlayersDisplayName,Mode=TwoWay}" Padding="3"></TextBox>
<!-- 得分 -->
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="0" Margin="0,0,5,0" Orientation="Horizontal"
Height="40" Visibility="{Binding ElementName=uc,Path=IsShowScore,Converter={StaticResource Bool2VisibilityConverter}}">
<Image Width="16" Height="16" Source="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png" Margin="0,0,5,0" VerticalAlignment="Center"></Image>
<TextBlock Text="得分:" VerticalAlignment="Center"></TextBlock>
</StackPanel>
<TextBox Grid.Row="3" Grid.Column="1" Height="30" Margin="5,0,18,0" VerticalContentAlignment="Center"
Text="{Binding Path=PlayersScore,Mode=TwoWay}" Padding="3"
Visibility="{Binding ElementName=uc,Path=IsShowScore,Converter={StaticResource Bool2VisibilityConverter}}"></TextBox>
<!-- 排名 -->
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="4" Grid.Column="0" Margin="0,0,5,0" Orientation="Horizontal"
Height="40" Visibility="{Binding ElementName=uc,Path=IsShowPosition,Converter={StaticResource Bool2VisibilityConverter}}">
<Image Width="16" Height="16" Source="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png" Margin="0,0,5,0" VerticalAlignment="Center"></Image>
<TextBlock Text="排名:" VerticalAlignment="Center"></TextBlock>
</StackPanel>
<TextBox Grid.Row="4" Grid.Column="1" Height="30" Margin="5,0,18,0" VerticalContentAlignment="Center"
Text="{Binding Path=PlayersPosition,Mode=TwoWay}" Padding="3"
Visibility="{Binding ElementName=uc,Path=IsShowPosition,Converter={StaticResource Bool2VisibilityConverter}}"></TextBox>
</Grid> </Grid>
</UserControl> </UserControl>
...@@ -24,5 +24,43 @@ namespace VIZ.TVP.Golf.Module ...@@ -24,5 +24,43 @@ namespace VIZ.TVP.Golf.Module
{ {
InitializeComponent(); InitializeComponent();
} }
#region IsShowScore -- 是否显示得分
/// <summary>
/// 是否显示得分
/// </summary>
public bool IsShowScore
{
get { return (bool)GetValue(IsShowScoreProperty); }
set { SetValue(IsShowScoreProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for IsShowScore. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty IsShowScoreProperty =
DependencyProperty.Register("IsShowScore", typeof(bool), typeof(GroupPickerPanelNoPlayer), new PropertyMetadata(true));
#endregion
#region IsShowPosition -- 是否显示排名
/// <summary>
/// 是否显示排名
/// </summary>
public bool IsShowPosition
{
get { return (bool)GetValue(IsShowPositionProperty); }
set { SetValue(IsShowPositionProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for IsShowPosition. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty IsShowPositionProperty =
DependencyProperty.Register("IsShowPosition", typeof(bool), typeof(GroupPickerPanelNoPlayer), new PropertyMetadata(false));
#endregion
} }
} }
...@@ -7,6 +7,7 @@ using System.Threading.Tasks; ...@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using System.Windows; 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.Service;
namespace VIZ.TVP.Golf.Module namespace VIZ.TVP.Golf.Module
{ {
...@@ -31,6 +32,15 @@ namespace VIZ.TVP.Golf.Module ...@@ -31,6 +32,15 @@ namespace VIZ.TVP.Golf.Module
} }
// ===================================================================================== // =====================================================================================
// Field
// =====================================================================================
/// <summary>
/// 资源服务
/// </summary>
private IResourceService resourceService = new ResourceService();
// =====================================================================================
// Property // Property
// ===================================================================================== // =====================================================================================
...@@ -156,7 +166,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -156,7 +166,7 @@ namespace VIZ.TVP.Golf.Module
return; return;
} }
ObservableCollection<GroupTempModel> groupInfos = new ObservableCollection<GroupTempModel>(); List<GroupTempModel> groupInfos = new List<GroupTempModel>();
var groups = ApplicationDomainEx.PlayerInfos.Where(p => !string.IsNullOrWhiteSpace(p.Group) && p.TeamInfoModel == this.SelectedTeamInfo).GroupBy(p => p.Group); var groups = ApplicationDomainEx.PlayerInfos.Where(p => !string.IsNullOrWhiteSpace(p.Group) && p.TeamInfoModel == this.SelectedTeamInfo).GroupBy(p => p.Group);
foreach (var group in groups) foreach (var group in groups)
...@@ -173,12 +183,14 @@ namespace VIZ.TVP.Golf.Module ...@@ -173,12 +183,14 @@ namespace VIZ.TVP.Golf.Module
model.Player1 = list[0]; model.Player1 = list[0];
model.Player2 = list[1]; model.Player2 = list[1];
model.PlayersDisplayName = $"{model.Player1.Name} / {model.Player2.Name}"; model.PlayersDisplayName = this.resourceService.GetGroupName(model.Player1.Name, model.Player2.Name);
groupInfos.Add(model); groupInfos.Add(model);
} }
this.GroupInfos = groupInfos; groupInfos.Sort(new GroupNameComparer());
this.GroupInfos = groupInfos.ToObservableCollection();
} }
} }
} }
...@@ -47,7 +47,17 @@ namespace VIZ.TVP.Golf.Module ...@@ -47,7 +47,17 @@ namespace VIZ.TVP.Golf.Module
/// <summary> /// <summary>
/// 实时数据服务 /// 实时数据服务
/// </summary> /// </summary>
private IRealDataService realDataService = new RealDataService(); protected IRealDataService realDataService = new RealDataService();
/// <summary>
/// 资源服务
/// </summary>
protected IResourceService resourceService = new ResourceService();
/// <summary>
/// 文件数据服务
/// </summary>
protected IFileDataService fileDataService = new FileDataService();
// =================================================================================== // ===================================================================================
// Property // Property
...@@ -128,7 +138,7 @@ namespace VIZ.TVP.Golf.Module ...@@ -128,7 +138,7 @@ namespace VIZ.TVP.Golf.Module
/// </summary> /// </summary>
private void Refresh() private void Refresh()
{ {
List<string> files = this.realDataService.GetLocalDataFiles(ApplicationDomainEx.REMOTE_DATA_WORK_PATH); List<string> files = this.fileDataService.GetLocalDataFiles(ApplicationDomainEx.REMOTE_DATA_WORK_PATH);
if (files == null) if (files == null)
return; return;
......
...@@ -7,6 +7,8 @@ using System.Threading.Tasks; ...@@ -7,6 +7,8 @@ using System.Threading.Tasks;
using System.Web.UI.HtmlControls; using System.Web.UI.HtmlControls;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain; using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Service;
using VIZ.TVP.Golf.Service.Comparer;
namespace VIZ.TVP.Golf.Module namespace VIZ.TVP.Golf.Module
{ {
...@@ -114,7 +116,8 @@ namespace VIZ.TVP.Golf.Module ...@@ -114,7 +116,8 @@ namespace VIZ.TVP.Golf.Module
this.Name = this.SelectedTeamInfo.Name; this.Name = this.SelectedTeamInfo.Name;
this.Logo = this.SelectedTeamInfo.Logo; this.Logo = this.SelectedTeamInfo.Logo;
var query = ApplicationDomainEx.PlayerInfos.Where(p => p.TeamID == this.SelectedTeamInfo.TeamID); var query = ApplicationDomainEx.PlayerInfos.Where(p => p.TeamID == this.SelectedTeamInfo.TeamID).ToList();
query.Sort(new PlayerGroupNameComparer());
ObservableCollection<PlayerTempModel> models = new ObservableCollection<PlayerTempModel>(); ObservableCollection<PlayerTempModel> models = new ObservableCollection<PlayerTempModel>();
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.TVP.Golf.Domain;
namespace VIZ.TVP.Golf.Service
{
/// <summary>
/// 分组名字排名
/// </summary>
public class GroupNameComparer : IComparer<GroupTempModel>
{
/// <summary>
/// 比较
/// </summary>
public virtual int Compare(GroupTempModel x, GroupTempModel y)
{
if (x == null && y == null)
return 0;
if (x != null && y == null)
return -1;
if (x == null && y != null)
return 1;
if (string.IsNullOrWhiteSpace(x.Group) && string.IsNullOrWhiteSpace(y.Group))
return 0;
if (!string.IsNullOrWhiteSpace(x.Group) && string.IsNullOrWhiteSpace(y.Group))
return -1;
if (string.IsNullOrWhiteSpace(x.Group) && !string.IsNullOrWhiteSpace(y.Group))
return 1;
int x_group = 0;
int y_group = 0;
int.TryParse(x.Group, out x_group);
int.TryParse(y.Group, out y_group);
if (x_group == y_group)
return 0;
if (x_group < y_group)
return -1;
if (x_group > y_group)
return 1;
return 0;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.TVP.Golf.Domain;
namespace VIZ.TVP.Golf.Service.Comparer
{
/// <summary>
/// 球员分组姓名比较器
/// </summary>
public class PlayerGroupNameComparer : IComparer<PlayerInfoModel>
{
/// <summary>
/// 比较
/// </summary>
public virtual int Compare(PlayerInfoModel x, PlayerInfoModel y)
{
if (x == null && y == null)
return 0;
if (x != null && y == null)
return -1;
if (x == null && y != null)
return 1;
if (string.IsNullOrWhiteSpace(x.Group) && string.IsNullOrWhiteSpace(y.Group))
return 0;
if (!string.IsNullOrWhiteSpace(x.Group) && string.IsNullOrWhiteSpace(y.Group))
return -1;
if (string.IsNullOrWhiteSpace(x.Group) && !string.IsNullOrWhiteSpace(y.Group))
return 1;
int x_group = 0;
int y_group = 0;
int.TryParse(x.Group, out x_group);
int.TryParse(y.Group, out y_group);
if (x_group == y_group)
return 0;
if (x_group < y_group)
return -1;
if (x_group > y_group)
return 1;
return 0;
}
}
}
\ No newline at end of file
using log4net;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Service
{
/// <summary>
/// 文件数据服务
/// </summary>
public class FileDataService : IFileDataService
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(FileDataService));
/// <summary>
/// 文件锁对象
/// </summary>
private readonly object file_lock_object = new object();
/// <summary>
/// 加载球员数据
/// </summary>
/// <param name="fileName">文件名</param>
/// <returns>球员实时数据</returns>
public List<PlayerRealModel> LoadPlayerRealModelFormLocal(string fileName)
{
try
{
string path = Path.Combine(ApplicationDomainEx.REMOTE_DATA_WORK_PATH, fileName);
if (!File.Exists(path))
return null;
lock (this.file_lock_object)
{
using (StreamReader sr = new StreamReader(path))
{
XElement root = XElement.Load(sr);
TournamentNode node = new TournamentNode();
node.FromXElement(root);
List<PlayerRealModel> list = new List<PlayerRealModel>();
foreach (PlayerNode player in node.Players)
{
PlayerRealModel model = new PlayerRealModel();
model.FromNode(player);
model.PlayerInfoModel = ApplicationDomainEx.PlayerInfos.FirstOrDefault(p => p.PlayerID == model.Node.id);
if (model.PlayerInfoModel != null)
{
model.TeamInfoModel = ApplicationDomainEx.TeamInfos.FirstOrDefault(p => p.TeamID == model.PlayerInfoModel.TeamID);
}
list.Add(model);
}
return list;
}
}
}
catch (Exception ex)
{
log.Error(ex);
return null;
}
}
/// <summary>
/// 下载数据
/// </summary>
/// <param name="url">接口地址</param>
/// <returns>球员实时数据</returns>
public string DownLoadData(string url)
{
try
{
if (!Directory.Exists(ApplicationDomainEx.REMOTE_DATA_WORK_PATH))
{
Directory.CreateDirectory(ApplicationDomainEx.REMOTE_DATA_WORK_PATH);
}
string path = Path.Combine(ApplicationDomainEx.REMOTE_DATA_WORK_PATH, $"{DateTime.Now.ToString("yyyy_MM_dd__HH_mm_ss")}.xml");
// 获取xml
string xml = HttpHelper.Get(url, null);
if (string.IsNullOrWhiteSpace(xml))
return null;
// 保存文件
lock (this.file_lock_object)
{
using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
{
byte[] buffer = Encoding.UTF8.GetBytes(xml);
fs.Write(buffer, 0, buffer.Length);
}
}
return Path.GetFileName(path);
}
catch (Exception ex)
{
log.Error(ex);
return null;
}
}
/// <summary>
/// 获取本地数据集合
/// </summary>
/// <param name="dir">工作文件夹</param>
/// <returns>本地数据文件名</returns>
public List<string> GetLocalDataFiles(string dir)
{
string[] files = Directory.GetFiles(dir, "*.xml");
return files.ToList();
}
}
}
...@@ -25,150 +25,6 @@ namespace VIZ.TVP.Golf.Service ...@@ -25,150 +25,6 @@ namespace VIZ.TVP.Golf.Service
private readonly static ILog log = LogManager.GetLogger(typeof(RealDataService)); private readonly static ILog log = LogManager.GetLogger(typeof(RealDataService));
/// <summary> /// <summary>
/// 文件锁对象
/// </summary>
private readonly object file_lock_object = new object();
/// <summary>
/// 加载球员数据
/// </summary>
/// <param name="fileName">文件名</param>
/// <returns>球员实时数据</returns>
public List<PlayerRealModel> LoadPlayerRealModelFormLocal(string fileName)
{
try
{
string path = Path.Combine(ApplicationDomainEx.REMOTE_DATA_WORK_PATH, fileName);
if (!File.Exists(path))
return null;
lock (this.file_lock_object)
{
using (StreamReader sr = new StreamReader(path))
{
XElement root = XElement.Load(sr);
TournamentNode node = new TournamentNode();
node.FromXElement(root);
List<PlayerRealModel> list = new List<PlayerRealModel>();
foreach (PlayerNode player in node.Players)
{
PlayerRealModel model = new PlayerRealModel();
model.FromNode(player);
model.PlayerInfoModel = ApplicationDomainEx.PlayerInfos.FirstOrDefault(p => p.PlayerID == model.Node.id);
if (model.PlayerInfoModel != null)
{
model.TeamInfoModel = ApplicationDomainEx.TeamInfos.FirstOrDefault(p => p.TeamID == model.PlayerInfoModel.TeamID);
}
list.Add(model);
}
return list;
}
}
}
catch (Exception ex)
{
log.Error(ex);
return null;
}
}
/// <summary>
/// 下载数据
/// </summary>
/// <param name="url">接口地址</param>
/// <returns>球员实时数据</returns>
public string DownLoadData(string url)
{
try
{
if (!Directory.Exists(ApplicationDomainEx.REMOTE_DATA_WORK_PATH))
{
Directory.CreateDirectory(ApplicationDomainEx.REMOTE_DATA_WORK_PATH);
}
string path = Path.Combine(ApplicationDomainEx.REMOTE_DATA_WORK_PATH, $"{DateTime.Now.ToString("yyyy_MM_dd__HH_mm_ss")}.xml");
// 获取xml
string xml = HttpHelper.Get(url, null);
if (string.IsNullOrWhiteSpace(xml))
return null;
// 保存文件
lock (this.file_lock_object)
{
using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
{
byte[] buffer = Encoding.UTF8.GetBytes(xml);
fs.Write(buffer, 0, buffer.Length);
}
}
return Path.GetFileName(path);
}
catch (Exception ex)
{
log.Error(ex);
return null;
}
}
/// <summary>
/// 获取本地数据集合
/// </summary>
/// <param name="dir">工作文件夹</param>
/// <returns>本地数据文件名</returns>
public List<string> GetLocalDataFiles(string dir)
{
string[] files = Directory.GetFiles(dir, "*.xml");
return files.ToList();
}
/// <summary>
/// 获取得分字符串
/// </summary>
/// <param name="score">得分</param>
/// <returns>得分字符串</returns>
public string GetScoreString(int? score)
{
if (score == null)
return null;
return score.Value == 0 ? "E" : (score.Value > 0 ? $"+{score.Value}" : $"{score.Value}");
}
/// <summary>
/// 获取图片名字
/// </summary>
/// <param name="path">图片路径</param>
/// <returns>图片资源名字</returns>
public string GetImageName(string path)
{
return "IMAGE*/MyTestProject/Images/1";
}
/// <summary>
/// 获取分组名字
/// </summary>
/// <param name="name1">名字1</param>
/// <param name="name2">名字2</param>
/// <returns>分组名字</returns>
public string GetGroupName(string name1, string name2)
{
return $"{name1}\\{name2}";
}
/// <summary>
/// 获取队伍每轮得分 /// 获取队伍每轮得分
/// </summary> /// </summary>
/// <param name="players">球员集合</param> /// <param name="players">球员集合</param>
...@@ -391,6 +247,7 @@ namespace VIZ.TVP.Golf.Service ...@@ -391,6 +247,7 @@ namespace VIZ.TVP.Golf.Service
if (i == 0) if (i == 0)
{ {
teams[i].PositionValue = position;
teams[i].Position = position.ToString(); teams[i].Position = position.ToString();
continue; continue;
} }
...@@ -399,8 +256,13 @@ namespace VIZ.TVP.Golf.Service ...@@ -399,8 +256,13 @@ namespace VIZ.TVP.Golf.Service
if (teams[i].TotalScoreValue != teams[i - 1].TotalScoreValue) if (teams[i].TotalScoreValue != teams[i - 1].TotalScoreValue)
{ {
teams[i].PositionValue = position;
teams[i].Position = $"{position}"; teams[i].Position = $"{position}";
} }
else
{
teams[i].PositionValue = teams[i - 1].PositionValue;
}
} }
} }
...@@ -438,6 +300,7 @@ namespace VIZ.TVP.Golf.Service ...@@ -438,6 +300,7 @@ namespace VIZ.TVP.Golf.Service
if (i == 0) if (i == 0)
{ {
groups[i].PositionValue = position;
groups[i].Position = position.ToString(); groups[i].Position = position.ToString();
continue; continue;
} }
...@@ -446,8 +309,13 @@ namespace VIZ.TVP.Golf.Service ...@@ -446,8 +309,13 @@ namespace VIZ.TVP.Golf.Service
if (groups[i].PlayerScoreValue != groups[i - 1].PlayerScoreValue) if (groups[i].PlayerScoreValue != groups[i - 1].PlayerScoreValue)
{ {
groups[i].PositionValue = position;
groups[i].Position = $"{position}"; groups[i].Position = $"{position}";
} }
else
{
groups[i].PositionValue = groups[i - 1].PositionValue;
}
} }
} }
...@@ -469,5 +337,7 @@ namespace VIZ.TVP.Golf.Service ...@@ -469,5 +337,7 @@ namespace VIZ.TVP.Golf.Service
after_group.PositionChangedDesc = $"{after_group.PositionOldIndex} --> {after_group.PositionNewIndex}"; after_group.PositionChangedDesc = $"{after_group.PositionOldIndex} --> {after_group.PositionNewIndex}";
} }
} }
} }
} }
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Golf.Service
{
/// <summary>
/// 资源服务
/// </summary>
public class ResourceService : IResourceService
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(ResourceService));
/// <summary>
/// 获取得分字符串
/// </summary>
/// <param name="score">得分</param>
/// <returns>得分字符串</returns>
public string GetScoreString(int? score)
{
if (score == null)
return null;
return score.Value == 0 ? "E" : (score.Value > 0 ? $"+{score.Value}" : $"{score.Value}");
}
/// <summary>
/// 获取图片名字
/// </summary>
/// <param name="path">图片路径</param>
/// <returns>图片资源名字</returns>
public string GetImageName(string path)
{
return "IMAGE*/MyTestProject/Images/1";
}
/// <summary>
/// 获取分组名字
/// </summary>
/// <param name="name1">名字1</param>
/// <param name="name2">名字2</param>
/// <returns>分组名字</returns>
public string GetGroupName(string name1, string name2)
{
return $"{name1}\\{name2}";
}
/// <summary>
/// 获取To Par 背景图标值
/// </summary>
/// <param name="score">得分</param>
/// <returns>背景图标值</returns>
public string GetToParBgIconValue(int score)
{
// 0 -- 平标准杆 E
// 1 -- Bogey 高于标准杆1杆 +1
// 2 -- Birdie 低于标准杆1杆 -1
// 3 -- Eagle or Better -2 ...
// 4 -- D.bogey +2
// 5 -- T.bogey + +3 ...
if (score == 0)
return "0";
if (score == -1)
return "2";
if (score <= -2)
return "3";
if (score == 1)
return "1";
if (score == 2)
return "4";
if (score >= 3)
return "5";
return "0";
}
}
}
using NPOI.SS.Formula.Functions;
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;
namespace VIZ.TVP.Golf.Service
{
/// <summary>
/// 临时模型服务
/// </summary>
public class TempModelService : ITempModelService
{
/// <summary>
/// 真实数据服务
/// </summary>
private IRealDataService realDataService = new RealDataService();
/// <summary>
/// 资源服务
/// </summary>
private IResourceService resourceService = new ResourceService();
/// <summary>
/// 获取队伍临时模型集合
/// </summary>
/// <param name="list">球员真实模型</param>
/// <returns>队伍临时模型集合</returns>
public List<TeamTempModel> GetShortTeamTempModels(List<PlayerRealModel> list, int round)
{
if (round == 1)
{
return this.GetShortTeamTempModels_Round1(list);
}
if (round == 2)
{
return this.GetShortTeamTempModels_Round2(list);
}
return null;
}
/// <summary>
/// 获取分组排名
/// </summary>
/// <param name="list">球员真实模型</param>
/// <param name="round">轮次</param>
/// <returns>组临时模型集合</returns>
public List<GroupTempModel> GetShortGroupTempModels(List<PlayerRealModel> list, int round)
{
List<GroupTempModel> groupTempModels = new List<GroupTempModel>();
IEnumerable<IGrouping<string, PlayerInfoModel>> groups = null;
if (round == 1)
{
groups = ApplicationDomainEx.PlayerInfos.Where(p => !string.IsNullOrWhiteSpace(p.Group_First)).GroupBy(p => p.Group_First);
}
else
{
groups = ApplicationDomainEx.PlayerInfos.Where(p => !string.IsNullOrWhiteSpace(p.Group)).GroupBy(p => p.Group);
}
foreach (var group in groups)
{
foreach (var team_group in group.GroupBy(p => p.TeamID))
{
PlayerRealModel player1 = null;
PlayerRealModel player2 = null;
List<PlayerInfoModel> players = team_group.ToList();
GroupTempModel temp_model = new GroupTempModel();
temp_model.Group = group.Key;
temp_model.TeamInfo = ApplicationDomainEx.TeamInfos.FirstOrDefault(p => p.TeamID == team_group.Key);
temp_model.TeamLogo = temp_model.TeamInfo?.Logo;
if (players.Count > 0)
{
player1 = list.FirstOrDefault(p => p.PlayerID == players[0].PlayerID);
temp_model.Player1 = players[0];
}
if (players.Count > 1)
{
player2 = list.FirstOrDefault(p => p.PlayerID == players[1].PlayerID);
temp_model.Player2 = players[1];
}
temp_model.PlayersDisplayName = this.resourceService.GetGroupName(temp_model.Player1?.Name, temp_model.Player2?.Name);
Dictionary<int, GroupHoleStatisticsData> dic = this.realDataService.GetGroupHoleStatisticsDataDic(group.Key, player1, player2, round);
int score = dic.Values.Sum(p => p.Score);
temp_model.PlayersScore = this.resourceService.GetScoreString(score);
temp_model.PlayerScoreValue = score;
foreach (HoleInfoModel hole in ApplicationDomainEx.HoleInfos)
{
dic.TryGetValue(hole.HoleID, out GroupHoleStatisticsData data);
GroupHoleTempModel temp_hole = new GroupHoleTempModel();
temp_hole.HoleID = hole.HoleID.ToString();
temp_hole.Par = hole.Par;
temp_hole.TotalScore = this.resourceService.GetScoreString(data?.Score);
temp_hole.TotalStrokes = data?.Strokes.ToString();
temp_model.GroupHoleTempModels.Add(temp_hole);
}
groupTempModels.Add(temp_model);
}
}
// 排序
GroupTempModelComparer comparer = new GroupTempModelComparer(list, round);
groupTempModels.Sort(comparer);
this.realDataService.UpdateGroupPosition(groupTempModels);
return groupTempModels;
}
/// <summary>
/// 获取队伍排名临时模型集合 第一轮
/// </summary>
/// <param name="list">球员真实数据</param>
/// <returns>队伍模型临时排名</returns>
private List<TeamTempModel> GetShortTeamTempModels_Round1(List<PlayerRealModel> list)
{
List<TeamTempModel> teamTempModels = new List<TeamTempModel>();
foreach (TeamInfoModel info_model in ApplicationDomainEx.TeamInfos)
{
TeamTempModel temp_model = new TeamTempModel();
temp_model.FromInfoModel(info_model);
TeamRoundStatisticsData data = this.realDataService.GetTeamRoundStatisticsData(list, info_model.TeamID, 1);
if (data != null)
{
temp_model.TotalScoreValue = data.Score;
temp_model.TotalScore = this.resourceService.GetScoreString(data.Score);
}
teamTempModels.Add(temp_model);
}
// 赛前比较第一轮
TeamTempModelComparer comparer = new TeamTempModelComparer(list);
teamTempModels.Sort(comparer);
this.realDataService.UpdateTeamPosition(teamTempModels);
return teamTempModels;
}
/// <summary>
/// 获取队伍排名临时模型集合 第二轮
/// </summary>
/// <param name="list">球员真实数据</param>
/// <returns>队伍模型临时排名</returns>
private List<TeamTempModel> GetShortTeamTempModels_Round2(List<PlayerRealModel> list)
{
List<TeamTempModel> teamTempModels = new List<TeamTempModel>();
foreach (TeamInfoModel info_model in ApplicationDomainEx.TeamInfos)
{
TeamTempModel temp_model = new TeamTempModel();
temp_model.FromInfoModel(info_model);
TeamRoundStatisticsData data1 = this.realDataService.GetTeamRoundStatisticsData(list, info_model.TeamID, 1);
TeamRoundStatisticsData data2 = this.realDataService.GetTeamRoundStatisticsData(list, info_model.TeamID, 2);
temp_model.TotalScoreValue = data1?.Score + data2?.Score;
temp_model.TotalScore = temp_model.TotalScoreValue == null ? null : this.resourceService.GetScoreString(temp_model.TotalScoreValue);
teamTempModels.Add(temp_model);
}
// 赛前比较第一轮
TeamTempModelComparer comparer = new TeamTempModelComparer(list);
teamTempModels.Sort(comparer);
this.realDataService.UpdateTeamPosition(teamTempModels);
return teamTempModels;
}
}
}
\ No newline at end of file
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Service
{
/// <summary>
/// 文件数据服务
/// </summary>
public interface IFileDataService
{
/// <summary>
/// 加载球员数据
/// </summary>
/// <param name="fileName">文件名</param>
/// <returns>球员实时数据</returns>
List<PlayerRealModel> LoadPlayerRealModelFormLocal(string fileName);
/// <summary>
/// 下载数据
/// </summary>
/// <param name="url">接口地址</param>
/// <returns>球员实时数据</returns>
string DownLoadData(string url);
/// <summary>
/// 获取本地数据集合
/// </summary>
/// <param name="dir">工作文件夹</param>
/// <returns>本地数据文件名</returns>
List<string> GetLocalDataFiles(string dir);
}
}
...@@ -16,50 +16,6 @@ namespace VIZ.TVP.Golf.Service ...@@ -16,50 +16,6 @@ namespace VIZ.TVP.Golf.Service
/// </summary> /// </summary>
public interface IRealDataService public interface IRealDataService
{ {
/// <summary>
/// 加载球员数据
/// </summary>
/// <param name="fileName">文件名</param>
/// <returns>球员实时数据</returns>
List<PlayerRealModel> LoadPlayerRealModelFormLocal(string fileName);
/// <summary>
/// 下载数据
/// </summary>
/// <param name="url">接口地址</param>
/// <returns>最新的文件名</returns>
string DownLoadData(string url);
/// <summary>
/// 获取本地数据集合
/// </summary>
/// <param name="dir">工作文件夹</param>
/// <returns>本地数据文件名</returns>
List<string> GetLocalDataFiles(string dir);
/// <summary>
/// 获取得分字符串
/// </summary>
/// <param name="score">得分</param>
/// <returns>得分字符串</returns>
string GetScoreString(int? score);
/// <summary>
/// 获取分组名字
/// </summary>
/// <param name="name1">名字1</param>
/// <param name="name2">名字2</param>
/// <returns>分组名字</returns>
string GetGroupName(string name1, string name2);
/// <summary>
/// 获取图片名字
/// </summary>
/// <param name="path">图片路径</param>
/// <returns>图片资源名字</returns>
string GetImageName(string path);
/// <summary> /// <summary>
/// 获取分组每轮得分 /// 获取分组每轮得分
/// </summary> /// </summary>
......
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Golf.Service
{
/// <summary>
/// 资源服务
/// </summary>
public interface IResourceService
{
/// <summary>
/// 获取得分字符串
/// </summary>
/// <param name="score">得分</param>
/// <returns>得分字符串</returns>
string GetScoreString(int? score);
/// <summary>
/// 获取图片名字
/// </summary>
/// <param name="path">图片路径</param>
/// <returns>图片资源名字</returns>
string GetImageName(string path);
/// <summary>
/// 获取分组名字
/// </summary>
/// <param name="name1">名字1</param>
/// <param name="name2">名字2</param>
/// <returns>分组名字</returns>
string GetGroupName(string name1, string name2);
/// <summary>
/// 获取To Par 背景图标值
/// </summary>
/// <param name="score">得分</param>
/// <returns>背景图标值</returns>
string GetToParBgIconValue(int score);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.TVP.Golf.Domain;
namespace VIZ.TVP.Golf.Service
{
/// <summary>
/// 临时模型服务
/// </summary>
public interface ITempModelService
{
/// <summary>
/// 获取队伍临时模型集合
/// </summary>
/// <param name="list">球员真实模型</param>
/// <returns>队伍临时模型集合</returns>
List<TeamTempModel> GetShortTeamTempModels(List<PlayerRealModel> list, int round);
/// <summary>
/// 获取分组排名
/// </summary>
/// <param name="list">球员真实模型</param>
/// <param name="round">轮次</param>
/// <returns>组临时模型集合</returns>
List<GroupTempModel> GetShortGroupTempModels(List<PlayerRealModel> list, int round);
}
}
...@@ -71,15 +71,23 @@ ...@@ -71,15 +71,23 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Comparer\GroupNameComparer.cs" />
<Compile Include="Comparer\GroupTempModelComparer.cs" /> <Compile Include="Comparer\GroupTempModelComparer.cs" />
<Compile Include="Comparer\PlayerGroupNameComparer.cs" />
<Compile Include="Comparer\TeamTempModelComparer.cs" /> <Compile Include="Comparer\TeamTempModelComparer.cs" />
<Compile Include="Excel\Implementation\ExcelService.cs" /> <Compile Include="Excel\Implementation\ExcelService.cs" />
<Compile Include="Excel\Interface\IExcelService.cs" /> <Compile Include="Excel\Interface\IExcelService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RealData\Implementation\FileDataService.cs" />
<Compile Include="RealData\Implementation\RealDataService.cs" /> <Compile Include="RealData\Implementation\RealDataService.cs" />
<Compile Include="RealData\Implementation\ResourceService.cs" />
<Compile Include="RealData\Implementation\TempModelService.cs" />
<Compile Include="RealData\Info\GroupHoleStatisticsData.cs" /> <Compile Include="RealData\Info\GroupHoleStatisticsData.cs" />
<Compile Include="RealData\Info\TeamRoundStatisticsData.cs" /> <Compile Include="RealData\Info\TeamRoundStatisticsData.cs" />
<Compile Include="RealData\Interface\IFileDataService.cs" />
<Compile Include="RealData\Interface\IRealDataService.cs" /> <Compile Include="RealData\Interface\IRealDataService.cs" />
<Compile Include="RealData\Interface\IResourceService.cs" />
<Compile Include="RealData\Interface\ITempModelService.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
......
...@@ -5,6 +5,7 @@ VisualStudioVersion = 17.3.32825.248 ...@@ -5,6 +5,7 @@ VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00-Doc", "00-Doc", "{CAE00ECF-BA01-4461-AE78-617D2977BEA0}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00-Doc", "00-Doc", "{CAE00ECF-BA01-4461-AE78-617D2977BEA0}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
xml_test.xml = xml_test.xml
高尔夫球数据获取api.xml = 高尔夫球数据获取api.xml 高尔夫球数据获取api.xml = 高尔夫球数据获取api.xml
高尔夫球数据获取_test.xml = 高尔夫球数据获取_test.xml 高尔夫球数据获取_test.xml = 高尔夫球数据获取_test.xml
EndProjectSection EndProjectSection
......
<?xml version="1.0"?>
<entry>
<element description="">
<entry name="data">
<entry name="FLAG">IMAGE*/MyTestProject/Scenes/DBDX</entry>
<entry name="NUMBER">53</entry>
<entry name="PLAYER">陈树新\林建武</entry>
</entry>
</element>
<element description="">
<entry name="data">
<entry name="FLAG">IMAGE*/MyTestProject/Scenes/DBDX</entry>
<entry name="NUMBER">53</entry>
<entry name="PLAYER">陈树新\林建武</entry>
</entry>
</element>
</entry>
\ 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