AIMS/DrawGraph/BoardPack/PackObjBase.cs
2022-08-23 21:12:59 +08:00

670 lines
12 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using DrawGraph;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
namespace DrawGraph
{
[JsonObject(MemberSerialization.OptOut)]
[Serializable]
public class PackObjBase
{
public delegate void ChangedEventHandler(PackObjBase pob);
[NonSerialized]
protected PackObjManager poManager = null;
[JsonIgnore]
[NonSerialized]
protected ZedGraphControl baseZed = null;
[NonSerialized]
private PackObjBase setParent = null;
private string parentName = "";
public string ClassName = "";
private string packName = "";
private string packTag = "";
private string dataSourceName = "";
private string packTypeTag = "";
private string packText = "";
private string packValue = "";
private string defaultValue = "";
private string defaultSelectValue = "";
protected int index = 0;
private bool isSelect = false;
private int myOrder = 1;
private string descript = "";
private float x = 0f;
private float y = 0f;
private float endX = 0f;
private float endY = 0f;
protected float width = 0f;
protected float height = 0f;
private bool isSelfFresh = true;
private int zjpyl = 0;
private int hzjpyl = 0;
private int dfHzjpyl = 0;
private int tabIndex = 0;
private EIsBool isRequired = EIsBool.False;
private EIsBool isCascadeUnderpinning = EIsBool.True;
private EConvertMode convertMode = 0;
private List<CodeTableItem> codeTableItems = new List<CodeTableItem>();
public static string fontFamily = PackObjBase.GetFontFamily();
[method: CompilerGenerated]
//[DebuggerBrowsable(DebuggerBrowsableState.Never), CompilerGenerated]
public event PackObjBase.ChangedEventHandler Changed;
[ClassAttributs(CName = "排序", Description = "优先级由高到低显示字体类型,线面类型,图表类型\r\n每个类型里组件以此属性确认画时的顺序")]
public int MyOrder
{
get
{
return this.myOrder;
}
set
{
this.myOrder = value;
}
}
[JsonIgnore]
public PackObjBase SetParent
{
get
{
return this.setParent;
}
set
{
this.setParent = value;
bool flag = value != null;
if (flag)
{
this.parentName = value.PackName;
}
}
}
[ClassAttributs(CName = "父类的Name", Message = "readOnly", Description = "父类的PackName属性,用于保存后找回自己的父类")]
public string ParentName
{
get
{
return this.parentName;
}
set
{
this.parentName = value;
}
}
[ClassAttributs(Message = "readOnly", Description = "控件名称", CName = "控件名称")]
public string PackName
{
get
{
return this.packName;
}
set
{
this.packName = value;
}
}
[ClassAttributs(CName = "是否被选中", Description = "是否被选中"), JsonIgnore]
public bool IsSelect
{
get
{
return this.isSelect;
}
set
{
this.isSelect = value;
}
}
[ClassAttributs(CName = "显示文本", Description = "显示文本")]
public string PackText
{
get
{
string descVal = this.packText;
bool flag = this.ConvertMode == EConvertMode.CodeTableConvert;
if (flag)
{
CodeTableItem codeTableItem = this.CodeTableItems.FirstOrDefault((CodeTableItem s) => s.SrcVal == this.packText);
bool flag2 = codeTableItem != null;
if (flag2)
{
descVal = codeTableItem.DescVal;
}
}
return descVal;
}
set
{
bool flag = value.Trim() == "";
if (flag)
{
value = this.DefaultValue;
}
this.packText = value;
}
}
[ClassAttributs(CName = "组件的值", Description = "组件的值")]
public string PackValue
{
get
{
return this.packValue;
}
set
{
this.packValue = value;
}
}
[ClassAttributs(CName = "组件描述", Description = "对象的描述,树节点的显示内容")]
public string Descript
{
get
{
return this.descript;
}
set
{
this.descript = value;
bool flag = this.Changed != null;
if (flag)
{
this.Changed(this);
}
}
}
[ClassAttributs(CName = "标签名称", Description = "标签的名称\r\n标签的组件名 + _ + 标签的数据源名 组成")]
public string PackTag
{
get
{
return this.packTag;
}
set
{
this.packTag = value;
}
}
[ClassAttributs(CName = "开始Y")]
public float Y
{
get
{
return this.y;
}
set
{
this.y = value;
}
}
[ClassAttributs(CName = "开始X")]
public float X
{
get
{
return this.x;
}
set
{
this.x = value;
}
}
[ClassAttributs(CName = "结束Y", Description = "可编辑区域的结束Y点的值")]
public float EndY
{
get
{
return this.endY;
}
set
{
this.endY = value;
}
}
[ClassAttributs(CName = "结束X", Description = "可编辑区域的结束X点的值")]
public float EndX
{
get
{
return this.endX;
}
set
{
this.endX = value;
}
}
[NoCreatControlAttributs, JsonIgnore]
public float RealEndY
{
get
{
return this.poManager.Y + this.EndY;
}
}
[NoCreatControlAttributs, JsonIgnore]
public float RealEndX
{
get
{
return this.poManager.X + this.EndX;
}
}
[NoCreatControlAttributs, JsonIgnore]
public float RealY
{
get
{
return this.poManager.Y + this.Y;
}
}
[NoCreatControlAttributs, JsonIgnore]
public float RealX
{
get
{
return this.poManager.X + this.X;
}
}
[ClassAttributs(CName = "标签数据源名称", Message = "readOnly", Description = "标签的数据源名\r\n用于显示标签的数据源名称部分")]
public string DataSourceName
{
get
{
return this.dataSourceName.Trim();
}
set
{
this.dataSourceName = value;
}
}
[ClassAttributs(CName = "类数据源名称", Message = "readOnly", Description = "类赋值上用的数据源名称\r\n用于为数据源属性赋值时提供属性名称的"), JsonIgnore]
public string ClassDataSourceName
{
get
{
return this.dataSourceName.Replace("_", ".");
}
}
[ClassAttributs(Message = "readOnly", Description = "标签的组件名\r\n由区域+组件类型+唯一索引组成"), NoCreatControlAttributs]
public string PackTypeTag
{
get
{
return this.packTypeTag;
}
set
{
this.packTypeTag = value;
}
}
[NoCreatControlAttributs]
public bool IsSelfFresh
{
get
{
return this.isSelfFresh;
}
set
{
this.isSelfFresh = value;
}
}
[NoCreatControlAttributs]
public int Zjpyl
{
get
{
return this.zjpyl;
}
set
{
this.zjpyl = value;
}
}
[ClassAttributs(CName = "是否必填", Message = "readOnly", Description = "是否必填项\r\n默认为FALSE非必填项")]
public EIsBool IsRequired
{
get
{
return this.isRequired;
}
set
{
this.isRequired = value;
}
}
[ClassAttributs(CName = "默认值", Description = "默认值")]
public string DefaultValue
{
get
{
return this.defaultValue;
}
set
{
this.defaultValue = value;
}
}
[ClassAttributs(CName = "Tab值", Description = "Tab值")]
public int TabIndex
{
get
{
return this.tabIndex;
}
set
{
this.tabIndex = value;
}
}
[NoCreatControlAttributs]
public int Hzjpyl
{
get
{
return this.hzjpyl;
}
set
{
this.hzjpyl = value;
}
}
[NoCreatControlAttributs]
public int DfHzjpyl
{
get
{
return this.dfHzjpyl;
}
set
{
this.dfHzjpyl = value;
}
}
[ClassAttributs(CName = "默认选择值", Description = "默认选择的值,可以用于设置默认值")]
public string DefaultSelectValue
{
get
{
return this.defaultSelectValue;
}
set
{
this.defaultSelectValue = value;
}
}
[NoCreatControlAttributs, JsonIgnore]
public float Width
{
get
{
float result = this.width;
bool flag = this.X != this.EndX;
if (flag)
{
result = this.EndX - this.X;
}
return result;
}
}
[NoCreatControlAttributs, JsonIgnore]
public float Height
{
get
{
float result = this.height;
bool flag = this.Y != this.EndY;
if (flag)
{
result = this.EndY - this.Y;
}
return result;
}
}
[ClassAttributs(CName = "级联拖动", Description = "是否级联拖动"), JsonIgnore]
public EIsBool IsCascadeUnderpinning
{
get
{
return this.isCascadeUnderpinning;
}
set
{
this.isCascadeUnderpinning = value;
}
}
[ClassAttributs(Description = "值的转换类型,默认不转换", CName = "是否值转换")]
public EConvertMode ConvertMode
{
get
{
return this.convertMode;
}
set
{
this.convertMode = value;
}
}
[NoCreatControlAttributs]
public List<CodeTableItem> CodeTableItems
{
get
{
return this.codeTableItems;
}
set
{
this.codeTableItems = value;
}
}
private static string GetFontFamily()
{
string result;
try
{
string text = null;// ConfigurationManager.AppSettings["NurseFontFamily"];
bool flag = text == null;
if (flag)
{
result = "宋体";
}
else
{
result = text;
}
}
catch (Exception)
{
result = "宋体";
}
return result;
}
public void CreatePackTag()
{
this.packTag = (this.packTypeTag = string.Concat(new string[]
{
this.poManager.ClassName,
"_",
base.GetType().Name.ToString(),
"_",
this.index.ToString()
}));
bool flag = this.dataSourceName != "";
if (flag)
{
this.packTag = this.packTag + "_" + this.dataSourceName;
}
}
public PackObjBase()
{
}
public PackObjBase(ZedGraphControl zgc, PackObjManager _poManager)
{
bool flag = _poManager == null;
if (!flag)
{
this.poManager = _poManager;
this.ClassName = base.GetType().Name;
this.baseZed = zgc;
this.index = this.poManager.GetControlIndex();
this.packTag = (this.PackTypeTag = string.Concat(new string[]
{
this.poManager.ClassName,
"_",
base.GetType().Name.ToString(),
"_",
this.index.ToString()
}));
this.packName = base.GetType().Name.ToString() + this.index.ToString();
this.descript = base.GetType().Name.ToString() + this.index.ToString();
this.myOrder = this.index;
this.tabIndex = this.index;
this.PackText = "基础板的参数对象";
}
}
public virtual void Draw()
{
}
protected void Refresh()
{
bool flag = this.isSelfFresh;
if (flag)
{
this.baseZed.AxisChange();
this.baseZed.Refresh();
}
}
internal void SetZedControl(ZedGraphControl zedControl)
{
this.baseZed = zedControl;
}
public virtual void Clear()
{
bool flag = this.baseZed.MasterPane == null;
if (!flag)
{
GraphObj graphObj = this.baseZed.MasterPane.GraphObjList[this.PackTag];
bool flag2 = graphObj != null;
if (flag2)
{
this.baseZed.MasterPane.GraphObjList.Remove(graphObj);
}
this.Refresh();
}
}
public PackObjBase Clone()
{
return (PackObjBase)base.MemberwiseClone();
}
public PackObjBase CloneParse()
{
PackObjBase packObjBase = (PackObjBase)base.MemberwiseClone();
packObjBase.index = this.poManager.GetControlIndex();
packObjBase.packTag = (packObjBase.PackTypeTag = string.Concat(new string[]
{
this.poManager.ClassName,
"_",
base.GetType().Name.ToString(),
"_",
this.index.ToString()
}));
packObjBase.packName = packObjBase.GetType().Name.ToString() + packObjBase.index.ToString();
packObjBase.descript = packObjBase.GetType().Name.ToString() + packObjBase.index.ToString();
packObjBase.PackText = "基础板的参数对象";
return packObjBase;
}
public bool InScope(float x, float y)
{
bool result = false;
bool flag = x >= this.RealX && x <= this.RealX + this.Width && y >= this.RealY && y <= this.RealY + this.Height;
if (flag)
{
result = true;
}
return result;
}
}
}