Commit 47270184 by 鲁志-悦动

设置参数设置参数保存到数据库,页面初始化从数据库读

parent aef6317b

//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace XamlGeneratedNamespace {
/// <summary>
/// GeneratedInternalTypeHelper
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed class GeneratedInternalTypeHelper : System.Windows.Markup.InternalTypeHelper {
/// <summary>
/// CreateInstance
/// </summary>
protected override object CreateInstance(System.Type type, System.Globalization.CultureInfo culture) {
return System.Activator.CreateInstance(type, ((System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic)
| (System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.CreateInstance)), null, null, culture);
}
/// <summary>
/// GetPropertyValue
/// </summary>
protected override object GetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, System.Globalization.CultureInfo culture) {
return propertyInfo.GetValue(target, System.Reflection.BindingFlags.Default, null, null, culture);
}
/// <summary>
/// SetPropertyValue
/// </summary>
protected override void SetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, object value, System.Globalization.CultureInfo culture) {
propertyInfo.SetValue(target, value, System.Reflection.BindingFlags.Default, null, null, culture);
}
/// <summary>
/// CreateDelegate
/// </summary>
protected override System.Delegate CreateDelegate(System.Type delegateType, object target, string handler) {
return ((System.Delegate)(target.GetType().InvokeMember("_CreateDelegate", (System.Reflection.BindingFlags.InvokeMethod
| (System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)), null, target, new object[] {
delegateType,
handler}, null)));
}
/// <summary>
/// AddEventHandler
/// </summary>
protected override void AddEventHandler(System.Reflection.EventInfo eventInfo, object target, System.Delegate handler) {
eventInfo.AddEventHandler(target, handler);
}
}
}
......@@ -10,11 +10,11 @@ none
false
21870986562
2-725104376
31364711570
17-1683084370
3947974750
17-1462717611
Themes\Generic.xaml;Widgets\FootballFieldPanel\FootballFieldPanel.xaml;
False
True
......@@ -10,11 +10,11 @@ none
false
DEBUG;TRACE
181380438361
1-1441241311
11-1602666439
23-2035776870
18560433975
1470602451
11-350624472
24-1321085892
Style\Button\Button_NdiView.xaml;Style\Button\Button_Setting.xaml;Style\Button\Button_WindowTop.xaml;Style\CheckBox\CheckBox_NdiView.xaml;Style\CheckBox\CheckBox_Setting.xaml;Style\CheckBox\CheckBox_WindowTop.xaml;Style\ComboBox\ComboBox_Setting.xaml;Style\HotkeyBox\HotkeyBox_Setting.xaml;Style\MessageBox\MessageBoxEx.xaml;Style\RadioButton\RadioButton_FootballSide.xaml;Style\RadioButton\RadioButton_NdiView.xaml;Style\RadioButton\RadioButton_Setting.xaml;Style\Slider\Slider_Setting.xaml;Style\TextBlock\TextBlock_Setting.xaml;Style\TextBox\TextBox_Setting.xaml;Style\ToogleButton\ToogleButton_Setting.xaml;Themes\Generic.xaml;Toolkit\NumericUpDown\NumericUpDown.xaml;
True
False
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO.Packaging;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using System.Windows.Shapes;
using System.Windows.Interop;
using VIZ.FGOUT.Connection;
using VIZ.FGOUT.Connection.UDP.Clip.Signal.Send;
using VIZ.FGOUT.Domain;
......@@ -211,7 +209,10 @@ namespace VIZ.FGOUT.Module
{
PresetsItem = dics[number];
var config = ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.FindOne(p => p.Number == number);
//初始化UE预设数据
InitUEDetail(config.Data);
//初始化算法数据
InitAlgorithmData(config.AlgorithmData);
}
}
......@@ -293,6 +294,7 @@ namespace VIZ.FGOUT.Module
//网络终结点key
private string _endpointKey = "UE";
private string _ueMessage = "";
/// <summary>
/// 发送自定义的预设数据
/// </summary>
......@@ -305,7 +307,7 @@ namespace VIZ.FGOUT.Module
if (manager == null) return;
UEPackage uePackage = new UEPackage();
//uePackage.UE_Presets.StartSets.EventCode = GetDicKey(PresetsItem);
uePackage.UE_Presets.StartSets.EventCode = GetDicKey(PresetsItem);
var zoomSets = new ZoomSets();
zoomSets.ZoomEase = ZoomEaseItem;
zoomSets.MoveEase = MoveEaseItem;
......@@ -339,15 +341,15 @@ namespace VIZ.FGOUT.Module
uePackage.UE_Presets.StartSets.Datas.Positions = positions;
//发送自定义预设参数
string msg = uePackage == null ? string.Empty : JsonConvert.SerializeObject(uePackage, JSON_SERIALIZER_SETTINGS);
_ueMessage = uePackage == null ? string.Empty : JsonConvert.SerializeObject(uePackage, JSON_SERIALIZER_SETTINGS);
manager.SendJson(uePackage);
#region 项目预设数据更新到LiteDB
JavelinThrowConfig javelinThrowConfig = ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.FindAll().FirstOrDefault();
if (javelinThrowConfig == null) return;
javelinThrowConfig.Number = GetDicKey(PresetsItem);
javelinThrowConfig.Data = msg;
ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.Upsert(javelinThrowConfig);
//JavelinThrowConfig javelinThrowConfig = ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.FindAll().FirstOrDefault();
//if (javelinThrowConfig == null) return;
//javelinThrowConfig.Number = GetDicKey(PresetsItem);
//javelinThrowConfig.Data = msg;
//ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.Upsert(javelinThrowConfig);
#endregion
//MessageBoxEx.ShowDialog("Save Succeed");
}
......@@ -377,6 +379,14 @@ namespace VIZ.FGOUT.Module
//发送算法参数
SendAlgorithmParameters();
JavelinThrowConfig javelinThrowConfig = ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.FindOne(p => p.Number == GetDicKey(PresetsItem));
if (javelinThrowConfig != null)
{
javelinThrowConfig.Data = _ueMessage;
javelinThrowConfig.AlgorithmData = _algorithmMessage;
ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.Upsert(javelinThrowConfig);
}
this.ViewConfig.GameName = GetDicKey(PresetsItem);
ApplicationDomainEx.LiteDbContext.ViewConfig.Upsert(this.ViewConfig);
}
......@@ -495,6 +505,7 @@ namespace VIZ.FGOUT.Module
}
}
private string _algorithmMessage = "";
private void SendAlgorithmParameters()
{
//如果没有选择预设则不发送
......@@ -514,9 +525,18 @@ namespace VIZ.FGOUT.Module
package.Pad_det_square = Pad_det_square;
package.Scale = AScale;
_algorithmMessage = package == null ? string.Empty : JsonConvert.SerializeObject(package, JSON_SERIALIZER_SETTINGS);
manager.SendJson(package);
//MessageBoxEx.ShowDialog("发送成功 IP = " + manager.IP + " Port =" + manager.Port);
//MessageBoxEx.ShowDialog("发送成功");
#region 算法数据更新到LiteDB
//JavelinThrowConfig javelinThrowConfig = ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.FindAll().FirstOrDefault();
//if (javelinThrowConfig == null) return;
//javelinThrowConfig.Number = GetDicKey(PresetsItem);
//javelinThrowConfig.AlgorithmData = msg;
//ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.Upsert(javelinThrowConfig);
#endregion
}
#endregion
......@@ -557,6 +577,7 @@ namespace VIZ.FGOUT.Module
{
var config = GetConfig(PresetsItem);
InitUEDetail(config.Data);
InitAlgorithmData(config.AlgorithmData);
}
}
......@@ -581,6 +602,10 @@ namespace VIZ.FGOUT.Module
Line = false;
}
/// <summary>
/// 初始化UE预设数据
/// </summary>
/// <param name="data"></param>
private void InitUEDetail(string data)
{
var uePackage = (UEPackage)JsonConvert.DeserializeObject(data, typeof(UEPackage));
......@@ -606,6 +631,22 @@ namespace VIZ.FGOUT.Module
Line = splineSets.bLineBehind;
}
/// <summary>
/// 初始化算法预设数据
/// </summary>
/// <param name="data"></param>
private void InitAlgorithmData(string data)
{
var alPackage = (AlgorithmPackage_Figout_sports_model)JsonConvert.DeserializeObject(data, typeof(AlgorithmPackage_Figout_sports_model));
Maintain_matting_n = alPackage.Maintain_matting_n;
Matting_interval = alPackage.Matting_interval;
Extend_frame = alPackage.Extend_frame;
Pad_det_x = alPackage.Pad_det_x;
Pad_det_y = alPackage.Pad_det_y;
Pad_det_square = alPackage.Pad_det_square;
AScale = alPackage.Scale;
}
#region 预设属性
private string _zoomEaseItem = string.Empty;
......
......@@ -15,8 +15,13 @@
/// <summary>
/// 数据
/// UE预设数据
/// </summary>
public string Data { get; set; }
/// <summary>
/// 算法数据
/// </summary>
public string AlgorithmData { get; set; }
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
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