Commit 94b1bee9 by wangonghui

女足世界杯插件开发

parent 8aaaf555
......@@ -77,6 +77,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.TVP.FTB.Module", "VIZ.T
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.MIGU.FOOTBALL", "VIZ.MIGU.FOOTBALL\VIZ.MIGU.FOOTBALL.csproj", "{72A5659A-9195-4EA6-856C-AE2A65BA1575}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.TVP.WMCUP.Module", "VIZ.TVP.WMCUP.Module\VIZ.TVP.WMCUP.Module.csproj", "{39898428-1D3D-430B-8B33-085878C0699D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -269,6 +271,14 @@ Global
{72A5659A-9195-4EA6-856C-AE2A65BA1575}.Release|Any CPU.Build.0 = Release|Any CPU
{72A5659A-9195-4EA6-856C-AE2A65BA1575}.Release|x64.ActiveCfg = Release|Any CPU
{72A5659A-9195-4EA6-856C-AE2A65BA1575}.Release|x64.Build.0 = Release|Any CPU
{39898428-1D3D-430B-8B33-085878C0699D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39898428-1D3D-430B-8B33-085878C0699D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39898428-1D3D-430B-8B33-085878C0699D}.Debug|x64.ActiveCfg = Debug|Any CPU
{39898428-1D3D-430B-8B33-085878C0699D}.Debug|x64.Build.0 = Debug|Any CPU
{39898428-1D3D-430B-8B33-085878C0699D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39898428-1D3D-430B-8B33-085878C0699D}.Release|Any CPU.Build.0 = Release|Any CPU
{39898428-1D3D-430B-8B33-085878C0699D}.Release|x64.ActiveCfg = Release|Any CPU
{39898428-1D3D-430B-8B33-085878C0699D}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -297,6 +307,7 @@ Global
{5E259876-8FA4-4AD1-9D91-07A76ABC2A16} = {6B4D3B9C-6988-432B-87BD-C3875FDAAE21}
{8768CECB-A595-4C41-99E2-FBA5096CB6A8} = {2A0D4CA6-9E99-402E-B096-AC403D8386F7}
{72A5659A-9195-4EA6-856C-AE2A65BA1575} = {FB580B2F-98B5-47B0-8C2B-E633BE0768F8}
{39898428-1D3D-430B-8B33-085878C0699D} = {2A0D4CA6-9E99-402E-B096-AC403D8386F7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DE6BF34A-A1A4-4829-88A8-3A4229F89708}
......
using log4net;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public static class JsonHelper
{
/// <summary>
/// 日志
/// </summary>
private static readonly ILog Log = LogManager.GetLogger(typeof(JsonHelper));
/// <summary>
/// 根据POST方法请求获取
/// </summary>
/// <param name="url"></param>
/// <param name="dic"></param>
/// <returns></returns>
public static string Post(string url, Dictionary<string, string> dic, string key)
{
string result = "";
try
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.Headers.Add("App-Authorization", key);
StringBuilder builder = new StringBuilder();
int i = 0;
foreach (var item in dic)
{
if (i > 0)
builder.Append("&");
builder.AppendFormat("{0}={1}", item.Key, item.Value);
i++;
}
byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
//获取相应内容
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
result = reader.ReadToEnd();
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return result;
}
/// <summary>
/// 根据Get方法获取
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static string GetResult(string url)
{
string data = "";
try
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Headers["Accept-Encoding"] = "gzip,deflate";
req.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
//获取内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
data = reader.ReadToEnd();
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return data;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public class Season
{
/// <summary>
/// 赛季Id
/// </summary>
public string seasonId { get; set; }
/// <summary>
/// 赛季名称
/// </summary>
public string seasonName { get; set; }
/// <summary>
/// 赛季名称简写
/// </summary>
public string shortName { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public class Seasons
{
/// <summary>
/// 更新的时间
/// </summary>
public string LastPushDataDateTime { get; set; }
/// <summary>
/// 赛季数据
/// </summary>
public List<Season> matchseason { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public class PluginConstant
{
public static string GroupName { get; set; } = "足球";
/// <summary>
/// 加载数据
/// </summary>
public static string Operate_Load { get; set; } = "加载数据";
/// <summary>
/// 刷新数据
/// </summary>
public static string Opeate_Refresh { get; set; } = "刷新数据";
/// <summary>
/// 提示信息
/// </summary>
public static string Operate_Message { get; set; } = "推送数据更新时间";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public static class Utils
{
/// <summary>
/// MD5加密
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string GetMD5(string str)
{
//创建MD5对象
MD5 md5 = new MD5CryptoServiceProvider();
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(str);
byte[] MD5Buffer = md5.ComputeHash(buffer);
string strNew = null;
for (int i = 0; i < MD5Buffer.Length; i++)
{
strNew += MD5Buffer[i].ToString("x2");//可以了解下ToString("")的格式问题
}
return strNew;
}
/// <summary>
/// 艾果的密钥加密
/// </summary>
/// <param name="appId"></param>
/// <param name="appKey"></param>
/// <returns></returns>
public static string GetKey(string appId, string appKey)
{
int random = new Random().Next(0, 100);
long timeStamp = DateToTicks(DateTime.Now);
string key = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0},{1},{2},{3}", appId, appKey, timeStamp, random)));
return key;
}
/// <summary>
/// 获取时间戳
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public static long DateToTicks(DateTime? time)
{
return ((time.HasValue ? time.Value.Ticks : DateTime.Parse("1990-01-01").Ticks) - 621355968000000000) / 10000;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.TVP.WMCUP.Module
{
public class FDayMatchViewPlugin : IPluginLifeCycle
{
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
/// 插件ID不能包含点号
/// </remarks>
public const string PLUGIN_ID = "FDayMatchView";
/// <summary>
/// 插件显示名称
/// </summary>
public const string PLUGIN_NAME = "足球赛程";
public void Dispose()
{
}
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PluginConstant.GroupName;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.PluginType = PluginType.Page;
info.ViewType = typeof(FDayMatchView);
//info.SettingViewType = typeof(DayMatchUI);
return info;
}
}
}
using DevExpress.Mvvm.POCO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.WMCUP.Module
{
/// <summary>
/// 赛程实体
/// </summary>
public class Dayschedule : ViewModelBase
{
public string round { get; set; }//轮次
public string date { get; set; }//比赛日期
public string time { get; set; }//比赛时间
public string homeTeamLogo { get; set; }//主队队伍图片名称
public string homeTeamName { get; set; }//主队名称
public string homeTeamScore { get; set; }//主队得分
public string visitingTeamScore { get; set; }//客队得分
public string visitingTeamName { get; set; }//客队名称
public string visitingTeamLogo { get; set; }//客队队伍图片名称
public string matchId { get; set; }//赛程ID
public string competitionId { get; set; }// 赛事Id
public string competionIdName { get; set; } // 赛事类型(德甲、意甲、英超等等)
public string stadium { get; set; }//比赛场馆
public string status { get; set; }//赛程状态//1未开始,2进行中,4已结束,5延期
public string homeShortTeamName { get; set; }// 主队球队简称
public string visitingShortTeamName { get; set; } //客队球队简称
//private HighLightEnum light = HighLightEnum.OffLight;
///// <summary>
/////
///// </summary>
//public HighLightEnum Light
//{
// get { return light; }
// set { light = value; this.RaisePropertyChanged(nameof(Light)); }
//}
private string selectLight = "不高亮";
public string SelectLight
{
get { return selectLight; }
set { selectLight = value; this.RaisePropertyChanged(nameof(SelectLight)); }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public class Dayschedules
{
/// <summary>
/// 最后推送时间
/// </summary>
public string LastPushDataDateTime { get; set; }
public List<Dayschedule> schedulelist { get; set; }
}
}
using log4net;
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;
using VIZ.Package.Domain;
using VIZ.Package.Module;
using VIZ.Package.Service;
using VIZ.Package.Storage;
namespace VIZ.TVP.WMCUP.Module
{
/// <summary>
/// FDayMatchView.xaml 的交互逻辑
/// </summary>
public partial class FDayMatchView : UserControl, IPluginView
{
public FDayMatchViewModel vm = new FDayMatchViewModel();
/// <summary>
/// 日志
/// </summary>
private static ILog Log = LogManager.GetLogger(typeof(FDayMatchView));
public FDayMatchView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, vm);
FDayMatchViewModel.FDayMatchViewModelInstance = vm;
}
/// <summary>
/// 操作日志服务
/// </summary>
private RecordLogService recordLogService = new RecordLogService();
/// <summary>
/// 上版
/// </summary>
/// <param name="conns">连接</param>
public void TakIn(ConnModel conns)
{
//DayMatchViewModel vm = thi DayMatchViewModel
//ApplicationDomainEx.PreviewConn.EndpointManager.Send("");
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_TAKE_TAKE);
if (conns.IsConnected && vm.MatchData != null)
{
//SCRIPT_INVOKE
conns.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineMatchData()));
}
}
/// <summary>
/// 继续
/// </summary>
/// <param name="conns">连接</param>
public void TakeContinue(ConnModel conns)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_TAKE_CONTINUE);
if (conns.IsConnected && vm.MatchData != null)
{
conns.EndpointManager.Send(VizEngineCommands.STAGE_CONTINUE);
}
}
/// <summary>
/// 下版子
/// </summary>
/// <param name="conns">连接</param>
public void TakeOut(ConnModel conns)
{
}
/// <summary>
/// 更新
/// </summary>
/// <param name="conns">连接</param>
public void TakeUpdate(ConnModel conns)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_TAKE_UPDATE);
if (conns.IsConnected && vm.MatchData != null)
{
//SCRIPT_INVOKE
conns.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineMatchData()));
}
}
/// <summary>
/// 预览上版子
/// </summary>
/// <param name="conn">连接</param>
public void PreviewIn(ConnModel conn)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_PREVIEW_PLAY);
if (conn.IsConnected && vm.MatchData != null)
{
//SCRIPT_INVOKE
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineMatchData()));
}
}
/// <summary>
/// 预览继续
/// </summary>
/// <param name="conn">连接</param>
public void PreviewContinue(ConnModel conn)
{
}
/// <summary>
/// 预览下版
/// </summary>
/// <param name="conn">连接</param>
public void PreviewOut(ConnModel conn)
{
//if(conn.IsConnected)
//{
// conn.EndpointManager.Send(VizEngineCommands.STAGE_CONTINUE);
//}
}
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
{
}
/// <summary>
/// 任务模型
/// </summary>
public PackageTaskModel task;
/// <summary>
/// 注册服务
/// </summary>
IPackageTaskService service;
public void PageOpend(ConnModel conn, PageModel page)
{
if (conn.IsConnected && vm.MatchData != null)
{
//SCRIPT_INVOKE
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineMatchData()));
}
}
public void PreviewUpdate(ConnModel conn)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_PREVIEW_UPDATE);
if (conn.IsConnected && vm.MatchData != null)
{
//SCRIPT_INVOKE
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineMatchData()));
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.TVP.WMCUP.Module
{
public class FTeamStandingViewPlugin
{
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
/// 插件ID不能包含点号
/// </remarks>
public const string PLUGIN_ID = "FTeamStandingView";
/// <summary>
/// 插件显示名称
/// </summary>
public const string PLUGIN_NAME = "积分榜";
public void Dispose()
{
}
public void Initialize()
{
}
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PluginConstant.GroupName;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.PluginType = PluginType.Page;
info.ViewType = typeof(FTeamStandingView);
//info.SettingViewType = typeof(DayMatchUI);
return info;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public class TeamRanks
{
/// <summary>
/// 最后推送数据时间
/// </summary>
public string LastPushDataDateTime { get; set; } = "";
public List<Teamrank> teamstats { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
/// <summary>
/// 排名对象
/// </summary>
public class Teamrank
{
public string rank { get; set; } // 排名
public string teamLogo { get; set; } //球队队伍图片名称
public string teamName { get; set; } //球队名称
public string matchNum { get; set; } //场次
public string winNum { get; set; }// 胜场总数
public string drawNum { get; set; }//平场总数
public string loseNum { get; set; } //负场总数
public string goalsNum { get; set; } //进球总数
public string loseGoalsNum { get; set; } //失球总数
public string score { get; set; } //积分
public string competitionId { get; set; } //赛事类型Id
public string competionIdName { get; set; } //赛事类型(德甲、意甲、英超等等)
public string goalAndLoseNums { get; set; } //进球/失球总数
public string shortTeamName { get; set; } //球队名称简称
public string goaldifference { get; set; }// 净胜球
}
}
<UserControl x:Class="VIZ.TVP.WMCUP.Module.FTeamStandingView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxrudex="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesignerextensions"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:storage="clr-namespace:VIZ.TVP.WMCUP.Module"
xmlns:common="clr-namespace:VIZ.Package.Common;assembly=VIZ.Package.Common"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
x:Name="uc"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="650">
<UserControl.Resources>
<ResourceDictionary>
<Style x:Name="gridCenter" TargetType = "{x:Type dxg:GridColumn}" >
<!--列头居中-->
<Setter Property = "HorizontalHeaderContentAlignment" Value = "Center" />
<!--列值居中-->
<Setter Property = "EditSettings" >
<Setter.Value >
<dxe:TextEditSettings HorizontalContentAlignment = "Center" />
</Setter.Value >
</Setter >
</Style >
</ResourceDictionary>
</UserControl.Resources>
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="650" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70"/>
<ColumnDefinition Width="285"/>
<ColumnDefinition Width="0"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="140"/>
<!--<ColumnDefinition Width="120"/>-->
</Grid.ColumnDefinitions>
<!--<TextBlock Grid.Column="0" Text="标题:" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<dxe:TextEdit Grid.Column="1" Width="280" FontSize="16" HorizontalContentAlignment="Left"
HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Title,Mode=TwoWay }"></dxe:TextEdit>-->
<dxe:ComboBoxEdit Grid.Column="3" Width="100" FontSize="14" ItemsSource="{Binding Path=GroupItems,Mode=TwoWay}"
SelectedItem="{Binding Path=SelectGroupItem,Mode=TwoWay}" />
<WrapPanel Grid.Row="0" Grid.Column="4" HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Content="加载数据" FontSize="14" Width="90" Height="30" Command="{Binding BtnCmd}" />
<dx:SimpleButton Grid.Row="0" Grid.Column="1" Glyph='/VIZ.TVP.WMCUP.Module;component/Image/FT/Prompt2525.png' FontSize="16"
Command="{Binding PromptCommand}" HorizontalContentAlignment="Center" Width="30" Height="30" />
</Grid>
</WrapPanel>
</Grid>
</WrapPanel>
<DockPanel Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
Name="PART_Options"
DockPanel.Dock="Right"
dx:ScrollBarExtensions.ScrollBarMode="TouchOverlap"
Focusable="False">
</ScrollViewer>
<dxg:GridControl x:Name="grid" ShowBorder="False" ItemsSource="{Binding Path= TeamRanksModel,Mode=TwoWay}">
<dxg:GridColumn FieldName="rank" Header="排名" Width="112" />
<dxg:GridColumn FieldName="teamLogo" Header="球队国旗" Width="112"/>
<dxg:GridColumn FieldName="teamName" Header="球队名" Width="112" />
<dxg:GridColumn FieldName="matchNum" Header="场次" Width="180" />
<dxg:GridColumn FieldName="winNum" Header="胜" Width="100" />
<dxg:GridColumn FieldName="drawNum" Header="平" Width="100"/>
<dxg:GridColumn FieldName="loseNum" Header="负" Width="100" />
<dxg:GridColumn FieldName="goaldifference" Header="净胜球" Width="180" />
<dxg:GridColumn FieldName="score" Header="积分" Width="180" />
<dxg:GridControl.View>
<!--<dxg:TableView AutoWidth="True" ShowGroupPanel="False"
BorderThickness="0"
ShowFilterPanelMode="Never"
AllowColumnFiltering="False"
AllowSorting="False"
IsColumnMenuEnabled="False" >
</dxg:TableView>-->
<dxg:TableView IsColumnMenuEnabled="True"
IsColumnChooserVisible="{Binding Path=IsColumnChooserVisible,Mode=TwoWay}"
AllowEditing="True" ShowIndicator="False" AutoWidth="True"
NavigationStyle="Cell" ShowVerticalLines="False" ShowHorizontalLines="False"
ShowGroupPanel="False" EditorShowMode="MouseDown"
AllowDragDrop="True"
AlternateRowBackground="#05ffffff"
ShowBandsPanel="False"
ShowTotalSummary="False"
ShowFixedTotalSummary="False"
ShowDragDropHint="False"
AllowSorting="False"
AllowColumnFiltering="False"
ShowTargetInfoInDragDropHint="false">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="ShowGridMenu" Command="{Binding ElementName=uc, Path=DataContext.ShowGridMenuCommand}" PassEventArgsToCommand="True"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<dxg:TableView.ColumnMenuCustomizations>
<dxb:BarButtonItem Name="ShowColumnChooser" Content="显示列选择"
Command="{Binding ElementName=uc,Path=DataContext.ColumnChoiceCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
</dxg:TableView.ColumnMenuCustomizations>
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
</DockPanel>
</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;
using VIZ.Package.Domain;
using VIZ.Package.Service;
using VIZ.Package.Storage;
namespace VIZ.TVP.WMCUP.Module
{
/// <summary>
/// FTeamStandingView.xaml 的交互逻辑
/// </summary>
public partial class FTeamStandingView : UserControl,IPluginView
{
FTeamStandingViewModel vm = new FTeamStandingViewModel();
/// <summary>
/// 操作日志服务
/// </summary>
private RecordLogService recordLogService = new RecordLogService();
public FTeamStandingView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, vm);
//vm = this.DataContext as FTeamStandingViewModel;
FTeamStandingViewModel.FTeamStandingViewModelInstance = vm;
}
public void Dispose()
{
}
public void PageOpend(ConnModel conn, PageModel page)
{
if (conn.IsConnected && vm.TeamRanksModel != null)
{
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineTeamStandingData()));
}
}
public void PreviewContinue(ConnModel conn)
{
}
public void PreviewIn(ConnModel conn)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_PREVIEW_PLAY);
if (conn.IsConnected && vm.TeamRanksModel != null)
{
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineTeamStandingData()));
}
}
public void PreviewOut(ConnModel conn)
{
}
public void PreviewUpdate(ConnModel conn)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_PREVIEW_UPDATE);
if (conn.IsConnected && vm.TeamRanksModel != null)
{
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineTeamStandingData()));
}
}
public void TakeContinue(ConnModel conns)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_TAKE_CONTINUE);
if (conns.IsConnected && vm.TeamRanksModel != null)
{
conns.EndpointManager.Send(VizEngineCommands.STAGE_CONTINUE);
}
}
public void TakeOut(ConnModel conns)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_TAKE_OUT);
if (conns.IsConnected && vm.TeamRanksModel != null)
{
conns.EndpointManager.Send(VizEngineCommands.STAGE_CONTINUE);
}
}
public void TakeUpdate(ConnModel conns)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_TAKE_UPDATE);
if (conns.IsConnected && vm.TeamRanksModel != null)
{
conns.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineTeamStandingData()));
}
}
public void TakIn(ConnModel conns)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_TAKE_TAKE);
if (conns.IsConnected && vm.TeamRanksModel != null)
{
conns.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineTeamStandingData()));
}
}
}
}
using DevExpress.Xpf.Grid;
using log4net;
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.Package.Common;
namespace VIZ.TVP.WMCUP.Module
{
/// <summary>
/// 积分排名
/// </summary>
public class FTeamStandingViewModel : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private static ILog Log = LogManager.GetLogger(typeof(FTeamStandingViewModel));
/// <summary>
///
/// </summary>
public static FTeamStandingViewModel FTeamStandingViewModelInstance = new FTeamStandingViewModel();
public FTeamStandingViewModel()
{
//初始化方法
Init();
}
/// <summary>
/// 球队绑定数据集合
/// </summary>
private ObservableCollection<Teamrank> teamRanksModel;
public ObservableCollection<Teamrank> TeamRanksModel
{
get { return teamRanksModel; }
set { teamRanksModel = value; this.RaisePropertyChanged(nameof(TeamRanksModel)); }
}
public VCommand BtnCmd { get; set; }
TeamRanks teamStands = null;
/// <summary>
/// 刷新球队积分排名
/// </summary>
private async void BtmCommand()
{
teamStands = new TeamRanks();
teamStands = await JsonModel.PostTeamScoreData_Path(SelectGroupItem);
if (teamStands == null) return;
TeamRanksModel = new ObservableCollection<Teamrank>();
foreach (var teamRank in teamStands.teamstats)
{
teamRank.teamLogo = teamRank.teamName;
TeamRanksModel.Add(teamRank);
}
}
/// <summary>
/// 组装积分排名数据上传
/// </summary>
/// <returns></returns>
public string CombineTeamStandingData()
{
try
{
string data = "";
data += title;
data += "&";
int i = 0;
foreach (var tempTeamRankModel in TeamRanksModel)
{
//i++;
//data += tempTeamRankModel.rank.ToString().Replace(" ", "");
data += "*";
data += tempTeamRankModel.teamLogo.Replace(" ", "");
data += "*";
data += tempTeamRankModel.teamName.ToString().Replace(" ", "");
data += "*";
data += tempTeamRankModel.matchNum.ToString().Replace(" ", "");
data += "*";
data += tempTeamRankModel.winNum.ToString().Replace(" ", "");
data += "*";
data += tempTeamRankModel.drawNum.ToString().Replace(" ", "");
data += "*";
data += tempTeamRankModel.loseNum.ToString().Replace(" ", "");
data += "*";
data += tempTeamRankModel.goaldifference.Replace(" ", "");
data += "*";
data += tempTeamRankModel.score.Replace(" ", "");
data += ";";
}
return data;
}
catch (Exception ex)
{
Log.Error(ex.Message);
return "";
}
}
private string title = "积分榜";
public string Title
{
get { return title; }
set { title = value; this.RaisePropertyChanged(nameof(Title)); }
}
/// <summary>
/// 小组积分分组
/// </summary>
private ObservableCollection<string> groupItems;
public ObservableCollection<string> GroupItems
{
get {return groupItems;}
set { groupItems = value;this.RaisePropertyChanged(nameof(GroupItems)); }
}
/// <summary>
/// 选中的分组
/// </summary>
private string selectGroupItem;
public string SelectGroupItem
{
get { return selectGroupItem; }
set { selectGroupItem = value; this.RaisePropertyChanged(nameof(SelectGroupItem)); }
}
/// <summary>
/// 足球赛事类型
/// </summary>
public string FoolballType = "";
/// <summary>
/// 赛季ID
/// </summary>
public string SeasonId = "";
/// <summary>
/// 初始话
/// </summary>
private void Init()
{
BtnCmd = new VCommand(BtmCommand);
PromptCommand = new VCommand(PromptCmd);
ColumnChoiceCommand = new VCommand(ColumnChoice);
ShowGridMenuCommand = new VCommand<GridMenuEventArgs>(ShowGridMenu);
//FoolballType = DateHeaderViewModel.FoolballType;
//SeasonId = DateHeaderViewModel.SeasonId;
GroupItems = new ObservableCollection<string>()
{
"A组","B组","C组","D组","E组","F组","G组","H组"
};
}
#region IsColumnChooserVisible -- 是否显示列选择器
private bool isColumnChooserVisible;
/// <summary>
/// 是否显示列选择器
/// </summary>
public bool IsColumnChooserVisible
{
get { return isColumnChooserVisible; }
set { isColumnChooserVisible = value; this.RaisePropertyChanged(nameof(IsColumnChooserVisible)); }
}
#endregion
#region ColumnChoiceCommand -- 列选择命令
/// <summary>
/// 列选择命令
/// </summary>
public VCommand ColumnChoiceCommand { get; set; }
/// <summary>
/// 列选择
/// </summary>
private void ColumnChoice()
{
this.IsColumnChooserVisible = true;
}
#endregion
#region ShowGridMenuCommand -- 显示列命令
/// <summary>
/// 显示列命令
/// </summary>
public VCommand<GridMenuEventArgs> ShowGridMenuCommand { get; set; }
/// <summary>
/// 显示列
/// </summary>
/// <param name="e">事件参数</param>
private void ShowGridMenu(GridMenuEventArgs e)
{
GridControlHelper.RemoveAllDefaultMenuItem(e);
}
#endregion
#region 打开更新数据时间日志
/// <summary>
/// 打开数据更新日志
/// </summary>
public VCommand PromptCommand { get; set; }
MessageLastRecordDate messageLastRecordDate = new MessageLastRecordDate();
private void PromptCmd()
{
MessageLRDateViewModel vm = messageLastRecordDate.DataContext as MessageLRDateViewModel;
if (teamStands != null)
{
string LastDate = $"{FoolballType}:足球积分接口更新时间:{teamStands.LastPushDataDateTime}";
vm.OnErrorLogMessage(LastDate);
}
messageLastRecordDate.Visibility = System.Windows.Visibility.Visible;
messageLastRecordDate.WindowState = System.Windows.WindowState.Normal;
}
#endregion
}
}
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;
namespace VIZ.TVP.WMCUP.Module
{
/// <summary>
/// DateHeaderView.xaml 的交互逻辑
/// </summary>
public partial class DateHeaderView : UserControl
{
public DateHeaderView()
{
InitializeComponent();
}
}
}
<dx:ThemedWindow
x:Class="VIZ.TVP.WMCUP.Module.MessageLastRecordDate"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
Title="查看数据更新时间" Height="800" Width="1000">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Button Width="80" Height="20" Content="清除" Command="{Binding Path=ClearCommand}" HorizontalAlignment="Left"></Button>
<TextBox x:Name="tb" IsReadOnly="True" AcceptsReturn="False" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
Grid.Row="1"></TextBox>
</Grid>
</dx:ThemedWindow>
using DevExpress.Xpf.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.WMCUP.Module
{
/// <summary>
/// Interaction logic for MessageLastRecordDate.xaml
/// </summary>
public partial class MessageLastRecordDate : ThemedWindow
{
public MessageLastRecordDate()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new MessageLRDateViewModel());
this.Closing += MessageLastRecordDate_Closing;
}
private void MessageLastRecordDate_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
this.Visibility = Visibility.Collapsed;
}
}
}
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.WMCUP.Module
{
public class MessageLRDateViewModel : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private static readonly ILog log = LogManager.GetLogger(typeof(MessageLRDateViewModel));
public MessageLRDateViewModel()
{
//初始化命令
InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.ClearCommand = new VCommand(this.Clear);
}
// ==================================================================================
// Command
// ==================================================================================
#region ClearCommand -- 清除消息
/// <summary>
/// 清除消息
/// </summary>
public VCommand ClearCommand { get; set; }
/// <summary>
/// 清除
/// </summary>
private void Clear()
{
MessageLastRecordDate view = this.GetView<MessageLastRecordDate>();
if (view == null)
return;
view.tb.Clear();
}
#endregion
/// <summary>
/// 错误日志消息
/// </summary>
/// <param name="msg">消息</param>
public void OnErrorLogMessage(string msg)
{
WPFHelper.BeginInvoke(() =>
{
MessageLastRecordDate view = this.GetView<MessageLastRecordDate>();
if (view == null)
return;
string log = $"{DateTime.Now.ToString("HH:mm:ss")} {msg}";
view.tb.AppendText($"{log}\r\n");
view.tb.ScrollToEnd();
});
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("VIZ.TVP.WMCUP.Module")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("China")]
[assembly: AssemblyProduct("VIZ.TVP.WMCUP.Module")]
[assembly: AssemblyCopyright("Copyright © China 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("39898428-1d3d-430b-8b33-085878c0699d")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
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;
namespace VIZ.TVP.WMCUP.Module
{
/// <summary>
/// HttpUrlConfigView.xaml 的交互逻辑
/// </summary>
public partial class HttpUrlConfigView : UserControl
{
public HttpUrlConfigView()
{
InitializeComponent();
}
}
}
using DevExpress.Mvvm.POCO;
using log4net;
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.Package.Module;
namespace VIZ.TVP.WMCUP.Module
{
public class HttpUrlConfigViewModel : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(MediaSettingViewModel));
private static AppSetup_InitLiteDB appSetup_InitCBALiteDB = AppSetup_InitLiteDB.CreateInstance;
/// <summary>
/// 媒资库配置设置视图模型
/// </summary>
public HttpUrlConfigViewModel()
{
// 初始化命令
this.InitCommand();
// HttpUrlConfigEntity config = AppSetup_InitCBALiteDB.HttpUrlConfigEntity;
//FootballTypes = new ObservableCollection<string>()
//{
// "英超","法甲","意甲","德甲","西甲"
//};
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.LoadedCommand = new VCommand(this.Loaded);
}
// =========================================================================
// Property
// =========================================================================
#region 主数据来源
#region Url -- 地址
private string url;
/// <summary>
/// 地址
/// </summary>
public string Url
{
get { return url; }
set { url = value; this.RaisePropertyChanged(nameof(Url)); }
}
#endregion
#region 应用Id
/// <summary>
/// 艾果平台应用Id
/// </summary>
private string appId;
public string AppId
{
get { return appId; }
set { appId = value; this.RaisePropertyChanged(nameof(AppId)); }
}
#endregion
#region 平台Key
/// <summary>
/// 艾果应用平台Key
/// </summary>
private string appKey;
public string AppKey
{
get { return appKey; }
set { appKey = value; this.RaisePropertyChanged(nameof(AppKey)); }
}
#endregion
#endregion
#region 备份数据来源
#region Url -- 地址
private string burl;
/// <summary>
/// 地址
/// </summary>
public string BUrl
{
get { return burl; }
set { burl = value; this.RaisePropertyChanged(nameof(BUrl)); }
}
#endregion
#region 应用Id
/// <summary>
/// 艾果平台应用Id
/// </summary>
private string bappId;
public string BAppId
{
get { return bappId; }
set { bappId = value; this.RaisePropertyChanged(nameof(BAppId)); }
}
#endregion
#region 平台Key
/// <summary>
/// 艾果应用平台Key
/// </summary>
private string bappKey;
public string BAppKey
{
get { return bappKey; }
set { bappKey = value; this.RaisePropertyChanged(nameof(BAppKey)); }
}
#endregion
#endregion
// =========================================================================
// Command
// =========================================================================
#region LoadedCommand -- 加载命令
/// <summary>
/// 加载命令
/// </summary>
public VCommand LoadedCommand { get; set; }
/// <summary>
/// 加载
/// </summary>
private void Loaded()
{
this.Url = AppSetup_InitLiteDB.HttpUrlConfigEntity.Url;
this.AppId = AppSetup_InitLiteDB.HttpUrlConfigEntity.AppId;
this.AppKey = AppSetup_InitLiteDB.HttpUrlConfigEntity.AppKey;
this.BUrl = AppSetup_InitLiteDB.HttpUrlConfigEntity.BUrl;
this.BAppId = AppSetup_InitLiteDB.HttpUrlConfigEntity.BAppId;
this.BAppKey = AppSetup_InitLiteDB.HttpUrlConfigEntity.BAppKey;
// this.SelectFootballType = AppSetup_InitLiteDB.HttpUrlConfigEntity.SelectFootballType;
// this.SelectSeason = AppSetup_InitLiteDB.HttpUrlConfigEntity.SelectSeason;
}
#endregion
// =========================================================================
// Public Function
// =========================================================================
/// <summary>
/// 保存
/// </summary>
public void Save()
{
HttpUrlConfigEntity config = AppSetup_InitLiteDB.HttpUrlConfigEntity;
config.Url = this.Url;
config.AppId = this.AppId;
config.AppKey = this.AppKey;
config.BUrl = this.BUrl;
config.BAppId = this.BAppId;
config.BAppKey = this.BAppKey;
//config.SelectFootballType = this.SelectFootballType;
// 选择赛事和赛事Id
//config.SelectSeason = this.SelectSeason;
AppSetup_InitLiteDB.localDbContext.HttpUrlConfig.Upsert(config);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public class ShootPlayerRank
{
/// <summary>
/// 球队名称
/// </summary>
public string teamName { get; set; }
/// <summary>
/// 球员图片
/// </summary>
public string playerLogo { get; set; }
/// <summary>
/// 球队国旗
/// </summary>
public string teamLogo { get; set; }
/// <summary>
/// 出场次数
/// </summary>
public string games { get; set; }
/// <summary>
/// 进球数量
/// </summary>
public string goals { get; set; }
/// <summary>
/// 球员名称
/// </summary>
public string figureName { get; set; }
/// <summary>
/// 球员Id
/// </summary>
public string PlayerID { get; set; }
/// <summary>
/// 排名
/// </summary>
public string rank { get; set; }
/// <summary>
/// 点球数量
/// </summary>
public string penaltyGoals { get; set; } = "0";
/// <summary>
/// 球队名称简称
/// </summary>
public string shortTeamName { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public class ShootPlayerRanks
{
/// <summary>
/// 最后推送时间
/// </summary>
public string LastPushDataDateTime { get; set; }
/// <summary>
/// 球员统计
/// </summary>
public List<ShootPlayerRank> playerstats { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.TVP.WMCUP.Module
{
public class ShootPlayerRankPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
/// 插件ID不能包含点号
/// </remarks>
public const string PLUGIN_ID = "ShootPlayerRankView";
/// <summary>
/// 插件显示名称
/// </summary>
public const string PLUGIN_NAME = "射手榜";
public void Dispose()
{
}
public void Initialize()
{
}
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PluginConstant.GroupName;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.PluginType = PluginType.Page;
info.ViewType = typeof(ShootPlayerRankView);
//info.SettingViewType = typeof(DayMatchUI);
return info;
}
}
}
<UserControl x:Class="VIZ.TVP.WMCUP.Module.ShootPlayerRankView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxrudex="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesignerextensions"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:storage="clr-namespace:VIZ.TVP.WMCUP.Module"
xmlns:common="clr-namespace:VIZ.Package.Common;assembly=VIZ.Package.Common"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
x:Name="uc"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<Style x:Name="gridCenter" TargetType = "{x:Type dxg:GridColumn}" >
<!--列头居中-->
<Setter Property = "HorizontalHeaderContentAlignment" Value = "Center" />
<!--列值居中-->
<Setter Property = "EditSettings" >
<Setter.Value >
<dxe:TextEditSettings HorizontalContentAlignment = "Center" />
</Setter.Value >
</Setter >
</Style >
</ResourceDictionary>
</UserControl.Resources>
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="800" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70"/>
<ColumnDefinition Width="285"/>
<ColumnDefinition Width="0"/>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="140"/>
<!--<ColumnDefinition Width="120"/>-->
</Grid.ColumnDefinitions>
<!--<TextBlock Grid.Column="0" Text="标题:" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<dxe:TextEdit Grid.Column="1" Width="280" FontSize="16" HorizontalContentAlignment="Left"
HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Title,Mode=TwoWay }"></dxe:TextEdit>-->
<WrapPanel Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Center" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="75"/>
<ColumnDefinition Width="75"/>
<ColumnDefinition Width="75"/>
<ColumnDefinition Width="75"/>
</Grid.ColumnDefinitions>
<!--<TextBlock Text="起始:" FontSize="16" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<dxe:TextEdit Grid.Column="1" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center"
Text="{Binding StartOffset,Mode=TwoWay}" Width="60"/>
<TextBlock Text="结束:" FontSize="16" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<dxe:TextEdit Grid.Column="4" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center"
Text="{Binding EndOffset,Mode=TwoWay}" Width="60"/>-->
</Grid>
</WrapPanel>
<WrapPanel Grid.Row="0" Grid.Column="4" HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Content="加载数据" FontSize="14" Width="90" Height="30" Command="{Binding BtnCmd}" />
<dx:SimpleButton Grid.Row="0" Grid.Column="1" Glyph='/VIZ.TVP.WMCUP.Module;component/Image/FT/Prompt2525.png' FontSize="16"
Command="{Binding PromptCommand}" HorizontalContentAlignment="Center" Width="30" Height="30" />
</Grid>
</WrapPanel>
</Grid>
</WrapPanel>
<DockPanel Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
Name="PART_Options"
DockPanel.Dock="Right"
dx:ScrollBarExtensions.ScrollBarMode="TouchOverlap"
Focusable="False">
</ScrollViewer>
<dxg:GridControl x:Name="grid" ShowBorder="False" ItemsSource="{Binding Path= ShootPlayerModel,Mode=TwoWay}">
<dxg:GridColumn FieldName="rank" Header="排名" Width="112" />
<dxg:GridColumn FieldName="figureName" Header="球员名称" Width="112" />
<dxg:GridColumn FieldName="teamLogo" Header="球队国旗" Width="112"/>
<dxg:GridColumn FieldName="shortTeamName" Header="球队名称" Width="112"/>
<dxg:GridColumn FieldName="games" Header="场次" Width="180" />
<dxg:GridColumn FieldName="goals" Header="进球数" Width="180" />
<!--<dxg:GridColumn FieldName="penaltyGoals" Header="点球" Width="100" />-->
<dxg:GridControl.View>
<!--<dxg:TableView AutoWidth="True" ShowGroupPanel="False"
BorderThickness="0"
ShowFilterPanelMode="Never"
AllowColumnFiltering="False"
AllowSorting="False"
IsColumnMenuEnabled="False" >
</dxg:TableView>-->
<dxg:TableView IsColumnMenuEnabled="True"
IsColumnChooserVisible="{Binding Path=IsColumnChooserVisible,Mode=TwoWay}"
AllowEditing="True" ShowIndicator="False" AutoWidth="True"
NavigationStyle="Cell" ShowVerticalLines="False" ShowHorizontalLines="False"
ShowGroupPanel="False" EditorShowMode="MouseDown"
AllowDragDrop="True"
AlternateRowBackground="#05ffffff"
ShowBandsPanel="False"
ShowTotalSummary="False"
ShowFixedTotalSummary="False"
ShowDragDropHint="False"
AllowSorting="False"
AllowColumnFiltering="False"
ShowTargetInfoInDragDropHint="false">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="ShowGridMenu" Command="{Binding ElementName=uc, Path=DataContext.ShowGridMenuCommand}" PassEventArgsToCommand="True"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<dxg:TableView.ColumnMenuCustomizations>
<dxb:BarButtonItem Name="ShowColumnChooser" Content="显示列选择"
Command="{Binding ElementName=uc,Path=DataContext.ColumnChoiceCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
</dxg:TableView.ColumnMenuCustomizations>
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
</DockPanel>
</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;
using VIZ.Package.Domain;
using VIZ.Package.Service;
using VIZ.Package.Storage;
namespace VIZ.TVP.WMCUP.Module
{
/// <summary>
/// ShootPlayerRankView.xaml 的交互逻辑
/// </summary>
public partial class ShootPlayerRankView : UserControl, IPluginView
{
ShootPlayerRankViewModel vm = new ShootPlayerRankViewModel();
/// <summary>
/// 操作日志服务
/// </summary>
private RecordLogService recordLogService = new RecordLogService();
public ShootPlayerRankView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, vm);
ShootPlayerRankViewModel.ShootPlayerRanklInstance = vm;
}
public void Dispose()
{
}
public void PageOpend(ConnModel conn, PageModel page)
{
if (conn.IsConnected && vm.ShootPlayerModel != null)
{
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineData()));
}
}
public void PreviewContinue(ConnModel conn)
{
}
public void PreviewIn(ConnModel conn)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_PREVIEW_PLAY);
if (conn.IsConnected && vm.ShootPlayerModel != null)
{
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineData()));
}
}
public void PreviewOut(ConnModel conn)
{
}
public void PreviewUpdate(ConnModel conn)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_PREVIEW_UPDATE);
if (conn.IsConnected && vm.ShootPlayerModel != null)
{
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineData()));
}
}
public void TakeContinue(ConnModel conns)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_TAKE_CONTINUE);
if (conns.IsConnected && vm.ShootPlayerModel != null)
{
conns.EndpointManager.Send(VizEngineCommands.STAGE_CONTINUE);
}
}
public void TakeOut(ConnModel conns)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_TAKE_OUT);
if (conns.IsConnected && vm.ShootPlayerModel != null)
{
conns.EndpointManager.Send(VizEngineCommands.STAGE_CONTINUE);
}
}
public void TakeUpdate(ConnModel conns)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_TAKE_UPDATE);
if (conns.IsConnected && vm.ShootPlayerModel != null)
{
conns.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineData()));
}
}
public void TakIn(ConnModel conns)
{
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_TAKE_TAKE);
if (conns.IsConnected && vm.ShootPlayerModel != null)
{
conns.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "Data", vm.CombineData()));
}
}
}
}
using DevExpress.Xpf.Grid;
using log4net;
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.Package.Common;
namespace VIZ.TVP.WMCUP.Module
{
/// <summary>
/// 射手榜排名
/// </summary>
public class ShootPlayerRankViewModel : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private static ILog Log = LogManager.GetLogger(typeof(ShootPlayerRankViewModel));
/// <summary>
///
/// </summary>
public static ShootPlayerRankViewModel ShootPlayerRanklInstance = new ShootPlayerRankViewModel();
/// <summary>
/// 初始话
/// </summary>
public ShootPlayerRankViewModel()
{
Init();
}
/// <summary>
/// 球员射手榜绑定数据集合
/// </summary>
private ObservableCollection<ShootPlayerRank> shootPlayerModel;
public ObservableCollection<ShootPlayerRank> ShootPlayerModel
{
get { return shootPlayerModel; }
set { shootPlayerModel = value; this.RaisePropertyChanged(nameof(ShootPlayerModel)); }
}
public VCommand BtnCmd { get; set; }
ShootPlayerRanks shootPlayerRanks = null;
/// <summary>
/// 刷新球队积分排名
/// </summary>
private async void BtmCommand()
{
shootPlayerRanks = new ShootPlayerRanks();
shootPlayerRanks = await JsonModel.Post_ShootPlayerRankData(FoolballType, SeasonId, StartOffset, EndOffset);
if (shootPlayerRanks == null) return;
ShootPlayerModel = new ObservableCollection<ShootPlayerRank>();
foreach (var playerRank in shootPlayerRanks.playerstats)
{
playerRank.playerLogo = playerRank.figureName;
playerRank.teamLogo = playerRank.teamName;
if (playerRank.goals != "0")
{
playerRank.goals = playerRank.goals.TrimEnd('0').TrimEnd('.');
}
if (playerRank.penaltyGoals != "0")
{
playerRank.penaltyGoals = playerRank.penaltyGoals.TrimEnd('0').TrimEnd('.');
}
ShootPlayerModel.Add(playerRank);
}
}
/// <summary>
/// 组装积分排名数据上传
/// </summary>
/// <returns></returns>
public string CombineData()
{
try
{
string data = "";
data += title;
data += "&";
foreach (var tempTeamRankModel in ShootPlayerModel)
{
//data += tempTeamRankModel.rank.ToString().Replace(" ", "");
//data += "*";
if (string.IsNullOrEmpty(tempTeamRankModel.figureName))
{
data += "";
}
else
{
data += tempTeamRankModel.figureName.Replace(" ", "");
}
data += "*";
if (string.IsNullOrEmpty(tempTeamRankModel.teamLogo))
{
data += "";
}
else
{
data += tempTeamRankModel.teamLogo.Replace(" ", "");
}
data += "*";
if (string.IsNullOrEmpty(tempTeamRankModel.teamName))
{
data += "";
}
else
{
data += tempTeamRankModel.teamName.Replace(" ", "");
}
data += "*";
if (string.IsNullOrEmpty(tempTeamRankModel.games))
{
data += "";
}
else
{
data += tempTeamRankModel.games.Replace(" ", "");
}
data += "*";
if (string.IsNullOrEmpty(tempTeamRankModel.goals))
{
data += "";
}
else
{
data += tempTeamRankModel.goals.Replace(" ", "");
}
//data += "*";
//data += tempTeamRankModel.teamLogo.Replace(" ", "");
//data += "*";
//data += tempTeamRankModel.figureName.ToString().Replace(" ", "");
//data += "*";
//data += tempTeamRankModel.goals.ToString().Replace(" ", "");
//data += "*";
//data += tempTeamRankModel.penaltyGoals.ToString().Replace(" ", "");
data += ";";
}
return data;
}
catch (Exception ex)
{
Log.Error(ex.Message);
return "";
}
}
private string title = "射手榜";
public string Title
{
get { return title; }
set
{
title = value;
this.RaisePropertyChanged(nameof(Title));
}
}
/// <summary>
/// 开始条数
/// </summary>
private string startOffset = "0";
public string StartOffset
{
get { return startOffset; }
set
{
startOffset = value;
this.RaisePropertyChanged(nameof(StartOffset));
}
}
/// <summary>
/// 结束条数
/// </summary>
private string endOffset = "4";
public string EndOffset
{
get { return endOffset; }
set
{
endOffset = value;
this.RaisePropertyChanged(nameof(EndOffset));
}
}
/// <summary>
/// 足球赛事类型
/// </summary>
public string FoolballType = "";
/// <summary>
/// 赛季ID
/// </summary>
public string SeasonId = "";
/// <summary>
/// 初始话
/// </summary>
private void Init()
{
BtnCmd = new VCommand(BtmCommand);
PromptCommand = new VCommand(PromptCmd);
ColumnChoiceCommand = new VCommand(ColumnChoice);
ShowGridMenuCommand = new VCommand<GridMenuEventArgs>(ShowGridMenu);
FoolballType = DateHeaderViewModel.FoolballType;
SeasonId = DateHeaderViewModel.SeasonId;
}
#region IsColumnChooserVisible -- 是否显示列选择器
private bool isColumnChooserVisible;
/// <summary>
/// 是否显示列选择器
/// </summary>
public bool IsColumnChooserVisible
{
get { return isColumnChooserVisible; }
set { isColumnChooserVisible = value; this.RaisePropertyChanged(nameof(IsColumnChooserVisible)); }
}
#endregion
#region ColumnChoiceCommand -- 列选择命令
/// <summary>
/// 列选择命令
/// </summary>
public VCommand ColumnChoiceCommand { get; set; }
/// <summary>
/// 列选择
/// </summary>
private void ColumnChoice()
{
this.IsColumnChooserVisible = true;
}
#endregion
#region ShowGridMenuCommand -- 显示列命令
/// <summary>
/// 显示列命令
/// </summary>
public VCommand<GridMenuEventArgs> ShowGridMenuCommand { get; set; }
/// <summary>
/// 显示列
/// </summary>
/// <param name="e">事件参数</param>
private void ShowGridMenu(GridMenuEventArgs e)
{
GridControlHelper.RemoveAllDefaultMenuItem(e);
}
#endregion
#region 打开更新数据时间日志
/// <summary>
/// 打开数据更新日志
/// </summary>
public VCommand PromptCommand { get; set; }
MessageLastRecordDate messageLastRecordDate = new MessageLastRecordDate();
private void PromptCmd()
{
MessageLRDateViewModel vm = messageLastRecordDate.DataContext as MessageLRDateViewModel;
if (shootPlayerRanks != null)
{
string LastDate = $"射手榜积分接口更新时间:{shootPlayerRanks.LastPushDataDateTime}";
vm.OnErrorLogMessage(LastDate);
}
messageLastRecordDate.Visibility = System.Windows.Visibility.Visible;
messageLastRecordDate.WindowState = System.Windows.WindowState.Normal;
}
#endregion
}
}
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public class AppSetup_InitLiteDB
{
private static AppSetup_InitLiteDB _createInstance = null;
public static AppSetup_InitLiteDB CreateInstance
{
get
{
if (null == _createInstance)
{
_createInstance = new AppSetup_InitLiteDB();
}
return _createInstance;
}
}
/// <summary>
/// 日志
/// </summary>
private static ILog log = LogManager.GetLogger(typeof(AppSetup_InitLiteDB));
/// <summary>
/// 描述
/// </summary>
public static string Detail { get; } = "应用程序启动 -- 初始化LiteDB";
/// <summary>
/// CBA数据库Context
/// </summary>
public static LocalDbContext localDbContext { get; set; }
public static HttpUrlConfigEntity HttpUrlConfigEntity { get; set; }
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public AppSetup_InitLiteDB()
{
string folder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "db");
if (!System.IO.Directory.Exists(folder))
{
System.IO.Directory.CreateDirectory(folder);
}
string path = System.IO.Path.Combine(folder, "FootballCache.db");
log.Error(path);
localDbContext = new LocalDbContext(path);
HttpUrlConfigEntity = localDbContext.HttpUrlConfig.FindAll().FirstOrDefault() ?? new HttpUrlConfigEntity();
}
}
}
using LiteDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public class HttpUrlConfigEntity
{
/// <summary>
/// 编号
/// </summary>
[BsonId(true)]
public int Id { get; set; }
#region 主数据连接地址
/// <summary>
/// 地址
/// </summary>
public string Url { get; set; } = "http://180.184.78.246:18080/miku/api/open_api/proxy_api/miku/api/system_base/migu/football/";
/// <summary>
/// 应用程序Id
/// </summary>
public string AppId { get; set; } = "100001";
/// <summary>
/// 应用程序Key
/// </summary>
public string AppKey { get; set; } = "ffrw7ilc8i6r3pkzvl";
#endregion
#region 备份数据连接地址
/// <summary>
/// 地址
/// </summary>
public string BUrl { get; set; } = "http://180.184.78.246:18080/miku/api/open_api/proxy_api/miku/api/system_base/migu/football/";
/// <summary>
/// 应用程序Id
/// </summary>
public string BAppId { get; set; } = "100001";
/// <summary>
/// 应用程序Key
/// </summary>
public string BAppKey { get; set; } = "ffrw7ilc8i6r3pkzvl";
/// <summary>
/// 五大联赛
/// </summary>
// public string SelectFootballType { get; set; } = "德甲";
/// <summary>
/// 选择赛季
/// </summary>
// public string SelectSeason { get; set; }
////英超赛季Id
//public string EPCSeasonId { get; set; }
////英超选中赛季
//public string SelectEPCSeasonId { get; set; }
////法甲赛季Id
//public string FL1SeasonId { get; set; }
//// 法甲选中赛季
//public string SelectFL1SeasonId { get; set; }
////意甲赛季Id
//public string ISASeasonId { get; set; }
////意甲选中赛季
//public string SelectISASeasonId { get; set; }
////德甲赛季Id
//public string LIGASeasonId { get; set; }
////德甲选中赛季
//public string SelectLIGASeasonId { get; set; }
////西甲赛季Id
//public string SLPSeasonId { get; set; }
////西甲选中赛季
//public string SelectSLPSeasonId { get; set; }
#endregion
}
}
using LiteDB;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.WMCUP.Module
{
public class LocalDbContext
{
/// <summary>
/// 日志
/// </summary>
private static ILog log = LogManager.GetLogger(typeof(LocalDbContext));
/// <summary>
/// 数据库
/// </summary>
private ILiteDatabase Database;
/// <summary>
/// LiteDB数据库
/// </summary>
/// <param name="path">数据库路径</param>
public LocalDbContext(string path)
{
this.Path = path;
this.Database = new LiteDatabase(path);
this.HttpUrlConfig = this.Database.GetCollection<HttpUrlConfigEntity>();
}
/// <summary>
/// 数据库文件路径
/// </summary>
public string Path { get; private set; }
/// <summary>
/// 数据访问接口配置
/// </summary>
public ILiteCollection<HttpUrlConfigEntity> HttpUrlConfig { get; private set; }
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
{
this.HttpUrlConfig = null;
this.Database?.Dispose();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LiteDB" version="5.0.15" targetFramework="net48" />
<package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
</packages>
\ 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