185 lines
7.4 KiB
C#
185 lines
7.4 KiB
C#
using _20230724_MBJC_upperpc.Models;
|
|
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 _20230724_MBJC_upperpc.Views
|
|
{
|
|
/// <summary>
|
|
/// FirstPageBuoyControl.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class FirstPageBuoyControl : UserControl
|
|
{
|
|
//字体颜色
|
|
public Brush Text_Color
|
|
{
|
|
get { return (Brush)GetValue(Text_ColorProperty); }
|
|
set { SetValue(Text_ColorProperty, value); }
|
|
}
|
|
|
|
// Using a DependencyProperty as the backing store for _color. This enables animation, styling, binding, etc...
|
|
public static readonly DependencyProperty Text_ColorProperty =
|
|
DependencyProperty.Register("Text_Color", typeof(Brush), typeof(FirstPageBuoyControl), new PropertyMetadata(default(Brush), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
|
|
//字体大小
|
|
public int Font_Size
|
|
{
|
|
get { return (int)GetValue(Font_SizeProperty); }
|
|
set { SetValue(Font_SizeProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty Font_SizeProperty =
|
|
DependencyProperty.Register("Font_Size", typeof(int), typeof(FirstPageBuoyControl), new PropertyMetadata(default(int), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
|
|
|
|
///<summary>
|
|
/// 告警信息
|
|
/// </summary>
|
|
public string AlarmInfo
|
|
{
|
|
get { return (string)this.GetValue(AlarmInfoProperty); }
|
|
set { this.SetValue(AlarmInfoProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty AlarmInfoProperty = DependencyProperty.Register("AlarmInfo", typeof(string), typeof(FirstPageBuoyControl), new PropertyMetadata(default(string), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
|
|
///<summary>
|
|
/// Beacon
|
|
/// </summary>
|
|
public BeaconModel Beacon
|
|
{
|
|
get { return (BeaconModel)this.GetValue(BeaconProperty); }
|
|
set { this.SetValue(BeaconProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty BeaconProperty = DependencyProperty.Register("Beacon", typeof(BeaconModel), typeof(FirstPageBuoyControl), new PropertyMetadata(default(BeaconModel), new PropertyChangedCallback(OnPropertyChanged)));
|
|
/// <summary>
|
|
/// 是否可以使用鼠标跟随
|
|
/// </summary>
|
|
public bool TBDEnable
|
|
{
|
|
get { return (bool)this.GetValue(TBDEnableProperty); }
|
|
set { this.SetValue(TBDEnableProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty TBDEnableProperty = DependencyProperty.Register("TBDEnable", typeof(bool), typeof(FirstPageBuoyControl), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
#region
|
|
///// <summary>
|
|
///// 俯仰角
|
|
///// </summary>
|
|
//public float Rotate_X
|
|
//{
|
|
// get { return (float)this.GetValue(Rotate_XProperty); }
|
|
// set { this.SetValue(Rotate_XProperty, value); }
|
|
//}
|
|
|
|
//public static readonly DependencyProperty Rotate_XProperty = DependencyProperty.Register("Rotate_X", typeof(float), typeof(FirstPageBuoyControl), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
|
///// <summary>
|
|
///// 偏航角
|
|
///// </summary>
|
|
//public float Rotate_Y
|
|
//{
|
|
// get { return (float)this.GetValue(Rotate_YProperty); }
|
|
// set { this.SetValue(Rotate_YProperty, value); }
|
|
//}
|
|
///// <summary>
|
|
///// 翻滚角
|
|
///// </summary>
|
|
//public static readonly DependencyProperty Rotate_YProperty = DependencyProperty.Register("Rotate_Y", typeof(float), typeof(FirstPageBuoyControl), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
//public float Rotate_Z
|
|
//{
|
|
// get { return (float)this.GetValue(Rotate_ZProperty); }
|
|
// set { this.SetValue(Rotate_ZProperty, value); }
|
|
//}
|
|
|
|
//public static readonly DependencyProperty Rotate_ZProperty = DependencyProperty.Register("Rotate_Z", typeof(float), typeof(FirstPageBuoyControl), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
///// <summary>
|
|
///// 经度
|
|
///// </summary>
|
|
//public float JD
|
|
//{
|
|
// get { return (float)this.GetValue(JDProperty); }
|
|
// set { this.SetValue(JDProperty, value); }
|
|
//}
|
|
|
|
//public static readonly DependencyProperty JDProperty = DependencyProperty.Register("JD", typeof(float), typeof(FirstPageBuoyControl), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
///// <summary>
|
|
///// 纬度
|
|
///// </summary>
|
|
//public float WD
|
|
//{
|
|
// get { return (float)this.GetValue(WDProperty); }
|
|
// set { this.SetValue(WDProperty, value); }
|
|
//}
|
|
|
|
//public static readonly DependencyProperty WDProperty = DependencyProperty.Register("WD", typeof(float), typeof(FirstPageBuoyControl), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
///// <summary>
|
|
///// 深度
|
|
///// </summary>
|
|
//public float SD
|
|
//{
|
|
// get { return (float)this.GetValue(SDProperty); }
|
|
// set { this.SetValue(SDProperty, value); }
|
|
//}
|
|
|
|
//public static readonly DependencyProperty SDProperty = DependencyProperty.Register("SD", typeof(float), typeof(FirstPageBuoyControl), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
|
#endregion
|
|
public static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
(d as FirstPageBuoyControl).Refresh();
|
|
}
|
|
public FirstPageBuoyControl()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Refresh()
|
|
{
|
|
//将其余值进行赋值
|
|
if (Beacon != null)
|
|
{
|
|
this.BuoyModel.Rotate_X = Beacon.Position_Pitch_Angle;
|
|
this.BuoyModel.Rotate_Y = Beacon.Position_Heading_Angle;
|
|
this.BuoyModel.Rotate_Z = Beacon.BasicSite_Heading;
|
|
|
|
this.DateTime.Text = Beacon.Datetime.ToString("yyyy-MM-dd HH:mm:ss");
|
|
this.TextJD.Text = Beacon.BasicSite_JD + "°";
|
|
this.TextWD.Text = Beacon.BasicSite_WD + "°";
|
|
this.TextSD.Text = Beacon.BasicSite_Depth + "米";
|
|
this.TextFGJ.Text = Beacon.BasicSite_Heading + "°";
|
|
this.TextFYJ.Text = Beacon.Position_Pitch_Angle + "°";
|
|
this.TextPHJ.Text = Beacon.Position_Heading_Angle + "°";
|
|
}
|
|
|
|
//设置告警信息
|
|
this.TextAlarm.Text = AlarmInfo;
|
|
//是否可以使用鼠标跟随
|
|
this.BuoyModel.TBDEnable = TBDEnable;
|
|
//设置字体颜色和字体大小
|
|
this.TextJD.Foreground = this.Text_Color;
|
|
if (this.Font_Size != 0)
|
|
this.TextJD.FontSize = this.Font_Size;
|
|
}
|
|
|
|
}
|
|
}
|