Commit 0e27a4ec by liulongfei

部分版子

parent 1cc292a5
......@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Framework.Domain;
using VIZ.TVP.Golf.Storage;
......@@ -44,5 +45,10 @@ namespace VIZ.TVP.Golf.Domain
/// LiteDB数据库
/// </summary>
public static LiteDBContext LiteDBContext { get; set; }
/// <summary>
/// VIZ引擎
/// </summary>
public static VizEngineModel VizEngineModel { get; set; }
}
}
......@@ -45,6 +45,11 @@ namespace VIZ.TVP.Golf.Domain
public const string GroupInfo = "GroupInfo";
/// <summary>
/// 单队伍分组信息
/// </summary>
public const string GroupInfoSingle = "GroupInfoSingle";
/// <summary>
/// 分组具体洞信息
/// </summary>
public const string GroupInfoWithHole = "GroupInfoWithHole";
......
......@@ -40,6 +40,20 @@ namespace VIZ.TVP.Golf.Domain
#endregion
#region Group -- 所属分组
private string group;
/// <summary>
/// 所属分组
/// </summary>
public string Group
{
get { return group; }
set { group = value; this.RaisePropertyChanged(nameof(Group)); }
}
#endregion
#region IsCaptain -- 是否是队长
private bool isCaptain;
......@@ -78,6 +92,7 @@ namespace VIZ.TVP.Golf.Domain
this.Name = model.Name;
this.HalfPicture = model.HalfPicture;
this.IsCaptain = model.IsCaptain;
this.Group = model.Group;
}
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="CheckBox_VizConnection" TargetType="CheckBox">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid>
<Ellipse x:Name="e1" Width="16" Height="16" Fill="Red" Visibility="Visible"></Ellipse>
<Ellipse x:Name="e2" Width="16" Height="16" Fill="Green" Visibility="Collapsed"></Ellipse>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="e1" Property="Visibility" Value="Collapsed"></Setter>
<Setter TargetName="e2" Property="Visibility" Value="Visible"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -72,6 +72,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Style\CheckBox\CheckBox_Default.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Style\IconButton\IconButton_Default.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......
......@@ -15,6 +15,7 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/RadioButton/RadioButton_MainView.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/CheckBox/CheckBox_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
......@@ -58,7 +59,7 @@
Content="队伍信息"></RadioButton>
<RadioButton x:Name="rb_GroupInfo" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="小组信息"></RadioButton>
<RadioButton x:Name="rb_GroupInfoWithHole" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
<RadioButton x:Name="rb_GroupInfoSingle" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="赛中小组数据"></RadioButton>
<RadioButton x:Name="rb_Champion" GroupName="MAIN" Style="{StaticResource RadioButton_MainView}"
Content="冠军版"></RadioButton>
......@@ -108,8 +109,8 @@
IsSelected="{Binding ElementName=rb_TeamInfo,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.GroupInfo}" ViewType="{x:Type local:GroupInfoView}"
IsSelected="{Binding ElementName=rb_GroupInfo,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.GroupInfoWithHole}" ViewType="{x:Type local:GroupInfoWithHoleView}"
IsSelected="{Binding ElementName=rb_GroupInfoWithHole,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.GroupInfoSingle}" ViewType="{x:Type local:GroupInfoSingleView}"
IsSelected="{Binding ElementName=rb_GroupInfoSingle,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.Champion}" ViewType="{x:Type local:ChampionView}"
IsSelected="{Binding ElementName=rb_Champion,Path=IsChecked,Mode=OneWay}"></fcommon:NavigationItemControl>
<fcommon:NavigationItemControl Key="{x:Static Member=domain:ViewKeys.GroupHoleInfo}" ViewType="{x:Type local:GroupHoleInfoView}"
......@@ -140,48 +141,28 @@
<!-- VIZ 连接 -->
<Border Padding="5" Margin="5" BorderBrush="#44000000" BorderThickness="1" Grid.Row="1">
<Grid HorizontalAlignment="Left" Width="700">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 主库 -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 主库IP -->
<TextBlock Text="主库IP:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="127.0.0.1" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="1"></TextBlock>
<!-- 主库端口 -->
<TextBlock Text="主库端口:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Grid.Column="2"></TextBlock>
<TextBlock Text="6100" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="3"></TextBlock>
<!-- 主库连接按钮 -->
<Button Grid.Column="4" Height="20" Width="80" Content="连接"></Button>
</Grid>
<!-- 备库 -->
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 备库IP -->
<TextBlock Text="备库IP:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="127.0.0.1" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="1"></TextBlock>
<!-- 备库端口 -->
<TextBlock Text="备库端口:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Grid.Column="2"></TextBlock>
<TextBlock Text="6100" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="3"></TextBlock>
<StackPanel Orientation="Horizontal" Margin="0,0,5,0" HorizontalAlignment="Right">
<CheckBox Style="{StaticResource CheckBox_VizConnection}" IsChecked="{Binding Path=VizEngineModel.IsConnected}"
IsHitTestVisible="False"></CheckBox>
<ComboBox Height="20" Width="200" Margin="10,0,0,0"
ItemsSource="{Binding Path=VizConnections}"
SelectedValue="{Binding Path=SelectedVizConnection,Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Text="{Binding Path=IP}"></TextBlock>
<TextBlock VerticalAlignment="Center" Text=":" Margin="5,0,5,0"></TextBlock>
<TextBlock VerticalAlignment="Center" Text="{Binding Path=Port}"></TextBlock>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- 主库连接按钮 -->
<Button Grid.Column="4" Height="20" Width="80" Content="连接"></Button>
</Grid>
</Grid>
<Button Grid.Column="4" Height="20" Width="80" Content="连接" Margin="10,0,0,0"
Command="{Binding Path=ConnectCommand}"
IsEnabled="{Binding Path=IsConnectButtonEnabled}"></Button>
</StackPanel>
</Border>
</Grid>
</UserControl>
......@@ -5,9 +5,11 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Common;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Module
{
......@@ -18,7 +20,151 @@ namespace VIZ.TVP.Golf.Module
{
public MainViewModel()
{
// 初始化属性
this.InitProperty();
// 初始化命令
this.InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.ConnectCommand = new VCommand(this.Connect);
this.DisconnectCommand = new VCommand(this.Disconnect);
}
/// <summary>
/// 初始化属性
/// </summary>
private void InitProperty()
{
ObservableCollection<VizEngineConnectionItem> items = new ObservableCollection<VizEngineConnectionItem>();
string ip1 = ApplicationDomainEx.IniStorage.GetValue<ClientConfig, string>(p => p.CLIENT_VIZ_IP);
int port1 = ApplicationDomainEx.IniStorage.GetValue<ClientConfig, int>(p => p.CLIENT_VIZ_PORT);
items.Add(new VizEngineConnectionItem(ip1, port1));
string ip2 = ApplicationDomainEx.IniStorage.GetValue<ClientConfig, string>(p => p.CLIENT_VIZ_IP_STANDBY);
int port2 = ApplicationDomainEx.IniStorage.GetValue<ClientConfig, int>(p => p.CLIENT_VIZ_PORT_STANDBY);
items.Add(new VizEngineConnectionItem(ip2, port2));
this.VizConnections = items;
this.SelectedVizConnection = items[0];
}
// ===================================================================================
// Property
// ===================================================================================
#region IsConnectButtonEnabled -- 连接按钮是否可用
private bool isConnectButtonEnabled = true;
/// <summary>
/// 连接按钮是否可用
/// </summary>
public bool IsConnectButtonEnabled
{
get { return isConnectButtonEnabled; }
set { isConnectButtonEnabled = value; this.RaisePropertySaveChanged(nameof(IsConnectButtonEnabled)); }
}
#endregion
#region VizConnections -- VIZ 连接集合
private ObservableCollection<VizEngineConnectionItem> vizConnections;
/// <summary>
/// VIZ 连接集合
/// </summary>
public ObservableCollection<VizEngineConnectionItem> VizConnections
{
get { return vizConnections; }
set { vizConnections = value; }
}
#endregion
#region SelectedVizConnection -- 当前选中的VIZ连接
private VizEngineConnectionItem selectedVizConnection;
/// <summary>
/// 当前选中的VIZ连接
/// </summary>
public VizEngineConnectionItem SelectedVizConnection
{
get { return selectedVizConnection; }
set { selectedVizConnection = value; this.RaisePropertyChanged(nameof(SelectedVizConnection)); }
}
#endregion
#region VizEngineModel -- VIZ引擎模型
private VizEngineModel vizEngineModel = ApplicationDomainEx.VizEngineModel;
/// <summary>
/// VIZ引擎模型
/// </summary>
public VizEngineModel VizEngineModel
{
get { return vizEngineModel; }
set { vizEngineModel = value; this.RaisePropertyChanged(nameof(VizEngineModel)); }
}
#endregion
// ===================================================================================
// Command
// ===================================================================================
#region ConnectCommand -- 连接命令
/// <summary>
/// 连接命令
/// </summary>
public VCommand ConnectCommand { get; set; }
/// <summary>
/// 连接
/// </summary>
private void Connect()
{
this.IsConnectButtonEnabled = false;
Task.Run(() =>
{
bool result = ApplicationDomainEx.VizEngineModel.Connection(this.SelectedVizConnection.IP, this.SelectedVizConnection.Port);
if (!result)
{
MessageBox.Show($"连接 {this.SelectedVizConnection?.IP}:{this.SelectedVizConnection?.Port} 失败");
}
this.IsConnectButtonEnabled = true;
});
}
#endregion
#region DisconnectCommand -- 断开命令
/// <summary>
/// 断开命令
/// </summary>
public VCommand DisconnectCommand { get; set; }
/// <summary>
/// 断开连接
/// </summary>
private void Disconnect()
{
ApplicationDomainEx.VizEngineModel.Disconnect();
}
#endregion
}
}
......@@ -49,12 +49,12 @@ namespace VIZ.TVP.Golf.Module
// Command
// ===================================================================================
#region SendCommand -- 发送命令
#region StartCommand -- 开始命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
protected override void Start()
{
}
......
......@@ -58,12 +58,12 @@ namespace VIZ.TVP.Golf.Module
// Command
// ===================================================================================
#region SendCommand -- 发送命令
#region StartCommand -- 开始命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
protected override void Start()
{
}
......
......@@ -133,12 +133,12 @@ namespace VIZ.TVP.Golf.Module
// Command
// ===================================================================================
#region SendCommand -- 发送命令
#region StartCommand -- 开始命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
protected override void Start()
{
}
......
<UserControl x:Class="VIZ.TVP.Golf.Module.GroupInfoSingleView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VIZ.TVP.Golf.Module"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:domain="clr-namespace:VIZ.TVP.Golf.Domain;assembly=VIZ.TVP.Golf.Domain"
d:Background="White"
d:DataContext="{d:DesignInstance Type=local:GroupInfoSingleViewModel}"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1600">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Golf.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<core:String2ImageSourceConverter x:Key="String2ImageSourceConverter" Type="Relative" WorkPath="picture/player"></core:String2ImageSourceConverter>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="600"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 版子操作 -->
<Border Grid.Row="0" Grid.ColumnSpan="2" BorderBrush="#44000000" Background="#66b6f2e3" BorderThickness="1" Margin="5" Padding="5">
<StackPanel Orientation="Horizontal">
<fcommon:IconButton Style="{StaticResource IconButton_Default}"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/db_16x16.png"
Content="加载本地数据" Command="{Binding Path=LoadLocalDataCommand}"></fcommon:IconButton>
<fcommon:IconButton Style="{StaticResource IconButton_Default}" Margin="5,0,0,0"
IsEnabled="{Binding Path=IsLoadRemoteDataEnabled,Mode=OneWay}"
Icon="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png"
Content="刷新实时数据" Command="{Binding Path=LoadRemoteDataCommand}"></fcommon:IconButton>
</StackPanel>
</Border>
<!-- 版子信息 -->
<Border Grid.Row="1" Padding="5" BorderBrush="#44000000" BorderThickness="1" Margin="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="140"></RowDefinition>
<RowDefinition Height="220"></RowDefinition>
<RowDefinition Height="220"></RowDefinition>
</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>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<!-- 轮次 -->
<TextBlock Text="轮次:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0"></TextBlock>
<ComboBox Height="30" Width="240" VerticalContentAlignment="Center" Grid.Column="1" HorizontalAlignment="Left"
Margin="5,0,0,0"
SelectedValue="{Binding Path=SelectedRound,Mode=TwoWay}"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.Rounds}}"></ComboBox>
<!-- 洞号 -->
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="0" Margin="0,0,5,0" Orientation="Horizontal">
<Image Width="16" Height="16" Source="/VIZ.TVP.Golf.Module.Resource;component/Icons/refresh_16x16.png" Margin="0,0,5,0"></Image>
<TextBlock Text="洞号:" ></TextBlock>
</StackPanel>
<ComboBox Height="30" Width="240" VerticalContentAlignment="Center" Grid.Column="1" HorizontalAlignment="Left"
Margin="5,0,0,0" Grid.Row="1"
SelectedValue="{Binding Path=SelectedHoleInfo,Mode=TwoWay}" DisplayMemberPath="HoleID"
ItemsSource="{Binding Source={x:Static domain:ApplicationDomainEx.HoleInfos}}"></ComboBox>
</Grid>
</GroupBox>
<!-- 分组 -->
<GroupBox Grid.Row="1" Padding="10">
<GroupBox.Header>
<TextBlock Text="分组" FontSize="18" FontWeight="Bold"></TextBlock>
</GroupBox.Header>
<local:GroupPickerPanelNoPlayer DataContext="{Binding GroupPickerPanelModel}"></local:GroupPickerPanelNoPlayer>
</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/GroupInfo.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="上版子" Command="{Binding StartCommand}"></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="下版子" Command="{Binding StopCommand}"></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>
/// GroupInfoSingleView.xaml 的交互逻辑
/// </summary>
public partial class GroupInfoSingleView : UserControl
{
public GroupInfoSingleView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new GroupInfoSingleViewModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.WebSockets;
using System.Windows;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 包装视图模型 -- 小组信息
/// </summary>
public class GroupInfoSingleViewModel : PackageViewModelBase
{
public GroupInfoSingleViewModel()
{
}
// ===================================================================================
// Property
// ===================================================================================
#region SelectedRound -- 选中的轮次
private int selectedRound = 2;
/// <summary>
/// 选中的轮次
/// </summary>
public int SelectedRound
{
get { return selectedRound; }
set { selectedRound = value; this.RaisePropertyChanged(nameof(SelectedRound)); }
}
#endregion
#region SelectedHoleInfo -- 选中的洞信息
private HoleInfoModel selectedHoleInfo;
/// <summary>
/// 选中的洞信息
/// </summary>
public HoleInfoModel SelectedHoleInfo
{
get { return selectedHoleInfo; }
set { selectedHoleInfo = value; this.RaisePropertyChanged(nameof(SelectedHoleInfo)); }
}
#endregion
#region GroupPickerPanelModel -- 分组选择面板模型1
private GroupPickerPanelModel groupPickerPanelModel = new GroupPickerPanelModel();
/// <summary>
/// 分组选择面板模型1
/// </summary>
public GroupPickerPanelModel GroupPickerPanelModel
{
get { return groupPickerPanelModel; }
set { groupPickerPanelModel = value; this.RaisePropertyChanged(nameof(GroupPickerPanelModel)); }
}
#endregion
// ===================================================================================
// Command
// ===================================================================================
// ===================================================================================
// Command
// ===================================================================================
#region StartCommand -- 开始命令
/// <summary>
/// 执行发送命令
/// </summary>
/// <remarks>
/// format: hole_id|team_logo|player1_name|player2_name|score
/// </remarks>
protected override void Start()
{
StringBuilder sb = new StringBuilder();
sb.Append($"{this.SelectedHoleInfo?.HoleID}|{this.GroupPickerPanelModel.Name}|{this.GroupPickerPanelModel.Player1.Name}|{this.GroupPickerPanelModel.Player2.Name}|{this.GroupPickerPanelModel.PlayersScore}");
ApplicationDomainEx.VizEngineModel.STAGE_START("14-SZXXT", "OnSetData", sb.ToString());
}
#endregion
#region LoadLocalDataCommand -- 加载本地数据命令
/// <summary>
/// 加载本地数据
/// </summary>
protected override void LoadLocalData()
{
RealDataWindow window = new RealDataWindow();
window.ShowDialog();
RealDataViewModel vm = window.realDataView.DataContext as RealDataViewModel;
if (vm == null)
return;
if (!vm.IsEnter)
return;
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(vm.SelectedFile.FileName);
this.GroupPickerPanelModel.UpdatePlayersScore(list, this.SelectedRound);
// 预设洞号
int? holeId = this.realDataService.GetGroupCurrentHole(list, this.GroupPickerPanelModel.SelectedGroupInfo, this.SelectedRound);
this.SelectedHoleInfo = ApplicationDomainEx.HoleInfos.FirstOrDefault(p => p.HoleID == (holeId ?? -1));
}
#endregion
#region LoadRemoteDataCommand -- 加载远程数据命令
/// <summary>
/// 加载远程数据
/// </summary>
protected override void LoadRemoteData()
{
Task.Run(() =>
{
string fileName = this.realDataService.DownLoadData(INTERFACE_TOURNAMENT);
if (string.IsNullOrWhiteSpace(fileName))
{
MessageBox.Show("加载远程数据失败!");
return;
}
WPFHelper.BeginInvoke(() =>
{
List<PlayerRealModel> list = this.realDataService.LoadPlayerRealModelFormLocal(fileName);
});
});
}
#endregion
}
}
......@@ -97,12 +97,12 @@ namespace VIZ.TVP.Golf.Module
// Command
// ===================================================================================
#region SendCommand -- 发送命令
#region StartCommand -- 开始命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
protected override void Start()
{
}
......
......@@ -46,12 +46,12 @@ namespace VIZ.TVP.Golf.Module
// Command
// ===================================================================================
#region SendCommand -- 发送命令
#region StartCommand -- 开始命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
protected override void Start()
{
}
......
......@@ -46,30 +46,6 @@
<!-- 版子信息 -->
<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>
......
......@@ -46,30 +46,6 @@
<!-- 版子信息 -->
<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>
......
......@@ -53,12 +53,12 @@ namespace VIZ.TVP.Golf.Module
// Command
// ===================================================================================
#region SendCommand -- 发送命令
#region StartCommand -- 开始命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
protected override void Start()
{
}
......
......@@ -24,7 +24,8 @@ namespace VIZ.TVP.Golf.Module
public PackageViewModelBase()
{
this.SendCommand = new VCommand(this.Send);
this.StartCommand = new VCommand(this.Start);
this.StopCommand = new VCommand(this.Stop);
this.LoadLocalDataCommand = new VCommand(this.LoadLocalData);
this.LoadRemoteDataCommand = new VCommand(this.LoadRemoteDataShell);
}
......@@ -65,20 +66,38 @@ namespace VIZ.TVP.Golf.Module
// Command
// ===================================================================================
#region SendCommand -- 发送命令
#region StartCommand -- 开始命令
/// <summary>
/// 发送命令
/// 开始命令
/// </summary>
public VCommand SendCommand { get; set; }
public VCommand StartCommand { get; set; }
/// <summary>
/// 发送指令
/// 开始指令
/// </summary>
protected abstract void Send();
protected abstract void Start();
#endregion
#region StopCommand -- 停止命令
/// <summary>
/// 停止命令
/// </summary>
public VCommand StopCommand { get; set; }
/// <summary>
/// 停止
/// </summary>
protected virtual void Stop()
{
ApplicationDomainEx.VizEngineModel.Send(VizEngineCommands.STAGE_CONTINUE);
}
#endregion
#region LoadLocalDataCommand -- 加载本地数据命令
/// <summary>
......
......@@ -70,7 +70,10 @@
ItemsSource="{Binding Path=TeamPickerPanelModel.PlayerTempModels,Mode=OneWay}" FontSize="14"
SelectedValue="{Binding Path=SelectedPlayerTempModel,Mode=TwoWay}">
<DataGrid.Columns>
<DataGridTextColumn Header="姓名" Width="200" Binding="{Binding Path=Name,Mode=TwoWay}"></DataGridTextColumn>
<DataGridTextColumn Header="姓名" Width="120" Binding="{Binding Path=Name,Mode=TwoWay}"></DataGridTextColumn>
<DataGridComboBoxColumn Header="分组" Width="100"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.Groups}}"
SelectedValueBinding="{Binding Path=Group,Mode=TwoWay}"></DataGridComboBoxColumn>
<DataGridComboBoxColumn Header="照片" Width="200"
ItemsSource="{Binding Source={x:Static domain:TvpStaticResource.PlayerPictures}}"
SelectedValueBinding="{Binding Path=HalfPicture}"></DataGridComboBoxColumn>
......@@ -100,10 +103,12 @@
<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>
Content="上版子"
Command="{Binding StartCommand}"></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>
Content="下版子"
Command="{Binding Path=StopCommand}"></fcommon:IconButton>
</StackPanel>
</Grid>
</Border>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Markup;
using System.Windows.Navigation;
using VIZ.Framework.Core;
using VIZ.TVP.Golf.Domain;
......@@ -68,14 +71,42 @@ namespace VIZ.TVP.Golf.Module
// Command
// ===================================================================================
#region SendCommand -- 发送命令
#region StartCommand -- 开始命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
/// <remarks>
/// format: team_name|team_logo#group_name|player1_name|player1_logo|player2_name|player2_logo*
/// </remarks>
protected override void Start()
{
StringBuilder sb = new StringBuilder();
sb.Append($"{this.TeamPickerPanelModel.Name}|{this.TeamPickerPanelModel.Logo}#");
if (this.TeamPickerPanelModel.PlayerTempModels != null)
{
var groups = this.TeamPickerPanelModel.PlayerTempModels.Where(p => !string.IsNullOrWhiteSpace(p.Group)).GroupBy(p => p.Group).ToList();
for (int i = 0; i < groups.Count; i++)
{
var players = groups[i].ToList();
if (players.Count != 2)
continue;
string group_name = groups[i].Key;
string player1_name = players[0].Name;
string player1_logo = this.realDataService.GetImageName(players[0].HalfPicture);
string player2_name = players[1].Name;
string player2_logo = this.realDataService.GetImageName(players[1].HalfPicture);
sb.Append($"{group_name}|{player1_name}|{player1_logo}|{player2_name}|{player2_logo}");
if (i < groups.Count - 1)
{
sb.Append("*");
}
}
}
ApplicationDomainEx.VizEngineModel.STAGE_START("12-QDXX", "OnSetData", sb.ToString());
}
#endregion
......
......@@ -54,12 +54,12 @@ namespace VIZ.TVP.Golf.Module
// Command
// ===================================================================================
#region SendCommand -- 发送命令
#region StartCommand -- 开始命令
/// <summary>
/// 执行发送命令
/// </summary>
protected override void Send()
protected override void Start()
{
}
......
using log4net;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Framework.Module;
using VIZ.TVP.Golf.Domain;
using VIZ.TVP.Golf.Storage;
namespace VIZ.TVP.Golf.Module
{
/// <summary>
/// 应用程序启动 -- 初始化VIZ
/// </summary>
public class AppSetup_InitVIZ : AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private static ILog log = LogManager.GetLogger(typeof(AppSetup_InitVIZ));
/// <summary>
/// 描述
/// </summary>
public override string Detail { get; } = "应用程序启动 -- 初始化VIZ";
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public override bool Setup(AppSetupContext context)
{
ApplicationDomainEx.VizEngineModel = new VizEngineModel();
return true;
}
/// <summary>
/// 执行关闭
/// </summary>
/// <param name="context">应用程序启动上下文</param>
public override void Shutdown(AppSetupContext context)
{
ApplicationDomainEx.VizEngineModel?.Dispose();
}
}
}
\ No newline at end of file
......@@ -93,6 +93,10 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Page Include="Package\GroupInfo\View\GroupInfoSingleView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Package\GroupInfo\View\GroupInfoWithHoleView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......@@ -219,7 +223,11 @@
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Package\GroupInfo\ViewModel\GroupInfoSingleViewModel.cs" />
<Compile Include="Package\GroupInfo\ViewModel\GroupInfoWithHoleViewModel.cs" />
<Compile Include="Package\GroupInfo\View\GroupInfoSingleView.xaml.cs">
<DependentUpon>GroupInfoSingleView.xaml</DependentUpon>
</Compile>
<Compile Include="Package\GroupInfo\View\GroupInfoWithHoleView.xaml.cs">
<DependentUpon>GroupInfoWithHoleView.xaml</DependentUpon>
</Compile>
......@@ -271,6 +279,7 @@
<DependentUpon>TeamInfoView.xaml</DependentUpon>
</Compile>
<Compile Include="Package\TeamRanking\TeamRankingViewModelBase.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitVIZ.cs" />
<Compile Include="Widgets\Detail\DetailPanel.xaml.cs">
<DependentUpon>DetailPanel.xaml</DependentUpon>
</Compile>
......@@ -427,6 +436,8 @@
<Name>VIZ.TVP.Golf.Storage</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="Main\Model\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -147,6 +147,16 @@ namespace VIZ.TVP.Golf.Service
}
/// <summary>
/// 获取图片名字
/// </summary>
/// <param name="path">图片路径</param>
/// <returns>图片资源名字</returns>
public string GetImageName(string path)
{
return path;
}
/// <summary>
/// 获取队伍每洞得分
/// </summary>
/// <param name="players">球员集合</param>
......@@ -487,5 +497,39 @@ namespace VIZ.TVP.Golf.Service
after_group.PositionChangedDesc = $"{after_group.PositionOldIndex} --> {after_group.PositionNewIndex}";
}
}
/// <summary>
/// 获取分组当前所在洞号
/// </summary>
/// <param name="list">真实数据列表</param>
/// <param name="group">分组</param>
/// <param name="round">轮次</param>
/// <returns>当前所在洞号</returns>
public int? GetGroupCurrentHole(List<PlayerRealModel> list, GroupTempModel group, int round)
{
if (group == null || group.Player1 == null || group.Player2 == null)
return null;
PlayerRealModel player1 = list.FirstOrDefault(p => p.PlayerID == group.Player1.PlayerID);
PlayerRealModel player2 = list.FirstOrDefault(p => p.PlayerID == group.Player2.PlayerID);
if (player1 == null || player2 == null)
return null;
RoundRealModel round1 = player1.Rounds.FirstOrDefault(p => p.No == round);
RoundRealModel round2 = player2.Rounds.FirstOrDefault(p => p.No == round);
if (round1 == null || round2 == null)
return null;
if (round1.Thru < ApplicationDomainEx.HoleInfos.Count)
{
return (round1.StartingTee + round1.Thru) % ApplicationDomainEx.HoleInfos.Count;
}
else
{
int rsult = (round1.StartingTee + round1.Thru - 1) % 18;
return rsult == 0 ? ApplicationDomainEx.HoleInfos.Count : rsult;
}
}
}
}
......@@ -46,6 +46,13 @@ namespace VIZ.TVP.Golf.Service
string GetScoreString(int? score);
/// <summary>
/// 获取图片名字
/// </summary>
/// <param name="path">图片路径</param>
/// <returns>图片资源名字</returns>
string GetImageName(string path);
/// <summary>
/// 获取队伍每洞得分
/// </summary>
/// <param name="players">球员集合</param>
......@@ -134,5 +141,14 @@ namespace VIZ.TVP.Golf.Service
/// <param name="before">之前的排名</param>
/// <param name="after">之后的排名</param>
void UpdateGroupPositionChanged(IList<GroupTempModel> before, IList<GroupTempModel> after);
/// <summary>
/// 获取分组当前所在洞号
/// </summary>
/// <param name="list">真实数据列表</param>
/// <param name="group">分组</param>
/// <param name="round">轮次</param>
/// <returns>当前所在洞号</returns>
int? GetGroupCurrentHole(List<PlayerRealModel> list, GroupTempModel group, int round);
}
}
......@@ -23,6 +23,8 @@ namespace VIZ.TVP.Golf
AppSetup.AppendSetup(new AppSetup_InitResource());
// 初始化 清理远程数据
AppSetup.AppendSetup(new AppSetup_ClearLocalData());
// 初始化 VIZ
AppSetup.AppendSetup(new AppSetup_InitVIZ());
// 启动
AppSetupContext context = AppSetup.Setup();
......
......@@ -77,6 +77,9 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="VizConnectC">
<HintPath>..\Lib\VizConnectC.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
......
......@@ -13,7 +13,7 @@ CLIENT_VIZ_IP=127.0.0.1
; VIZ端口
CLIENT_VIZ_PORT=6100
; 备库 VIZ IP地址
CLIENT_VIZ_IP_STANDBY=127.0.0.1
CLIENT_VIZ_IP_STANDBY=127.0.0.2
; 备库 VIZ端口
CLIENT_VIZ_PORT_STANDBY=6100
; ============================================================
......
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