Browse Source

移除不需要的文件

样式分支
fyf 2 years ago
parent
commit
b571068f64
54 changed files with 55 additions and 5053 deletions
  1. +0
    -32
      BPASmartClient.Compiler/BPASmartClient.Compiler.csproj
  2. +0
    -181
      BPASmartClient.Compiler/CSharpConfig.cs
  3. +0
    -94
      BPASmartClient.Compiler/Config.cs
  4. +0
    -68
      BPASmartClient.Compiler/FJson.cs
  5. +0
    -178
      BPASmartClient.Compiler/FRedisClient.cs
  6. +0
    -328
      BPASmartClient.Compiler/HttpRequestHelper.cs
  7. +0
    -30
      BPASmartClient.Compiler/IExecutable.cs
  8. +0
    -142
      BPASmartClient.Compiler/MQTT.cs
  9. +0
    -69
      BPASmartClient.Compiler/RedisHelper.cs
  10. +6
    -1
      BPASmartClient.MinimalistUI/BPASmartClient.MinimalistUI.csproj
  11. +2
    -1
      BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml.cs
  12. +4
    -0
      BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
  13. +0
    -0
      BPASmartClient.SCADAControl/DLL/Antlr3.Runtime.dll
  14. BIN
     
  15. +0
    -0
      BPASmartClient.SCADAControl/DLL/Unvell.ReoScript.dll
  16. +0
    -228
      BeDesignerSCADA/Adorners/SelectionAdorner.cs
  17. +0
    -32
      BeDesignerSCADA/Adorners/SelectionAlignLine.cs
  18. +24
    -10
      BeDesignerSCADA/BeDesignerSCADA.csproj
  19. +0
    -990
      BeDesignerSCADA/Controls/CanvasPanel.cs
  20. +11
    -10
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml
  21. +0
    -198
      BeDesignerSCADA/CustomerControls/ArcGauge.cs
  22. +0
    -62
      BeDesignerSCADA/CustomerControls/DigitalNumber.cs
  23. +0
    -14
      BeDesignerSCADA/CustomerControls/GraphArrow.xaml
  24. +0
    -56
      BeDesignerSCADA/CustomerControls/GraphArrow.xaml.cs
  25. +0
    -14
      BeDesignerSCADA/CustomerControls/GraphStar.xaml
  26. +0
    -56
      BeDesignerSCADA/CustomerControls/GraphStar.xaml.cs
  27. +0
    -240
      BeDesignerSCADA/CustomerControls/KnobButton.cs
  28. +0
    -372
      BeDesignerSCADA/CustomerControls/NumberBox.cs
  29. +0
    -101
      BeDesignerSCADA/CustomerControls/StatusLight.cs
  30. +0
    -150
      BeDesignerSCADA/CustomerControls/SwitchButton.cs
  31. +0
    -9
      BeDesignerSCADA/CustomerControls/TheButton.xaml
  32. +0
    -77
      BeDesignerSCADA/CustomerControls/TheButton.xaml.cs
  33. +0
    -9
      BeDesignerSCADA/CustomerControls/TheCheckBox.xaml
  34. +0
    -92
      BeDesignerSCADA/CustomerControls/TheCheckBox.xaml.cs
  35. +0
    -9
      BeDesignerSCADA/CustomerControls/TheComboBox.xaml
  36. +0
    -75
      BeDesignerSCADA/CustomerControls/TheComboBox.xaml.cs
  37. +0
    -9
      BeDesignerSCADA/CustomerControls/TheGroupBox.xaml
  38. +0
    -58
      BeDesignerSCADA/CustomerControls/TheGroupBox.xaml.cs
  39. +0
    -9
      BeDesignerSCADA/CustomerControls/TheImage.xaml
  40. +0
    -57
      BeDesignerSCADA/CustomerControls/TheImage.xaml.cs
  41. +0
    -59
      BeDesignerSCADA/CustomerControls/TheRadioButton.cs
  42. +0
    -69
      BeDesignerSCADA/CustomerControls/TheSlider.cs
  43. +0
    -9
      BeDesignerSCADA/CustomerControls/TheTextBlock.xaml
  44. +0
    -55
      BeDesignerSCADA/CustomerControls/TheTextBlock.xaml.cs
  45. +0
    -61
      BeDesignerSCADA/CustomerControls/TheTextBox.cs
  46. +0
    -99
      BeDesignerSCADA/CustomerControls/TheTimer.cs
  47. +0
    -9
      BeDesignerSCADA/CustomerControls/TheToggleButton.xaml
  48. +0
    -96
      BeDesignerSCADA/CustomerControls/TheToggleButton.xaml.cs
  49. +0
    -187
      BeDesignerSCADA/CustomerControls/WaveProgressBar.cs
  50. BIN
     
  51. BIN
     
  52. +1
    -297
      BeDesignerSCADA/Themes/Styles.xaml
  53. +6
    -1
      SCADA.Test/SCADA.Test.csproj
  54. +1
    -50
      SmartClient.sln

+ 0
- 32
BPASmartClient.Compiler/BPASmartClient.Compiler.csproj View File

@@ -1,32 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.0" />
<PackageReference Include="MQTTnet" Version="3.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ServiceStack.Redis" Version="6.3.0" />
<PackageReference Include="StackExchange.Redis" Version="2.6.66" />
<PackageReference Include="Vse.Web.Serialization.ControlledSerializationJsonConverter" Version="1.0.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="Antlr3.Runtime">
<HintPath>DLL\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unvell.ReoScript">
<HintPath>DLL\Unvell.ReoScript.dll</HintPath>
</Reference>
</ItemGroup>

</Project>

+ 0
- 181
BPASmartClient.Compiler/CSharpConfig.cs View File

@@ -1,181 +0,0 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CSharp;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Runtime;
using System.Runtime.CompilerServices;

namespace BPASmartClient.Compiler
{
/// <summary>
/// C#编译器
/// </summary>
public class CSharpConfig
{
#region 单例模式
public static CSharpConfig Instance = null;

public static CSharpConfig GetInstance()
{
if (Instance == null)
{
Instance = new CSharpConfig();
}
return Instance;
}
#endregion

public CSharpConfig()
{


}



public object RunCSharp(string code,object[] objValue,string error = "")
{
object strretu = string.Empty;
try
{
string funName = "main";
StringBuilder builder = new StringBuilder();
//builder.Append("using System;\n");
//builder.Append("using System.Linq;\n");
builder.Append("using Newtonsoft.Json;\n");
builder.Append("using Newtonsoft.Json.Linq;\n");
//builder.Append("using System.IO;\n");
//builder.Append("using System.Runtime;\n");
//builder.Append("using System.Text;\n");
builder.Append("using System.Collections.Generic;\n");
builder.Append("namespace YF \n{\n class CSharpConfigRun\n");
builder.Append(" {\n");
builder.Append(code);
builder.Append(" }\n}\n");
//1.添加要引用的程序集
string output = Path.GetTempFileName();
string assemblyName = Path.GetFileName(output);
var refPaths = new[] {
Assembly.GetExecutingAssembly().Location,
typeof(object).GetTypeInfo().Assembly.Location,
Path.Combine(Path.GetDirectoryName(typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly.Location), "System.dll"),
Path.Combine(Path.GetDirectoryName(typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly.Location), "System.Collections.dll"),
Path.Combine(Path.GetDirectoryName(typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly.Location), "System.Threading.dll"),
Path.Combine(Path.GetDirectoryName(typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly.Location), "System.Runtime.dll"),
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Newtonsoft.Json.dll"),
typeof(DynamicAttribute).GetTypeInfo().Assembly.Location,
};
MetadataReference[] references = refPaths.Select(r => MetadataReference.CreateFromFile(r)).ToArray();

List<MetadataReference> refs = new List<MetadataReference>() {
MetadataReference.CreateFromFile (typeof (object).Assembly.Location),
MetadataReference.CreateFromFile (typeof (List<int>).Assembly.Location),
MetadataReference.CreateFromFile (typeof (ASCIIEncoding).Assembly.Location),
MetadataReference.CreateFromFile (typeof (JsonConvert).Assembly.Location),
MetadataReference.CreateFromFile (typeof (JObject).Assembly.Location),
MetadataReference.CreateFromFile (typeof (Object).Assembly.Location),
MetadataReference.CreateFromFile (typeof (JContainer).Assembly.Location),
MetadataReference.CreateFromFile (typeof (JToken).Assembly.Location),
MetadataReference.CreateFromFile (typeof (Enumerable).Assembly.Location),
};
//2.需要编辑的C#代码
SyntaxTree tree = CSharpSyntaxTree.ParseText(builder.ToString());
//3.生成C#编译
var compilation = CSharpCompilation.Create(Guid.NewGuid().ToString() + ".dll")
.WithOptions(new CSharpCompilationOptions(
Microsoft.CodeAnalysis.OutputKind.DynamicallyLinkedLibrary
,
usings: null,
optimizationLevel: OptimizationLevel.Debug, // TODO
checkOverflow: false, // TODO
allowUnsafe: true, // TODO
platform: Platform.AnyCpu,
warningLevel: 4,
xmlReferenceResolver: null
))
.AddReferences(references)
.AddSyntaxTrees(tree);

//var emitResult = compilation.Emit(output);
EmitResult emitResult;
byte[] dllBytes;
using (var stream = new MemoryStream())
{
emitResult = compilation.Emit(stream);
dllBytes = stream.ToArray();
}

if (emitResult.Success)
{
Assembly assembly = Assembly.Load(dllBytes);
var obj = assembly.CreateInstance("YF.CSharpConfigRun");
var method = obj.GetType().GetMethod("main",new Type[] { typeof(string) });
strretu = method.Invoke(obj,objValue);
}


//var providerOptions = new Dictionary<string,string>();
//providerOptions.Add("CompilerVersion","v4.0");
//CSharpCodeProvider compiler = new CSharpCodeProvider(providerOptions);
//string output = Path.GetTempFileName();
//var cp = new CompilerParameters() { GenerateInMemory = true,OutputAssembly = output };
//cp.ReferencedAssemblies.Add(Assembly.GetExecutingAssembly().Location);
//cp.ReferencedAssemblies.Add("Microsoft.CSharp.dll");
//cp.ReferencedAssemblies.Add("System.Core.dll");
//cp.ReferencedAssemblies.Add("Newtonsoft.Json.dll"); //添加引用
//cp.ReferencedAssemblies.Add("System.dll");
//cp.GenerateExecutable = false;
//cp.EmbeddedResources.Clear();
//cp.LinkedResources.Clear();
//cp.Win32Resource = null;
//cp.TreatWarningsAsErrors = false;
//cp.WarningLevel = 4;
//cp.TempFiles.KeepFiles = false;
//CompilerResults cr = compiler.CompileAssemblyFromSource(cp,builder.ToString());




// 1.ICodeComplier
// CSharpCodeProvider complier = new CSharpCodeProvider();
// // 2.CompilerParameters
// CompilerParameters cp = new CompilerParameters();
// cp.ReferencedAssemblies.Add("System.dll"); //添加引用
//// cp.ReferencedAssemblies.Add("Newtonsoft.Json.dll"); //添加引用
// cp.GenerateExecutable = false;
// cp.GenerateInMemory = true;
// // 3.CompilerResults
// CompilerResults cr = complier.CompileAssemblyFromSource(cp,builder.ToString());
//if (cr.Errors.HasErrors)
//{
// foreach (CompilerError err in cr.Errors)
// {
// error += err.ErrorText + "\r\n";
// }
//}
//else
//{
// // 通过反射,调用HelloWorld的实例
// Assembly objAssembly = cr.CompiledAssembly;
// object objClass = objAssembly.CreateInstance("CSharpConfigRun");
// MethodInfo objFun = objClass.GetType().GetMethod(funName);
// strretu = objFun.Invoke(objClass,objValue);
//}
}
catch (Exception ex)
{
error += ex.Message;
}
return strretu;
}
}
}

+ 0
- 94
BPASmartClient.Compiler/Config.cs View File

@@ -1,94 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Unvell.ReoScript;

namespace BPASmartClient.Compiler
{
/// <summary>
/// 编译器
/// 创建人:奉友福
/// 创建时间:20220824
/// </summary>
public class Config
{
#region 单例模式
public static Config Instance = null;

public static Config GetInstance()
{
if (Instance == null)
{
Instance = new Config();
}
return Instance;
}
#endregion

public static ScriptRunningMachine srm { get; } = new ScriptRunningMachine();

public Config()
{
srm.WorkMode |=
// Enable DirectAccess
MachineWorkMode.AllowDirectAccess
// Ignore exceptions in CLR calling (by default)
| MachineWorkMode.IgnoreCLRExceptions
// Enable CLR Event Binding
| MachineWorkMode.AllowCLREventBind;

RegisterFunction();
}

/// <summary>
/// 运行脚本
/// </summary>
/// <param name="script"></param>
public void RunJsScipt(string script)
{
try
{
srm.Run(script);
}
catch (Exception e)
{
//MessageBox.Show(e.Message, "脚本错误");
}
}

/// <summary>
/// 注册对象到js
/// </summary>
public void SetVariable(string name, object obj)
{
srm.SetGlobalVariable(name, obj);
}

/// <summary>
/// 注册方法到Js
/// </summary>
private static void RegisterFunction()
{
srm["ShowMessage"] = new NativeFunctionObject("ShowMessage", (ctx, owner, args) =>
{
StringBuilder sb = new StringBuilder();
foreach (var item in args)
{
sb.Append(item.ToString());
}

//MessageBox.Show($"{sb}", "提示");
return null;
});

srm["SetICDValue"] = new NativeFunctionObject("SetICDValue", (ctx, owner, args) =>
{
//MessageBox.Show($"发送ICD数据", "提示");
return null;
});
}
}
}

+ 0
- 68
BPASmartClient.Compiler/FJson.cs View File

@@ -1,68 +0,0 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Compiler
{
public class FJson<T> where T : class, new()
{
private static string path
{
get
{
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"AccessFile\\JSON"));
return AppDomain.CurrentDomain.BaseDirectory + "AccessFile\\JSON\\" + typeof(T).Name + ".json";
}
}

public static T Data
{
get;
set;
} = new T();


public static void Save()
{
string contents = JsonConvert.SerializeObject(Data);
File.WriteAllText(path,contents);
}

public static void Read()
{
if (File.Exists(path))
{
T val = JsonConvert.DeserializeObject<T>(File.ReadAllText(path));
if (val != null)
{
Data = val;
}
}
}

public static void SaveInterface()
{
JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings();
jsonSerializerSettings.TypeNameHandling = TypeNameHandling.Objects;
string contents = JsonConvert.SerializeObject(Data,Formatting.Indented,jsonSerializerSettings);
File.WriteAllText(path,contents);
}

public static void ReadInterface()
{
if (File.Exists(path))
{
JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings();
jsonSerializerSettings.TypeNameHandling = TypeNameHandling.Objects;
T val = JsonConvert.DeserializeObject<T>(File.ReadAllText(path),jsonSerializerSettings);
if (val != null)
{
Data = val;
}
}
}
}
}

+ 0
- 178
BPASmartClient.Compiler/FRedisClient.cs View File

@@ -1,178 +0,0 @@
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace BPASmartClient.Compiler
{
public class FRedisClient
{
#region 单例模式
//private static FRedisClient instance = null;
//public static FRedisClient Instance()
//{
// if (instance == null) instance = new FRedisClient();
// return instance;
//}
#endregion

#region 变量
/// <summary>
/// IP地址
/// </summary>
public string redisconnection = "124.222.238.75:16000,password=123456";
/// <summary>
/// redis 连接状态
/// </summary>
public ConnectionMultiplexer _connection = null;
/// <summary>
/// 数据存储位置
/// </summary>
public IDatabase _database = null;
/// <summary>
/// 通道建立连接
/// </summary>
public ISubscriber subscibe = null;
#endregion

#region 外部访问
/// <summary>
/// 委托出去
/// </summary>
public Action<string,string> LogMeaage = null;
#endregion

public void Connect()
{
_connection = ConnectionMultiplexer.Connect(ConfigurationOptions.Parse(redisconnection));
_database = _connection.GetDatabase(0);//默认使用db0
subscibe = _connection.GetSubscriber();
}
int dbi = 0;
public void Connect(string connection)
{
_connection = ConnectionMultiplexer.Connect(ConfigurationOptions.Parse(connection));
if (connection.Contains("defaultDatabase="))
{
string[] str=connection.Split(',');
string stro = str.ToList().Find(s => s.Contains("defaultDatabase="));
try
{
dbi=int.Parse(stro.Replace("defaultDatabase=",""));
}
catch (Exception ex)
{

throw;
}
_database = _connection.GetDatabase(dbi);//默认使用db0
}
else
{
_database = _connection.GetDatabase(dbi);//默认使用db0
}
subscibe = _connection.GetSubscriber();
}

/// <summary>
/// 获取设备列表
/// </summary>
/// <returns></returns>
public Dictionary<string,string> GetKeys()
{
Dictionary<string,string> keys = new Dictionary<string,string>();
foreach (var endPoint in _connection.GetEndPoints())
{
//获取指定服务器
var server = _connection.GetServer(endPoint);
//在指定服务器上使用 keys 或者 scan 命令来遍历key
//foreach (var key in server.Keys(0,"设备列表:*"))
//{
// //获取key对于的值
// var val = _database.StringGet(key);
// Console.WriteLine($"key: {key}, value: {val}");
// keys[key] = val;
//}
foreach (var key in server.Keys(dbi,"*"))
{
//获取key对于的值
var val = _database.StringGet(key);
Console.WriteLine($"key: {key}, value: {val}");
keys[key] = val;
}
}
return keys;
}

/// <summary>
/// 订阅通道消息
/// </summary>
public void SubscribeChanne(string channelname)
{
if (subscibe == null) return;
subscibe.Subscribe(channelname,(channel,message) =>
{
MessageLog(channel,message);
});
}

/// <summary>
/// 发布通道消息
/// </summary>
public void PublishChanne(string channelname,string value)
{
if (subscibe == null) return;
subscibe.Publish(channelname,value);
}

/// <summary>
/// 获取 key 值
/// </summary>
public RedisValue RedisGet(string key,string hashField = "")
{
if (_database == null) return new RedisValue();
RedisValue result;
if (string.IsNullOrEmpty(hashField))
{
result = _database.StringGet(key);
}
else
{
result = _database.HashGet(key,hashField);
}
return result;
//MessageLog(key,result);
}
/// <summary>
/// 设置 redis 的值
/// </summary>
public bool RedisSet(string key,string hashField,string value)
{
bool result;
if (string.IsNullOrEmpty(hashField))
{
result = _database.StringSet(key,value);
}
else
{
result = _database.HashSet(key,hashField,value);
}
return result;
}

/// <summary>
/// 消息打印
/// </summary>
private void MessageLog(string key,string msg)
{
if (LogMeaage != null)
{
LogMeaage.Invoke(key,msg);
}
}
}
}

+ 0
- 328
BPASmartClient.Compiler/HttpRequestHelper.cs View File

@@ -1,328 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Compiler
{
/// <summary>
/// 该类实现客户端http 同步请求
/// 支持环境 -.net4.0/-.net4.5
/// 创建人:奉友福
/// </summary>
public class HttpRequestHelper
{
#region 私有变量
#endregion

#region 公用函数
/// <summary>
/// GET 同步请求
/// 创建人:奉友福
/// 创建时间:2020-11-19
/// </summary>
/// <param name="url">请求地址</param>
/// <returns>超时时间设置,默认5秒</returns>
public static string HttpGetRequest(string url,int _timeout = 2000)
{
string resultData = string.Empty;

try
{
WebClient wc = new WebClient();
byte[] bytes = wc.DownloadData(url);
string s = Encoding.UTF8.GetString(bytes);
return s;
}
catch (Exception e)
{
throw e;
}
return "";

try
{
var getrequest = HttpRequest.GetInstance().CreateHttpRequest(url,"GET",_timeout);
var getreponse = getrequest.GetResponse() as HttpWebResponse;
resultData = HttpRequest.GetInstance().GetHttpResponse(getreponse,"GET");
}
catch (Exception)
{
throw;
}
return resultData;
}
/// <summary>
/// POST 同步请求
/// 创建人:奉友福
/// 创建时间:2020-11-19
/// </summary>
/// <param name="url">请求地址</param>
/// <param name="PostJsonData">请求数据</param>
/// <returns></returns>
public static string HttpPostRequest(string url,string PostJsonData,int _timeout = 2000)
{
string resultData = string.Empty;
try
{
var postrequest = HttpRequest.GetInstance().CreateHttpRequest(url,"POST",_timeout,PostJsonData);
var postreponse = postrequest.GetResponse() as HttpWebResponse;
resultData = HttpRequest.GetInstance().GetHttpResponse(postreponse,"POST");
}
catch (Exception ex)
{
return ex.Message;
}
return resultData;
}

public static string HttpDeleteRequest(string url,string PostJsonData,int _timeout = 10000)
{
string resultData = string.Empty;
try
{
var deleteRequest = HttpRequest.CreateDeleteHttpRequest(url,PostJsonData,_timeout);
var deleteReponse = deleteRequest.GetResponse() as HttpWebResponse;
using (StreamReader reader = new StreamReader(deleteReponse.GetResponseStream(),Encoding.GetEncoding("UTF-8")))
{
resultData = reader.ReadToEnd();
}
}
catch (Exception ex)
{
}
return resultData;
}

/// <summary>
/// GET 同步请求
/// </summary>
/// <param name="url">地址</param>
/// <param name="head">头</param>
/// <param name="headInfo">内容</param>
/// <returns></returns>
public static string GetHttpGetResponseWithHead(string url,HttpRequestHeader head,string headInfo)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.ContentType = "application/json;charset=UTF-8";
request.Timeout = 6000;
request.Headers.Set(head,headInfo);
StreamReader sr = null;
HttpWebResponse response = null;
Stream stream = null;
try
{
response = (HttpWebResponse)request.GetResponse();
stream = response.GetResponseStream();
sr = new StreamReader(stream,Encoding.GetEncoding("utf-8"));
var resultData = sr.ReadToEnd();
return resultData;
}
catch (Exception ex)
{
Console.WriteLine(url + " 访问失败:" + ex.Message);
//return ex.Message;
}
finally
{
if (response != null)
{
response.Dispose();
}
if (stream != null)
{
stream.Dispose();
}
if (sr != null)
{
sr.Dispose();
}
}
return null;
}



/// <summary>
/// Post请求带Token
/// 2021-2-2 by dulf
/// </summary>
/// <param name="url"></param>
/// <param name="head"></param>
/// <param name="headInfo"></param>
/// <param name="postParam"></param>
/// <returns></returns>
public static string HttpPostResponseWithHead(string url,HttpRequestHeader head,string headInfo,string postParam,int Timeout = 6000)
{
string resultData = string.Empty;
try
{
var postrequest = WebRequest.Create(url) as HttpWebRequest;
postrequest.Timeout = Timeout;
postrequest.Method = "POST";
postrequest.ContentType = "application/json;charset=UTF-8";
postrequest.Headers.Set(head,headInfo);
byte[] data = Encoding.UTF8.GetBytes(postParam);
using (Stream reqStream = postrequest.GetRequestStream())
{
reqStream.Write(data,0,data.Length);
var postreponse = postrequest.GetResponse() as HttpWebResponse;
resultData = HttpRequest.GetInstance().GetHttpResponse(postreponse,"POST");
reqStream.Close();
}
return resultData;
}
catch (Exception ex)
{
Console.Write("请求<HttpPostResponseWithHead>异常:" + ex.Message);
}
return "";
}
#endregion

}
/// <summary>
/// HTTP请求类
/// </summary>
public class HttpRequest
{
#region 私有变量
/// <summary>
/// http请求超时时间设置
/// 默认值:5秒
/// </summary>
private static int Timeout = 5000;
#endregion

#region 单例模式
private static HttpRequest _HttpRequest = null;
public static HttpRequest GetInstance()
{
if (_HttpRequest == null)
{
_HttpRequest = new HttpRequest();
}
return _HttpRequest;
}
private HttpRequest()
{

}
#endregion

#region 公用函数
/// <summary>
/// 函数名称:创建http请求
/// 创建人:奉友福
/// 创建时间:2020-11-19
/// 例如GET 请求: 地址 + "GET"
/// 例如POST请求: 地址 + "POST" + JSON
/// </summary>
/// <param name="url">http请求地址</param>
/// <param name="requestType">http请求方式:GET/POST</param>
/// <param name="strjson">http请求附带数据</param>
/// <returns></returns>
public HttpWebRequest CreateHttpRequest(string url,string requestType,int _timeout = 5000,params object[] strjson)
{
HttpWebRequest request = null;
const string get = "GET";
const string post = "POST";
Timeout = _timeout;
if (string.Equals(requestType,get,StringComparison.OrdinalIgnoreCase))
{
request = CreateGetHttpRequest(url);
}
if (string.Equals(requestType,post,StringComparison.OrdinalIgnoreCase))
{
request = CreatePostHttpRequest(url,strjson[0].ToString());
}
return request;
}
/// <summary>
/// http获取数据
/// </summary>
/// <param name="response"></param>
/// <param name="requestType"></param>
/// <returns></returns>
public string GetHttpResponse(HttpWebResponse response,string requestType)
{
var resultData = string.Empty;
const string post = "POST";
string encoding = "UTF-8";
if (string.Equals(requestType,post,StringComparison.OrdinalIgnoreCase))
{
encoding = response.ContentEncoding;
if (encoding == null || encoding.Length < 1)
encoding = "UTF-8";
}
using (StreamReader reader = new StreamReader(response.GetResponseStream(),Encoding.GetEncoding(encoding)))
{
resultData = reader.ReadToEnd();
}
return resultData;
}
#endregion

#region 私有函数
/// <summary>
/// http+GET请求
/// </summary>
/// <param name="url">请求地址</param>
/// <returns>请求结果</returns>
private static HttpWebRequest CreateGetHttpRequest(string url)
{
var getrequest = WebRequest.Create(url) as HttpWebRequest;
getrequest.Method = "GET";
getrequest.Timeout = Timeout;
getrequest.ContentType = "application/json;charset=UTF-8";
getrequest.Proxy = null;
getrequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
return getrequest;
}
/// <summary>
/// http+POST请求
/// </summary>
/// <param name="url">请求地址</param>
/// <param name="postData"></param>
/// <returns>请求结果</returns>
private static HttpWebRequest CreatePostHttpRequest(string url,string postData)
{
var postrequest = WebRequest.Create(url) as HttpWebRequest;
//postrequest.KeepAlive = false;
postrequest.Timeout = Timeout;
postrequest.Method = "POST";
postrequest.ContentType = "application/json;charset=UTF-8";
//postrequest.ContentLength = postData.Length;
//postrequest.AllowWriteStreamBuffering = false;
//StreamWriter writer = new StreamWriter(postrequest.GetRequestStream(), Encoding.UTF8);
//writer.Write(postData);
//writer.Flush();
byte[] data = Encoding.UTF8.GetBytes(postData);
using (Stream reqStream = postrequest.GetRequestStream())
{
reqStream.Write(data,0,data.Length);
reqStream.Close();
}
return postrequest;
}

public static HttpWebRequest CreateDeleteHttpRequest(string url,string postJson,int _timeout = 5000)
{
var deleteRequest = WebRequest.Create(url) as HttpWebRequest;
deleteRequest.Timeout = _timeout;
deleteRequest.Method = "DELETE";
deleteRequest.ContentType = "application/json;charset=UTF-8";
byte[] data = Encoding.UTF8.GetBytes(postJson);
using (Stream reqStream = deleteRequest.GetRequestStream())
{
reqStream.Write(data,0,data.Length);
reqStream.Close();
}
return deleteRequest;
}
#endregion
}
}

+ 0
- 30
BPASmartClient.Compiler/IExecutable.cs View File

@@ -1,30 +0,0 @@
using BPASmartClient.MessageName.接收消息Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Compiler
{
public interface IExecutable
{
/// <summary>
/// 是否执行
/// </summary>
bool IsExecuteState { get; set; }
/// <summary>
/// 运行程序 注册事件
/// </summary>
void Register();
/// <summary>
/// 控件类型
/// </summary>
string ControlType { get; }
/// <summary>
/// 属性改变
/// </summary>
event EventHandler PropertyChange; //声明一个事件
}
}

+ 0
- 142
BPASmartClient.Compiler/MQTT.cs View File

@@ -1,142 +0,0 @@
using MQTTnet;
using MQTTnet.Client;
using MQTTnet.Client.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Compiler
{
public class MQTT
{

//private volatile static MQTT _Instance;
//public static MQTT GetInstance => _Instance ?? (_Instance = new MQTT());
//private MQTT() { }


public IMqttClient client;
IMqttClientOptions options;

/// <summary>
/// MQTT 接收消息
/// </summary>
public Action<MqttApplicationMessageReceivedEventArgs> MqttReceive { get; set; }

/// <summary>
/// MQTT 连接成功
/// </summary>
public Action ConnectOk { get; set; }

/// <summary>
/// 重连成功
/// </summary>
public Action Reconnection { get; set; }


public async void MqttInitAsync(string UserName,string pass,string IP,int port,string clientID)
{
p1:
options = new MqttClientOptionsBuilder().WithTcpServer(IP,port).WithClientId(clientID).WithCredentials(UserName,pass).Build();
client = new MqttFactory().CreateMqttClient();
client.UseDisconnectedHandler(async c =>
{
Thread.Sleep(2000);
//while (!Device.DataBus.内存数据缓存.DataBus.GetInstance().NetworkConnectState)
//{
// Thread.Sleep(2000);
//}
//Device.DataBus.内存数据缓存.DataBus.GetInstance().MQTTConnectState = false;
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"断开连接");

try
{
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"重连中");
await client.ConnectAsync(options);
}
catch (Exception ex)
{
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.ERROR,ex.Message);
}
if (client.IsConnected)
{
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"MQTT重连成功");
if (Reconnection != null) Reconnection();
}

}).UseApplicationMessageReceivedHandler(c =>
{
MqttReceive(c);
}).UseConnectedHandler((e) =>
{
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"连接成功");
});


try
{
await client.ConnectAsync(options);
}
catch (Exception ex)
{
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.ERROR,ex.Message);
}
if (!client.IsConnected)
{
Thread.Sleep(2000);
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"mqtt连接失败!重连执行中");
goto p1;
}
Thread.Sleep(2000);
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"MQTT连接成功!");
if (ConnectOk != null) ConnectOk();
}

/// <summary>
/// Mqtt 订阅
/// </summary>
/// <param name="topic">需要订阅的主题</param>
public async void MqttSubscriptionAsync(string topic)
{
if (client != null)
{
if (client.IsConnected)
{
try
{
var result = await client.SubscribeAsync(new MqttTopicFilterBuilder().WithTopic(topic).WithExactlyOnceQoS().Build());
}
catch { }
}
}
}

/// <summary>
/// Mqtt 发布
/// </summary>
/// <param name="topic">需要发布的主题</param>
/// <param name="content">需要发布的内容</param>
public async void MqttPublishAsync(string topic,string content)
{
if (client != null)
{
if (client.IsConnected)
{

var msg = new MqttApplicationMessageBuilder().WithTopic(topic).WithPayload(content).WithExactlyOnceQoS().Build();
try
{
var result = await client.PublishAsync(msg);
}
catch { }
}
}
}

private static readonly object sendMessageLock = new object();


}
}

+ 0
- 69
BPASmartClient.Compiler/RedisHelper.cs View File

@@ -1,69 +0,0 @@
using ServiceStack.Redis;
using System.Diagnostics;

namespace BPASmartClient.Compiler
{
public class RedisHelper
{

private volatile static RedisHelper _Instance;
public static RedisHelper GetInstance => _Instance ?? (_Instance = new RedisHelper());
private RedisHelper() { }
RedisClient client;

public async Task<bool> ConnectAsync(string redisconnection)
{
return await Task.Factory.StartNew(new Func<bool>(() =>
{
if (client == null)
{
//"124.222.238.75:16000,password=123456";
client = new RedisClient("124.222.238.75",16000,"123456",1);
client.ConnectTimeout = 5000;
Stopwatch sw = new Stopwatch();
sw.Start();
while (!client.IsSocketConnected())
{
if (sw.ElapsedMilliseconds >= client.ConnectTimeout) break;
Thread.Sleep(1000);
}
string status = client.IsSocketConnected() ? "成功" : "失败";
}
return client.IsSocketConnected();
}));

}

/// <summary>
/// 清除所有redis 数据
/// </summary>
public void FlushDb()
{
client?.FlushDb();
}

/// <summary>
/// 设置值
/// </summary>
/// <typeparam name="TValue"></typeparam>
/// <param name="key"></param>
/// <param name="value"></param>
public void SetValue<TValue>(string key,TValue value)
{
var res = client?.Set<TValue>(key,value);
}

/// <summary>
/// 获取值
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
public TResult GetValue<TResult>(string key)
{
if (client == null) return default(TResult);
return client.Get<TResult>(key);
}

}
}

+ 6
- 1
BPASmartClient.MinimalistUI/BPASmartClient.MinimalistUI.csproj View File

@@ -27,12 +27,17 @@

<ItemGroup>
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.Compiler\BPASmartClient.Compiler.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" />
<ProjectReference Include="..\BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="BPASmartClient.Compiler">
<HintPath>..\BPASmartClient.SCADAControl\DLL\BPASmartClient.Compiler.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<Resource Include="Images\bj.png" />
<Resource Include="Images\fyf.ico" />


+ 2
- 1
BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml.cs View File

@@ -1,4 +1,5 @@
using BPASmartClient.Compiler;

using BPASmartClient.Compiler;
using BPASmartClient.MessageName.接收消息Model;
using System;
using System.Collections.Generic;


+ 4
- 0
BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj View File

@@ -56,6 +56,10 @@
<Reference Include="Antlr3.Runtime">
<HintPath>..\BPASmartClient.Compiler\DLL\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="BPASmartClient.Compiler">
<HintPath>DLL\BPASmartClient.Compiler.dll</HintPath>
<CopyLocal>True</CopyLocal>
</Reference>
<Reference Include="Unvell.ReoScript">
<HintPath>..\BPASmartClient.Compiler\DLL\Unvell.ReoScript.dll</HintPath>
</Reference>


BPASmartClient.Compiler/DLL/Antlr3.Runtime.dll → BPASmartClient.SCADAControl/DLL/Antlr3.Runtime.dll View File


BIN
View File


BPASmartClient.Compiler/DLL/Unvell.ReoScript.dll → BPASmartClient.SCADAControl/DLL/Unvell.ReoScript.dll View File


+ 0
- 228
BeDesignerSCADA/Adorners/SelectionAdorner.cs View File

@@ -1,228 +0,0 @@
using BeDesignerSCADA.Controls;
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.Documents;
using System.Windows.Input;
using System.Windows.Media;

namespace BeDesignerSCADA.Adorners
{
internal class SelectionAdorner : Adorner
{
public SelectionAdorner(UIElement adornedEIeent) : base(adornedEIeent) { }

protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
Rect adornerRect = new Rect(AdornedElement.DesiredSize);
SolidColorBrush renderBrush = Brushes.Transparent;
Pen renderPen1 = new Pen(new SolidColorBrush(Colors.Tomato), 1);
Pen renderPen = new Pen(new SolidColorBrush(Colors.Tomato), 1);
renderPen1.DashStyle = new DashStyle(new List<double>() { 6, 4 }, 4);

//1.绘制边框
drawingContext.DrawRectangle(renderBrush, renderPen1, new Rect(adornerRect.TopLeft.X, adornerRect.TopLeft.Y, adornerRect.Width, adornerRect.Height));
//2.绘制拖动正方形
// Draw a circle at each corner.
drawingContext.DrawRectangle(renderBrush, renderPen, new Rect(adornerRect.TopLeft.X - 2.5, adornerRect.TopLeft.Y - 2.5, 5, 5));
drawingContext.DrawRectangle(renderBrush, renderPen, new Rect(adornerRect.TopRight.X - 2.5, adornerRect.TopRight.Y - 2.5, 5, 5));
drawingContext.DrawRectangle(renderBrush, renderPen, new Rect(adornerRect.BottomLeft.X - 2.5, adornerRect.BottomLeft.Y - 2.5, 5, 5));
drawingContext.DrawRectangle(renderBrush, renderPen, new Rect(adornerRect.BottomRight.X - 2.5, adornerRect.BottomRight.Y - 2.5, 5, 5));
//3.绘制4个中心正方形
drawingContext.DrawRectangle(renderBrush, renderPen,
new Rect(adornerRect.TopLeft.X + adornerRect.Width / (double)2 - 2.5, adornerRect.TopLeft.Y - 2.5, 5, 5));
drawingContext.DrawRectangle(renderBrush, renderPen,
new Rect(adornerRect.TopRight.X - 2.5, adornerRect.TopRight.Y + adornerRect.Height / (double)2 - 2.5, 5, 5));
drawingContext.DrawRectangle(renderBrush, renderPen,
new Rect(adornerRect.BottomLeft.X - 2.5, adornerRect.BottomLeft.Y - adornerRect.Height / (double)2 - 2.5, 5, 5));
drawingContext.DrawRectangle(renderBrush, renderPen,
new Rect(adornerRect.BottomRight.X - adornerRect.Width / (double)2 - 2.5, adornerRect.BottomRight.Y - 2.5, 5, 5));

MouseDown += SelectionAdorner_MouseDown;
MouseMove += SelectionAdorner_MouseMove;
MouseUp += SelectionAdorner_MouseUp;
ResourceDictionary languageResDic = new ResourceDictionary();
languageResDic.Source = new Uri(@"/BeDesignerSCADA;component/Themes/Styles.xaml", UriKind.RelativeOrAbsolute);
this.Resources.MergedDictionaries.Add(languageResDic);
ContextMenu = FindResource("AdornerRightMenu") as ContextMenu;
Tag = CanvasPanel.GetParentObject<CanvasPanel>(AdornedElement);

this.Focus();
this.SelectionAdorner_MouseDown(this, null);
this.SelectionAdorner_MouseMove(this, null);
}

private void SelectionAdorner_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
ReleaseMouseCapture();
CanvasPanel.GetParentObject<CanvasPanel>(AdornedElement).ClearAlignLine();
}

/// <summary>
/// 鼠标最后一次按下位置
/// </summary>
Point lastPoint = new Point();
/// <summary>
/// 鼠标在控件中的位置
/// </summary>
public MousePos mousePos;
double tempX = 0d;
double tempY = 0d;
double movePx = 0d;
/// <summary>
/// 改变鼠标状态,鼠标在控件上,下,左,右,左上,右上,左下,右下,向上不同的光标
/// </summary>
private void SetCursor()
{
Rect adornerRect = new Rect(AdornedElement.DesiredSize);
double _left = CanvasPanel.GetLeft(AdornedElement);
double _top = CanvasPanel.GetTop(AdornedElement);
var DQPoint = Mouse.GetPosition(CanvasPanel.GetParentObject<CanvasPanel>(AdornedElement));
if (DQPoint.X >= (adornerRect.TopLeft.X - 2.5 + _left) && DQPoint.X <= (adornerRect.TopLeft.X + 2.5 + _left) && DQPoint.Y >= (adornerRect.TopLeft.Y - 2.5 + _top) && DQPoint.Y <= (adornerRect.TopLeft.Y + 2.5 + _top))
{
//左上
this.Cursor = Cursors.SizeNWSE; mousePos = MousePos.LeftTop;
}
else if (DQPoint.X >= (adornerRect.TopRight.X - 2.5 + _left) && DQPoint.X <= (adornerRect.TopRight.X + 2.5 + _left) && DQPoint.Y >= (adornerRect.TopRight.Y - 2.5 + _top) && DQPoint.Y <= (adornerRect.TopRight.Y + 2.5 + _top))
{
//右上
this.Cursor = Cursors.SizeNESW; mousePos = MousePos.RightTop;
}
else if (DQPoint.X >= (adornerRect.BottomLeft.X - 2.5 + _left) && DQPoint.X <= (adornerRect.BottomLeft.X + 2.5 + _left) && DQPoint.Y >= (adornerRect.BottomLeft.Y - 2.5 + _top) && DQPoint.Y <= (adornerRect.BottomLeft.Y + 2.5 + _top))
{
//左下
this.Cursor = Cursors.SizeNESW; mousePos = MousePos.LeftBottom ;
}
else if (DQPoint.X >= (adornerRect.BottomRight.X - 2.5 + _left) && DQPoint.X <= (adornerRect.BottomRight.X + 2.5 + _left) && DQPoint.Y >= (adornerRect.BottomRight.Y - 2.5 + _top) && DQPoint.Y <= (adornerRect.BottomRight.Y + 2.5 + _top))
{
//右下
this.Cursor = Cursors.SizeNWSE; mousePos = MousePos.RightBottom;
}
else if (DQPoint.X >= (adornerRect.TopLeft.X + adornerRect.Width / (double)2 - 2.5 + _left) && DQPoint.X <= (adornerRect.TopLeft.X + adornerRect.Width / (double)2 + 2.5 + _left) && DQPoint.Y >= (adornerRect.TopLeft.Y - 2.5 + _top) && DQPoint.Y <= (adornerRect.TopLeft.Y + 2.5 + _top))
{
//上中
this.Cursor = Cursors.SizeNS; mousePos = MousePos.Top;
}
else if (DQPoint.X >= (adornerRect.BottomRight.X - adornerRect.Width / (double)2 - 2.5 + _left) && DQPoint.X <= (adornerRect.BottomRight.X - adornerRect.Width / (double)2 + 2.5 + _left) && DQPoint.Y >= (adornerRect.BottomRight.Y - 2.5 + _top) && DQPoint.Y <= (adornerRect.BottomRight.Y + 2.5 + _top))
{
//下中
this.Cursor = Cursors.SizeNS; mousePos = MousePos.Bottom;
}
else if (DQPoint.X >= (adornerRect.TopRight.X - 2.5 + _left) && DQPoint.X <= (adornerRect.TopRight.X + 2.5 + _left) && DQPoint.Y >= (adornerRect.TopRight.Y + adornerRect.Height / (double)2 - 2.5 + _top) && DQPoint.Y <= (adornerRect.TopRight.Y + adornerRect.Height / (double)2 + 2.5 + _top))
{
//右中
this.Cursor = Cursors.SizeWE; mousePos = MousePos.Right;
}
else if (DQPoint.X >= (adornerRect.BottomLeft.X - 2.5 + _left) && DQPoint.X <= (adornerRect.BottomLeft.X + 2.5 + _left) && DQPoint.Y >= (adornerRect.BottomLeft.Y - adornerRect.Height / (double)2 - 2.5 + _top) && DQPoint.Y <= (adornerRect.BottomLeft.Y - adornerRect.Height / (double)2 + 2.5 + _top))
{
//左中
this.Cursor = Cursors.SizeWE; mousePos = MousePos.Left;
}
else
{
this.Cursor = Cursors.Arrow; mousePos = MousePos.None;
}
}


private void SelectionAdorner_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
if (Mouse.LeftButton != MouseButtonState.Pressed
&& Mouse.MiddleButton != MouseButtonState.Pressed
&& Mouse.RightButton != MouseButtonState.Pressed)//鼠标没有按下,改变鼠标状态
{
SetCursor();
}

if (this.Cursor == Cursors.Arrow && Mouse.LeftButton == MouseButtonState.Pressed)//移动控件
{
if (lastPoint.X == 0 && lastPoint.Y == 0)
{
return;
}

CaptureMouse();
var nowPoint = Mouse.GetPosition(CanvasPanel.GetParentObject<CanvasPanel>(AdornedElement));
double offsetX = nowPoint.X - lastPoint.X;
double offsetY = nowPoint.Y - lastPoint.Y;
lastPoint = nowPoint;

tempX += offsetX;
tempY += offsetY;

var canvas = CanvasPanel.GetParentObject<CanvasPanel>(AdornedElement);
movePx = canvas.GridPxiel;

if (Math.Abs(tempX) >= movePx)
{
offsetX = Math.Round(tempX / movePx) * movePx;
tempX -= offsetX;
canvas.MoveControls(offsetX, 0);
}

if (Math.Abs(tempY) >= movePx)
{
offsetY = Math.Round(tempY / movePx) * movePx;
tempY -= offsetY;
canvas.MoveControls(0, offsetY);
}
}
else if (this.Cursor != Cursors.Arrow && Mouse.LeftButton == MouseButtonState.Pressed)
{
CaptureMouse();
//lastPoint 最后一次鼠标按下位置 nowPonit 鼠标当前位置 mousePos 鼠标在控件中的位置
var nowPoint = Mouse.GetPosition(CanvasPanel.GetParentObject<CanvasPanel>(AdornedElement));
CanvasPanel.GetParentObject<CanvasPanel>(AdornedElement).ReCtrlSize(lastPoint, nowPoint, mousePos);
lastPoint = nowPoint;
}
else if (Mouse.MiddleButton == MouseButtonState.Pressed)//中间同步拖拽控件大小
{
CaptureMouse();
var nowPoint = Mouse.GetPosition(CanvasPanel.GetParentObject<CanvasPanel>(AdornedElement));
int offsetX = (int)(nowPoint.X - lastPoint.X);
int offsetY = (int)(nowPoint.Y - lastPoint.Y);
CanvasPanel.GetParentObject<CanvasPanel>(AdornedElement).ZoomControls(offsetX, offsetY);
lastPoint = nowPoint;
}
}

private void SelectionAdorner_MouseDown(object sender, MouseButtonEventArgs e)
{
var canv = CanvasPanel.GetParentObject<CanvasPanel>(AdornedElement);
lastPoint = Mouse.GetPosition(canv);
Keyboard.Focus(canv);

if (Keyboard.Modifiers == ModifierKeys.Control && e != null)
{
var layer = AdornerLayer.GetAdornerLayer(AdornedElement);
var arr = layer.GetAdorners(AdornedElement);
if (canv.SelectedItems.Contains(AdornedElement))
{
canv.SelectedItems.Remove(AdornedElement as FrameworkElement);
canv.RefreshSelection();
}
}
}
}

/// <summary>
/// 鼠标在控件中的位置
/// </summary>
public enum MousePos
{
None,
Top,
Right,
Bottom,
Left,
LeftTop,
LeftBottom,
RightTop,
RightBottom
}
}

+ 0
- 32
BeDesignerSCADA/Adorners/SelectionAlignLine.cs View File

@@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;

namespace BeDesignerSCADA.Adorners
{
public class SelectionAlignLine : Adorner
{
public SelectionAlignLine(UIElement adornedElement, Point start, Point end) : base(adornedElement)
{
startPoint = start;
endPoint = end;
}

Point startPoint = default(Point);
Point endPoint = default(Point);
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
Rect adornerRect = new Rect(AdornedElement.DesiredSize);
Pen render = new Pen(new SolidColorBrush(Colors.RoyalBlue), 1);
render.DashCap = PenLineCap.Round;
render.DashStyle = new DashStyle(new List<double>() { 4, 2 }, 2);
drawingContext.DrawLine(render, startPoint, endPoint);
}
}
}

+ 24
- 10
BeDesignerSCADA/BeDesignerSCADA.csproj View File

@@ -8,9 +8,21 @@
<ApplicationIcon>Images\fyf.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Adorners\**" />
<Compile Remove="CustomerControls\**" />
<EmbeddedResource Remove="Adorners\**" />
<EmbeddedResource Remove="CustomerControls\**" />
<None Remove="Adorners\**" />
<None Remove="CustomerControls\**" />
<Page Remove="Adorners\**" />
<Page Remove="CustomerControls\**" />
</ItemGroup>

<ItemGroup>
<Compile Remove="ArcGauge.cs" />
<Compile Remove="AssemblyInfo.cs" />
<Compile Remove="Controls\CanvasPanel.cs" />
<Compile Remove="DigitalNumber.cs" />
<Compile Remove="GraphArrow.xaml.cs" />
<Compile Remove="GraphStar.xaml.cs" />
@@ -68,15 +80,6 @@
<PackageReference Include="StackExchange.Redis" Version="2.6.66" />
</ItemGroup>

<ItemGroup>
<Reference Include="Antlr3.Runtime">
<HintPath>DLL\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unvell.ReoScript">
<HintPath>DLL\Unvell.ReoScript.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<Resource Include="Fonts\ds-digib.ttf" />
<Resource Include="Images\bj.png" />
@@ -102,11 +105,22 @@

<ItemGroup>
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.Compiler\BPASmartClient.Compiler.csproj" />
<ProjectReference Include="..\BPASmartClient.DATABUS\BPASmartClient.DATABUS.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" />
<ProjectReference Include="..\BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="Antlr3.Runtime">
<HintPath>..\BPASmartClient.SCADAControl\DLL\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="BPASmartClient.Compiler">
<HintPath>..\BPASmartClient.SCADAControl\DLL\BPASmartClient.Compiler.dll</HintPath>
</Reference>
<Reference Include="Unvell.ReoScript">
<HintPath>..\BPASmartClient.SCADAControl\DLL\Unvell.ReoScript.dll</HintPath>
</Reference>
</ItemGroup>

</Project>

+ 0
- 990
BeDesignerSCADA/Controls/CanvasPanel.cs View File

@@ -1,990 +0,0 @@
using BeDesignerSCADA.Adorners;
using BeDesignerSCADA.Speical;
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Xml;

namespace BeDesignerSCADA.Controls
{
public class CanvasPanel : Canvas
{
public CanvasPanel()
{
UseLayoutRounding = true;
Drop += CanvasPanel_Drop;
CopySelectItemsCommand = new RelayCommand(CopySelectItems);
PasteSelectItemsCommand = new RelayCommand(PasteSelectItems);
DeleteSelectItemsCommand = new RelayCommand(DeleteSelectItems);
SetTopLayerCommand = new RelayCommand(SetTopLayer);
SetBottomLayerCommand = new RelayCommand(SetBottomLayer);
SelectedItems = new ObservableCollection<FrameworkElement>();
ContextMenu=Application.Current.Resources["CanvasRightMenu"] as ContextMenu;
KeyDown += CanvasPanel_KeyDown;
}

#region 添加控件
private void CanvasPanel_Drop(object sender, DragEventArgs e)
{
Type type = e.Data.GetData("System.RuntimeType") as Type;
var t = type.GetCustomAttributes(typeof(ControlTypeAttribute), false);
if (t.Length > 0)
{
Console.WriteLine((t as ControlTypeAttribute[])[0].Group);
}

try
{
var control = Activator.CreateInstance(type) as FrameworkElement;
control.Name = GetControlName(type);
Children.Add(control);

var xPos = e.GetPosition(this).X;
var yPos = e.GetPosition(this).Y;
if (xPos % GridPxiel != 0)
xPos = (GridPxiel - xPos % GridPxiel) + xPos;
if (yPos % GridPxiel != 0)
yPos = (GridPxiel - yPos % GridPxiel) + yPos;

SetLeft(control, xPos);
SetTop(control, yPos);

SelectedItems = new ObservableCollection<FrameworkElement>() { control };
SelectedItem = control;
}
catch (Exception)
{
}

}

string GetControlName(Type ctrlType)
{
var children = Children.GetEnumerator();
children.Reset();
List<string> names = new List<string>();
while (children.MoveNext())
{
if (children.Current.GetType().Name == ctrlType.Name)
{
names.Add((children.Current as FrameworkElement).Name);
}
}

var nameIndex = names.Count;
while (names.Contains($"{ctrlType.Name.ToLower().Replace("the", string.Empty)}{nameIndex}"))
{
nameIndex++;
}

return $"{ctrlType.Name.ToLower().Replace("the", string.Empty)}{nameIndex}";
}
#endregion

#region 初始化
protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)
{
if (visualAdded is Border || visualRemoved is Border)
{
return;
}

if (visualAdded is FrameworkElement ctrl)
{
ctrl.PreviewMouseLeftButtonDown += Ctrl_MouseLeftButtonDown;
}
if (visualRemoved is FrameworkElement ctr)
{
ctr.PreviewMouseLeftButtonDown -= Ctrl_MouseLeftButtonDown;
}

base.OnVisualChildrenChanged(visualAdded, visualRemoved);
}
#endregion

#region 单击选中项处理
/// <summary>
/// 单击了控件时:不调用框选的刷新方式
/// </summary>
bool isClickedControl = false;
/// <summary>
/// 左键按下
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Ctrl_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (sender is FrameworkElement ctl)
{
var cp = GetParentObject<CanvasPanel>(ctl);
if (Keyboard.Modifiers == ModifierKeys.Control)
{
cp.SelectedItems.Add(ctl);
}
else
{
cp.SelectedItems = new ObservableCollection<FrameworkElement>() { ctl };
}
isClickedControl = true;
RefreshSelection();
}
}
/// <summary>
/// 获取属性
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <returns></returns>
public static T GetParentObject<T>(DependencyObject obj) where T : FrameworkElement
{
DependencyObject parent = VisualTreeHelper.GetParent(obj);
while (parent != null)
{
if (parent is T)
{
return (T)parent;
}
parent = VisualTreeHelper.GetParent(parent);
}
return null;
}
#endregion

#region 右键菜单
#endregion

#region 绘制选择框
Border selectionBorder = new Border()
{
Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#557F7F7F")),
BorderThickness = new Thickness(1),
BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF303030")),
};

protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
selectionStart = e.GetPosition(this);
if (!this.Children.Contains(selectionBorder))
{
this.Children.Add(selectionBorder);
this.CaptureMouse();
}

}

Point selectionStart = default;
protected override void OnMouseMove(MouseEventArgs e)
{
if (isClickedControl)
{
return;
}
base.OnMouseMove(e);
if (e.LeftButton == MouseButtonState.Pressed)
{
var nowPoint = e.GetPosition(this);

var offsetX = nowPoint.X - selectionStart.X;
var offsetY = nowPoint.Y - selectionStart.Y;
Clear();

selectionBorder.Width = Math.Abs(offsetX);
selectionBorder.Height = Math.Abs(offsetY);
// 分四种情况绘制
if (offsetX >= 0 && offsetY >= 0)// 右下
{
SetLeft(selectionBorder, selectionStart.X);
SetTop(selectionBorder, selectionStart.Y);
}
else if (offsetX > 0 && offsetY < 0)// 右上
{
SetLeft(selectionBorder, selectionStart.X);
SetBottom(selectionBorder, ActualHeight - selectionStart.Y);

}
else if (offsetX < 0 && offsetY > 0)// 左下
{
SetRight(selectionBorder, ActualWidth - selectionStart.X);
SetTop(selectionBorder, selectionStart.Y);
}
else if (offsetX < 0 && offsetY < 0)// 左上
{
SetRight(selectionBorder, ActualWidth - selectionStart.X);
SetBottom(selectionBorder, ActualHeight - selectionStart.Y);
}


}
}

protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
if (double.IsNaN(GetLeft(selectionBorder)))
{
SetLeft(selectionBorder, ActualWidth - GetRight(selectionBorder) - selectionBorder.ActualWidth);
}
if (double.IsNaN(GetTop(selectionBorder)))
{
SetTop(selectionBorder, ActualHeight - GetBottom(selectionBorder) - selectionBorder.ActualHeight);
}

FrameSelection(GetLeft(selectionBorder), GetTop(selectionBorder), selectionBorder.Width, selectionBorder.Height);
selectionBorder.Width = 0;
selectionBorder.Height = 0;
this.Children.Remove(selectionBorder);
this.ReleaseMouseCapture();
}

private void Clear()
{
SetLeft(selectionBorder, double.NaN);
SetRight(selectionBorder, double.NaN);
SetTop(selectionBorder, double.NaN);
SetBottom(selectionBorder, double.NaN);
}

#endregion

#region 选中属性
public FrameworkElement SelectedItem
{
get { return (FrameworkElement)GetValue(SelectedItemProperty); }
set { SetValue(SelectedItemProperty, value); }
}
public static readonly DependencyProperty SelectedItemProperty =
DependencyProperty.Register("SelectedItem", typeof(FrameworkElement), typeof(CanvasPanel), new PropertyMetadata(null, OnSelectedItemChanged));
private static void OnSelectedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as CanvasPanel)?.RefreshSelection1();
public void RefreshSelection1()
{
}
#endregion

#region 框选
public ObservableCollection<FrameworkElement> SelectedItems
{
get { return (ObservableCollection<FrameworkElement>)GetValue(SelectedItemsProperty); }
set { SetValue(SelectedItemsProperty, value); }
}
public static readonly DependencyProperty SelectedItemsProperty =
DependencyProperty.Register("SelectedItems", typeof(ObservableCollection<FrameworkElement>), typeof(CanvasPanel), new PropertyMetadata(null, OnSelectedItemsChanged));

private static void OnSelectedItemsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as CanvasPanel)?.RefreshSelection();

public void RefreshSelection()
{
foreach (var item in Children)
{
if (!(item is IExecutable))
continue;

var ele = item as FrameworkElement;
if (ele == null) continue;

var layer = AdornerLayer.GetAdornerLayer(ele);
var arr = layer.GetAdorners(ele);//获取该控件上所有装饰器,返回一个数组
if (arr != null)
{
for (int i = arr.Length - 1; i >= 0; i--)
{
layer.Remove(arr[i]);
}
}
}

if (SelectedItems != null)
{
foreach (var item in SelectedItems)
{
var layer = AdornerLayer.GetAdornerLayer(item);
layer.Add(new SelectionAdorner(item));
SelectedItem = item;
}
}
}

/// <summary>
/// 移除所有选择装饰器
/// </summary>
public void ClearSelection()
{
foreach (var item in Children)
{
if (!(item is IExecutable))
continue;

var ele = item as FrameworkElement;
if (ele == null) continue;

var layer = AdornerLayer.GetAdornerLayer(ele);
var arr = layer.GetAdorners(ele);//获取该控件上所有装饰器,返回一个数组
if (arr != null)
{
for (int i = arr.Length - 1; i >= 0; i--)
{
layer.Remove(arr[i]);
}
}
}
}

/// <summary>
/// 计算框选项
/// </summary>
private void FrameSelection(double x, double y, double width, double height)
{
if (width > 0 || height > 0)
{
isClickedControl = false;
}
if (isClickedControl)
{
isClickedControl = false;
SelectedItems = new ObservableCollection<FrameworkElement>();
return;
}
SelectedItems = new ObservableCollection<FrameworkElement>();
foreach (var item in Children)
{
if (item is FrameworkElement ctrl && !(ctrl is Border))
{
// 框左上角
var left = GetLeft(ctrl);
var top = GetTop(ctrl);
if (left >= x && left <= x + width && top >= y && top <= y + height)
{
if (!SelectedItems.Contains(ctrl))
SelectedItems.Add(ctrl);
}

// 框右下角
var right = left + ctrl.ActualWidth;
var bottom = top + ctrl.ActualHeight;
if (right >= x && right <= x + width && bottom >= y && bottom <= y + height)
{
if (!SelectedItems.Contains(ctrl))
SelectedItems.Add(ctrl);
}

// 框右上角
if (right >= x && right <= x + width && top >= y && top <= y + height)
{
if (!SelectedItems.Contains(ctrl))
SelectedItems.Add(ctrl);
}

// 框左下角
if (left >= x && left <= x + width && bottom >= y && bottom <= y + height)
{
if (!SelectedItems.Contains(ctrl))
SelectedItems.Add(ctrl);
}
}
}

RefreshSelection();
}
#endregion

#region 外部调用
public List<FrameworkElement> GetAllExecChildren()
{
List<FrameworkElement> result = new List<FrameworkElement>();
foreach (var ctrl in Children)
{
if (ctrl is IExecutable exec)
{
result.Add(ctrl as FrameworkElement);
}
}

return result;
}

/// <summary>
/// 对齐像素单位
/// </summary>
public int GridPxiel
{
get { return (int)GetValue(GridPxielProperty); }
set { SetValue(GridPxielProperty, value); }
}
public static readonly DependencyProperty GridPxielProperty =
DependencyProperty.Register("GridPxiel", typeof(int), typeof(CanvasPanel), new PropertyMetadata(4));


public void MoveControls(double offsetX, double offsetY)
{
ClearAlignLine();

// 获取可对齐的点
List<Point> points = new List<Point>();
foreach (FrameworkElement ctrl in Children)
{
if (!SelectedItems.Contains(ctrl))
{
// 左上的点
Point item = new Point(GetLeft(ctrl), GetTop(ctrl));
points.Add(item);

// 左下的点
Point itemlb = new Point(GetLeft(ctrl), GetTop(ctrl) + ctrl.ActualHeight);
points.Add(itemlb);

// 右下的点
Point itemrb = new Point(GetLeft(ctrl) + ctrl.ActualWidth, GetTop(ctrl) + ctrl.ActualHeight);
points.Add(itemrb);

// 右上的点
Point itemrt = new Point(GetLeft(ctrl) + ctrl.ActualWidth, GetTop(ctrl));
points.Add(itemrt);
}
}

// 控件移动
foreach (var item in SelectedItems)
{
var moveX = GetLeft(item) + offsetX;
moveX = (moveX < 0) ? 0 : moveX;

var moveY = GetTop(item) + offsetY;
moveY = moveY < 0 ? 0 : moveY;

if (moveX % GridPxiel != 0)
moveX = (GridPxiel - moveX % GridPxiel) + moveX;
if (moveY % GridPxiel != 0)
moveY = (GridPxiel - moveY % GridPxiel) + moveY;

SetLeft(item, moveX);
SetTop(item, moveY);
}

// 计算是否显示对齐线
var targetItemTop = SelectedItems?.Min(x => GetTop(x));
var targetItem = SelectedItems.FirstOrDefault(x => GetTop(x) == targetItemTop);
var lefAlign = points.FirstOrDefault(x => Math.Abs(x.X - GetLeft(targetItem)) == 0);
if (lefAlign != default)
{
//SetLeft(targetItem, lefAlign.X);
var layer = AdornerLayer.GetAdornerLayer(this);
layer.Add(new SelectionAlignLine(this, lefAlign, new Point(GetLeft(targetItem), GetTop(targetItem))));
}

var topAlign = points.FirstOrDefault(x => Math.Abs(x.Y - GetTop(targetItem)) == 0);
if (topAlign != default)
{
//SetTop(targetItem, topAlign.Y);
var layer = AdornerLayer.GetAdornerLayer(this);
layer.Add(new SelectionAlignLine(this, topAlign, new Point(GetLeft(targetItem), GetTop(targetItem))));
}

int px = 20;
// 网格对齐
if (UseAutoAlignment)
{
foreach (var item in SelectedItems)
{
var left = GetLeft(item);
if (left % px <= 1)
{
SetLeft(item, (int)left / px * px);
}

var top = GetTop(item);
if (top % px <= 1)
{
SetTop(item, (int)top / px * px);
}
}
}
}

/// <summary>
/// 清除绘制的对齐线
/// </summary>
public void ClearAlignLine()
{
var arr = AdornerLayer.GetAdornerLayer(this).GetAdorners(this);
if (arr != null)
{
for (int i = arr.Length - 1; i >= 0; i--)
{
AdornerLayer.GetAdornerLayer(this).Remove(arr[i]);
}
}
}

public void ZoomControls(int offsetX, int offsetY)
{
foreach (var item in SelectedItems)
{
if (item.ActualHeight + offsetY > 10)
{
item.Height += offsetY;
}
if (item.ActualWidth + offsetX > 10)
{
item.Width += offsetX;
}
}
}

/// <summary>
/// 调整控件大小:鼠标在控件中的不同位置,调整控件大小
/// </summary>
public void ReCtrlSize(Point lastPoint,Point currentPoint, MousePos mousePos)
{
foreach (var control in SelectedItems)
{
//计算偏移量
double x = currentPoint.X - lastPoint.X;
double y = currentPoint.Y - lastPoint.Y;
switch (mousePos)
{
case MousePos.None:
break;
case MousePos.Top://上,调整
if (control.Height - y > control.MinHeight)
{
SetTop(control, GetTop(control) + y);
//control.Top += y;
control.Height -= y;
}
break;
case MousePos.Right:
if (control.Width + x > control.MinWidth)
{
control.Width += x;
}
break;
case MousePos.Bottom:
if (control.Height + y > control.MinHeight)
{
control.Height += y;
}
break;
case MousePos.Left:
if (control.Width - x > control.MinWidth)
{
SetLeft(control, GetLeft(control) + x);//control.Left += x;
control.Width -= x;
}
break;
case MousePos.LeftTop://左上
if (control.Width - x > control.MinWidth)
{
SetLeft(control, GetLeft(control) + x);//control.Left += x;
control.Width -= x;
}
if (control.Height - y > control.MinHeight)
{
SetTop(control, GetTop(control) + y);//control.Top += y;
control.Height -= y;
}
break;
case MousePos.LeftBottom:
if (control.Width - x > control.MinWidth)
{
SetLeft(control, GetLeft(control) + x);//control.Left += x;
control.Width -= x;
}
if (control.Height + y > control.MinHeight)
{
control.Height += y;
}
break;
case MousePos.RightTop:
if (control.Width + x > MinWidth)
{
control.Width += x;
}
if (control.Height - y > MinHeight)
{
SetTop(control, GetTop(control) + y);//control.Top += y;
control.Height -= y;
}
break;
case MousePos.RightBottom:
if (control.Width + x > MinWidth)
{
control.Width += x;
}
if (control.Height + y > MinHeight)
{
control.Height += y;
}
break;
default:
break;
}
}
}
#endregion

#region 对齐操作
/// <summary>
/// 是否使用网格对齐 10px
/// </summary>
public bool UseAutoAlignment
{
get { return (bool)GetValue(UseAutoAlignmentProperty); }
set { SetValue(UseAutoAlignmentProperty, value); }
}
public static readonly DependencyProperty UseAutoAlignmentProperty =
DependencyProperty.Register("UseAutoAlignment", typeof(bool), typeof(CanvasPanel), new PropertyMetadata(false));


public void AlignLeft()
{
if (SelectedItems == null || SelectedItems.Count == 0)
return;

var leftMin = SelectedItems.Min(x => Canvas.GetLeft(x));
foreach (var item in SelectedItems)
{
SetLeft(item, leftMin);
}
}

public void AlignRight()
{
if (SelectedItems == null || SelectedItems.Count == 0)
return;

var rightMax = SelectedItems.Max(x => GetLeft(x) + x.ActualWidth);
foreach (var item in SelectedItems)
{
var targetLeft = rightMax - item.ActualWidth;
SetLeft(item, targetLeft);
}
}

public void AlignCenter()
{
if (SelectedItems == null || SelectedItems.Count == 0)
return;

var leftmin = SelectedItems.Min(x => GetLeft(x));
var rightmax = SelectedItems.Max(x => GetLeft(x) + x.ActualWidth);
var center = (rightmax - leftmin) / 2 + leftmin;

foreach (var item in SelectedItems)
{
var target = center - (item.ActualWidth / 2);
SetLeft(item, target);
}
}

public void AlignTop()
{
if (SelectedItems == null || SelectedItems.Count == 0)
return;

var topMin = SelectedItems.Min(x => GetTop(x));
foreach (var item in SelectedItems)
{
SetTop(item, topMin);
}
}

public void AlignBottom()
{
if (SelectedItems == null || SelectedItems.Count == 0)
return;

var botMax = SelectedItems.Max(x => GetTop(x) + x.ActualHeight);
foreach (var item in SelectedItems)
{
var targetLeft = botMax - item.ActualHeight;
SetTop(item, targetLeft);
}
}

public void VertialLayout()
{
if (SelectedItems == null || SelectedItems.Count < 3)
return;

var topCtl = SelectedItems.Min(x => GetTop(x) + x.ActualHeight);
var botCtrl = SelectedItems.Max(x => GetTop(x));
var emptyHeight = botCtrl - topCtl;

var orderCtrl = SelectedItems.OrderBy(x => GetTop(x)).ToList();
orderCtrl.RemoveAt(0);
orderCtrl.RemoveAt(orderCtrl.Count - 1);
var useSpace = orderCtrl.Sum(x => x.ActualHeight);

var ableSpaceAvg = (emptyHeight - useSpace) / (SelectedItems.Count - 1);
double nowPostion = topCtl;
foreach (var item in orderCtrl)
{
SetTop(item, nowPostion + ableSpaceAvg);
nowPostion += item.ActualHeight + ableSpaceAvg;
}
}

public void HorizontalLayout()
{
if (SelectedItems == null || SelectedItems.Count < 3)
return;

var leftCtl = SelectedItems.Min(x => GetLeft(x) + x.ActualWidth);
var rightCtrl = SelectedItems.Max(x => GetLeft(x));
var emptyHeight = rightCtrl - leftCtl;

var orderCtrl = SelectedItems.OrderBy(x => GetLeft(x)).ToList();
orderCtrl.RemoveAt(0);
orderCtrl.RemoveAt(orderCtrl.Count - 1);
var useSpace = orderCtrl.Sum(x => x.ActualWidth);

var ableSpaceAvg = (emptyHeight - useSpace) / (SelectedItems.Count - 1);
double nowPostion = leftCtl;
foreach (var item in orderCtrl)
{
SetLeft(item, nowPostion + ableSpaceAvg);
nowPostion += item.ActualWidth + ableSpaceAvg;
}
}
#endregion

#region 按键操作
public RelayCommand CopySelectItemsCommand { get; set; }
public RelayCommand PasteSelectItemsCommand { get; set; }
public RelayCommand DeleteSelectItemsCommand { get; set; }
public RelayCommand SetTopLayerCommand { get; set; }
public RelayCommand SetBottomLayerCommand { get; set; }

List<FrameworkElement> copyTemp = new List<FrameworkElement>();

private void CanvasPanel_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.C && Keyboard.Modifiers == ModifierKeys.Control)
{
CopySelectItems();
}
else if (e.Key == Key.V && Keyboard.Modifiers == ModifierKeys.Control)
{
PasteSelectItems();
}
else if (e.Key == Key.Delete)
{
DeleteSelectItems();
}
else if (e.Key == Key.Up)
{
var offset = -1;
foreach (var item in SelectedItems)
{
SetTop(item, (GetTop(item) + offset) < 0 ? 0 : GetTop(item) + offset);
}
e.Handled = true;
}
else if (e.Key == Key.Down)
{
var offset = 1;
foreach (var item in SelectedItems)
{
SetTop(item, (GetTop(item) + offset) < 0 ? 0 : GetTop(item) + offset);
}
e.Handled = true;
}
else if (e.Key == Key.Left)
{
var offset = -1;
foreach (var item in SelectedItems)
{
SetLeft(item, (GetLeft(item) + offset) < 0 ? 0 : GetLeft(item) + offset);
}
e.Handled = true;

}
else if (e.Key == Key.Right)
{
var offset = 1;
foreach (var item in SelectedItems)
{
SetLeft(item, (GetLeft(item) + offset) < 0 ? 0 : GetLeft(item) + offset);
}
e.Handled = true;
}
}

/// <summary>
/// 复制
/// </summary>
public void CopySelectItems()
{
copyTemp.Clear();
foreach (var item in SelectedItems)
{
copyTemp.Add(item);
}
}

/// <summary>
/// 粘贴
/// </summary>
public void PasteSelectItems()
{
SelectedItems.Clear();
foreach (var item in copyTemp)
{
var xml = XamlWriter.Save(item);
var element = XamlReader.Parse(xml) as FrameworkElement;
element.Name += "_1";

SetLeft(element, GetLeft(element) + 10);
SetTop(element, GetTop(element) + 10);

Children.Add(element);
SelectedItems.Add(element);
}

// 将复制的内容替换 以便处理连续复制
copyTemp.Clear();
foreach (var item in SelectedItems)
{
copyTemp.Add(item);
}
RefreshSelection();
}

/// <summary>
/// 置于顶层
/// </summary>
public void SetTopLayer()
{
if (SelectedItems.Count == 0)
return;

foreach (var item in SelectedItems)
{
Children.Remove(item);
}

foreach (var item in SelectedItems)
{
Children.Add(item);
}
}

/// <summary>
/// 置于底层
/// </summary>
public void SetBottomLayer()
{
if (SelectedItems.Count == 0)
return;

foreach (var item in SelectedItems)
{
Children.Remove(item);
}

foreach (var item in SelectedItems)
{
Children.Insert(0, item);
}
}
/// <summary>
/// 删除
/// </summary>
public void DeleteSelectItems()
{
foreach (var item in SelectedItems)
{
Children.Remove(item);
}

SelectedItems.Clear();
RefreshSelection();
}
#endregion

#region 运行Xaml 保存 读取
public List<FrameworkElement> Generator()
{
List<FrameworkElement> elements = new List<FrameworkElement>();
foreach (var item in Children)
{
// 排除非自定义的控件们
if (!(item is IExecutable))
continue;
if(item is IDisposable) (item as IDisposable).Dispose();
var xml = XamlWriter.Save(item);
var ele = XamlReader.Parse(xml) as FrameworkElement;
elements.Add(ele);
}

return elements;
}

/// <summary>
/// 保存数据到文本
/// </summary>
public string Save()
{
StringBuilder sb = new StringBuilder();

foreach (var item in Children)
{
// 排除非自定义的控件们
if (!(item is IExecutable))
continue;
if (item is IDisposable) (item as IDisposable).Dispose();
var xml = XamlWriter.Save(item);
sb.Append(xml + "\r\n");
}

return sb.ToString();
}

/// <summary>
/// 读取文件
/// </summary>
public void Load(string path)
{
Children.Clear();
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using (StreamReader sr = new StreamReader(fs, System.Text.Encoding.Unicode))
{
while (sr.Peek() > -1)
{
string str = sr.ReadLine();
try
{
var ele = XamlReader.Parse(str) as FrameworkElement;
Children.Add(ele);
}
catch (Exception ex)
{

}

}
}

SelectedItems?.Clear();
}
#endregion
}
}

+ 11
- 10
BeDesignerSCADA/Controls/MainCanvasPanel.xaml View File

@@ -1,4 +1,5 @@
<UserControl x:Class="BeDesignerSCADA.Controls.MainCanvasPanel"
<UserControl
x:Class="BeDesignerSCADA.Controls.MainCanvasPanel"
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"
@@ -7,6 +8,7 @@
xmlns:s="clr-namespace:BeDesignerSCADA.Converters"
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:avae="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:Compiler="clr-namespace:BPASmartClient.Compiler;assembly=BPASmartClient.Compiler"
xmlns:ctl="clr-namespace:BeDesignerSCADA.Controls"
xmlns:mypro="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
@@ -153,19 +155,18 @@
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>

<ctl:CanvasPanel x:Name="cav" Visibility="{Binding CanvasPanelVisibility}" SelectedItem="{Binding CanSelectedItem,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AllowDrop="True" RenderTransformOrigin="0.5,0.5" ClipToBounds="True" UseLayoutRounding="True" Focusable="True" SnapsToDevicePixels="True">
<ctl:CanvasPanel.Background>
<Compiler:CanvasPanel x:Name="cav" Visibility="{Binding CanvasPanelVisibility}" SelectedItem="{Binding CanSelectedItem,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AllowDrop="True" RenderTransformOrigin="0.5,0.5" ClipToBounds="True" UseLayoutRounding="True" Focusable="True" SnapsToDevicePixels="True">
<Compiler:CanvasPanel.Background>
<VisualBrush TileMode="Tile" Viewport="0,0,20,20" ViewportUnits="Absolute">
<VisualBrush.Visual>
<Rectangle Width="20" Height="20" StrokeDashArray="4,2" StrokeThickness="0.5" Stroke="#CBCBCB">
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Style.Triggers>
<DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type ctl:CanvasPanel}, Mode=FindAncestor}}" Value="True">
<DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type Compiler:CanvasPanel}, Mode=FindAncestor}}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type ctl:CanvasPanel}, Mode=FindAncestor}}" Value="False">
<DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type Compiler:CanvasPanel}, Mode=FindAncestor}}" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
@@ -174,14 +175,14 @@
</Rectangle>
</VisualBrush.Visual>
</VisualBrush>
</ctl:CanvasPanel.Background>
</Compiler:CanvasPanel.Background>

<ctl:CanvasPanel.RenderTransform>
<Compiler:CanvasPanel.RenderTransform>
<TransformGroup>
<TranslateTransform x:Name="CanvasTranslate"/>
</TransformGroup>
</ctl:CanvasPanel.RenderTransform>
</ctl:CanvasPanel>
</Compiler:CanvasPanel.RenderTransform>
</Compiler:CanvasPanel>

<ctl:RunCanvas x:Name="runCanvas" Visibility="{Binding RunCanvasVisibility}" />



+ 0
- 198
BeDesignerSCADA/CustomerControls/ArcGauge.cs View File

@@ -1,198 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BeDesignerSCADA.CustomerControls
{
public class ArcGauge : Control, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public ArcGauge()
{
Width = 300;
Height = 300;
SetCurrentValue(ValueProperty, 0d);
SetCurrentValue(MinValueProperty, 0d);
SetCurrentValue(MaxValueProperty, 100d);
}

private void InitTick()
{
// 画大刻度
for (int i = 0; i < 11; i++)
{
Line line = new Line();
line.X1 = 0;
line.Y1 = 0;
line.X2 = 0;
line.Y2 = 12;
line.Stroke = Brushes.White;
line.StrokeThickness = 2;
line.HorizontalAlignment = HorizontalAlignment.Center;
line.RenderTransformOrigin = new Point(0.5, 0.5);
line.RenderTransform = new RotateTransform() { Angle = -140 + i * 28 };
bdGrid.Children.Add(line);
DrawText();
}

// 画小刻度
for (int i = 0; i < 10; i++)
{
var start = -140 + 28 * i + 2.8;
for (int j = 0; j < 9; j++)
{
Line line = new Line();
line.X1 = 0;
line.Y1 = 0;
line.X2 = 0;
line.Y2 = 6;
line.Stroke = Brushes.White;
line.StrokeThickness = 1;
line.HorizontalAlignment = HorizontalAlignment.Center;
line.RenderTransformOrigin = new Point(0.5, 0.5);
line.RenderTransform = new RotateTransform() { Angle = start + j * 2.8 };
bdGrid.Children.Add(line);
}
}
}

List<TextBlock> textLabels = new List<TextBlock>();
private void DrawText()
{
foreach (var item in textLabels)
{
bdGrid.Children.Remove(item);
}
textLabels.Clear();

var per = MaxValue / 10;
for (int i = 0; i < 11; i++)
{
TextBlock textBlock = new TextBlock();
textBlock.Text = $"{MinValue + (per * i)}";
textBlock.HorizontalAlignment = HorizontalAlignment.Center;
textBlock.RenderTransformOrigin = new Point(0.5, 0.5);
textBlock.RenderTransform = new RotateTransform() { Angle = -140 + i * 28 };
textBlock.Margin = new Thickness(12);
textBlock.Foreground = Brushes.White;
bdGrid.Children.Add(textBlock);
textLabels.Add(textBlock);
}
}

static ArcGauge()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ArcGauge), new FrameworkPropertyMetadata(typeof(ArcGauge)));
}

RotateTransform rotateTransform;
Grid bdGrid;
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
rotateTransform = GetTemplateChild("PointRotate") as RotateTransform;
bdGrid = GetTemplateChild("bdGrid") as Grid;
Refresh();
InitTick();
}

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

[Category("值设定")]
public double Value
{
get { return (double)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(double), typeof(ArcGauge), new PropertyMetadata(0d, OnValueChanged));

private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as ArcGauge)?.Refresh();

[Category("值设定")]
public double MinValue
{
get { return (double)GetValue(MinValueProperty); }
set { SetValue(MinValueProperty, value); }
}
public static readonly DependencyProperty MinValueProperty =
DependencyProperty.Register("MinValue", typeof(double), typeof(ArcGauge), new PropertyMetadata(0d, OnValueChanged));

[Category("值设定")]
public double MaxValue
{
get { return (double)GetValue(MaxValueProperty); }
set { SetValue(MaxValueProperty, value); }
}

public string ControlType => "控件";

public static readonly DependencyProperty MaxValueProperty =
DependencyProperty.Register("MaxValue", typeof(double), typeof(ArcGauge), new PropertyMetadata(0d, OnValueChanged));


private void Refresh()
{
if (rotateTransform == null)
return;
DrawText();
DoubleAnimation da = new DoubleAnimation();
da.Duration = new Duration(TimeSpan.FromMilliseconds(350));
da.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };

if (Value > MaxValue)
{
rotateTransform.Angle = 140;
da.To = 140;
}
else if (Value < MinValue)
{
rotateTransform.Angle = -140;
da.To = -140;
}
else
{
var range = MaxValue - MinValue;
var process = Value / range;
var tAngle = process * 280 - 140;
rotateTransform.Angle = tAngle;
da.To = tAngle;
}

rotateTransform.BeginAnimation(RotateTransform.AngleProperty, da);
}

public void Register()
{
Refresh();
}
}
}

+ 0
- 62
BeDesignerSCADA/CustomerControls/DigitalNumber.cs View File

@@ -1,62 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace BeDesignerSCADA.CustomerControls
{
public class DigitalNumber : Control, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public DigitalNumber()
{
Width = 80;
Height = 30;
}
public string ControlType => "控件";

static DigitalNumber()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(DigitalNumber), new FrameworkPropertyMetadata(typeof(DigitalNumber)));
}

TextBlock text = null;
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
text = GetTemplateChild("line") as TextBlock;
}

public double NumberValue
{
get { return (double)GetValue(NumberValueProperty); }
set { SetValue(NumberValueProperty, value); }
}
public static readonly DependencyProperty NumberValueProperty =
DependencyProperty.Register("NumberValue", typeof(double), typeof(DigitalNumber), new UIPropertyMetadata(0.00d));

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

public void Register()
{
}
}
}

+ 0
- 14
BeDesignerSCADA/CustomerControls/GraphArrow.xaml View File

@@ -1,14 +0,0 @@
<UserControl x:Class="BeDesignerSCADA.CustomerControls.GraphArrow"
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:BeDesignerSCADA.CustomerControls"
mc:Ignorable="d"
x:Name="root"
d:DesignHeight="44" d:DesignWidth="60" Foreground="#22DCF7">
<Grid>
<Path Data="M571.5,161.75L629,161.75 629,147.5 657.5,176 629,204.5 629,190.25 571.5,190.25z"
Stretch="Fill" Fill="{Binding ElementName=root,Path=Foreground}"/>
</Grid>
</UserControl>

+ 0
- 56
BeDesignerSCADA/CustomerControls/GraphArrow.xaml.cs View File

@@ -1,56 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
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 BeDesignerSCADA.CustomerControls
{
/// <summary>
/// GraphArrow.xaml 的交互逻辑
/// </summary>
public partial class GraphArrow : UserControl, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public GraphArrow()
{
InitializeComponent();
Width = 80;
Height = 80;
}

public string ControlType => "图形";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
IsEnabled = true;
Register();
Style = null;
}
}
}

public void Register()
{
}
}
}

+ 0
- 14
BeDesignerSCADA/CustomerControls/GraphStar.xaml View File

@@ -1,14 +0,0 @@
<UserControl x:Class="BeDesignerSCADA.CustomerControls.GraphStar"
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:BeDesignerSCADA.CustomerControls"
mc:Ignorable="d"
x:Name="root"
d:DesignHeight="1056" d:DesignWidth="1094" Foreground="#78C94F">
<Grid>
<Path Data="M132.5,205.601L206.22,205.602 229,131.5 251.78,205.602 325.5,205.601 265.859,251.398 288.64,325.5 229,279.702 169.36,325.5 192.141,251.398z"
Fill="{Binding ElementName=root,Path=Foreground}" Stretch="Fill"/>
</Grid>
</UserControl>

+ 0
- 56
BeDesignerSCADA/CustomerControls/GraphStar.xaml.cs View File

@@ -1,56 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
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 BeDesignerSCADA.CustomerControls
{
/// <summary>
/// GraphStar.xaml 的交互逻辑
/// </summary>
public partial class GraphStar : UserControl, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public GraphStar()
{
InitializeComponent();
Width = 100;
Height = 100;
}

public string ControlType => "图形";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
IsEnabled = true;
Register();
Style = null;
}
}
}

public void Register()
{
}
}
}

+ 0
- 240
BeDesignerSCADA/CustomerControls/KnobButton.cs View File

@@ -1,240 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BeDesignerSCADA.CustomerControls
{
public class KnobButton : Slider, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

static KnobButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(KnobButton), new FrameworkPropertyMetadata(typeof(KnobButton)));
}

public KnobButton()
{
SetCurrentValue(WidthProperty, 150d);
SetCurrentValue(HeightProperty, 150d);
SetCurrentValue(MaximumProperty, 100d);
MouseDown += Path_MouseDown;
MouseMove += Path_MouseMove;
MouseWheel += Path_MouseWheel;
MouseLeftButtonUp += KnobButton_MouseLeftButtonUp;
Update();
}

#region 设计需要
public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
Register();
}
}

/// <summary>
/// 注册需要处理的事件
/// </summary>
public void Register()
{
ValueChanged += KnobButton_ValueChanged; ;
}

private void KnobButton_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Config.GetInstance().RunJsScipt(ValueChangedExecute);
}
#endregion

#region 绘制
private void InitTick()
{
// 画大刻度
for (int i = 0; i < 11; i++)
{
Line line = new Line();
line.X1 = 0;
line.Y1 = 0;
line.X2 = 0;
line.Y2 = 12;
line.Stroke = Brushes.Gray;
line.StrokeThickness = 2;
line.HorizontalAlignment = HorizontalAlignment.Center;
line.RenderTransformOrigin = new Point(0.5, 0.5);
line.RenderTransform = new RotateTransform() { Angle = -140 + i * 28 };
bdGrid.Children.Add(line);
}

// 画小刻度
for (int i = 0; i < 10; i++)
{
var start = -140 + 28 * i + 2.8;
for (int j = 0; j < 9; j++)
{
Line line = new Line();
line.X1 = 0;
line.Y1 = 0;
line.X2 = 0;
line.Y2 = 6;
line.Stroke = Brushes.Gray;
line.StrokeThickness = 1;
line.HorizontalAlignment = HorizontalAlignment.Center;
line.RenderTransformOrigin = new Point(0.5, 0.5);
line.RenderTransform = new RotateTransform() { Angle = start + j * 2.8 };
bdGrid.Children.Add(line);
}
}
}
#endregion
protected override void OnValueChanged(double oldValue, double newValue)
{
base.OnValueChanged(oldValue, newValue);
Update();
}

protected override void OnMaximumChanged(double oldMaximum, double newMaximum)
{
base.OnMaximumChanged(oldMaximum, newMaximum);
Update();
}

protected override void OnMinimumChanged(double oldMinimum, double newMinimum)
{
base.OnMinimumChanged(oldMinimum, newMinimum);
Update();
}

public string ValueChangedExecute
{
get { return (string)GetValue(ValueChangedExecuteProperty); }
set { SetValue(ValueChangedExecuteProperty, value); }
}
public static readonly DependencyProperty ValueChangedExecuteProperty =
DependencyProperty.Register("ValueChangedExecute", typeof(string), typeof(KnobButton), new PropertyMetadata(string.Empty));

public int Step
{
get { return (int)GetValue(StepProperty); }
set { SetValue(StepProperty, value); }
}
public static readonly DependencyProperty StepProperty =
DependencyProperty.Register("Step", typeof(int), typeof(KnobButton), new PropertyMetadata(1));

RotateTransform rotatevalue;
Grid bdGrid;
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
rotatevalue = GetTemplateChild("rotatevalue") as RotateTransform;
bdGrid = GetTemplateChild("bdGrid") as Grid;
Update();
InitTick();
}

private void Update()
{
if (rotatevalue == null) return;
double perangle = 280 / (Maximum - Minimum);
double angle = (perangle * (Value - Minimum)) + 40;

DoubleAnimation da = new DoubleAnimation();
da.Duration = new Duration(TimeSpan.FromMilliseconds(350));
da.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };
da.To = angle;

rotatevalue.Angle = angle;
rotatevalue.BeginAnimation(RotateTransform.AngleProperty, da);
}

Point lastpoint;
private void Path_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Released) return;

CaptureMouse();
Point point = e.GetPosition(this);
double xmove = point.X - lastpoint.X;
double ymove = point.Y - lastpoint.Y;

double changeValue = (xmove + ymove) / 10 * Step;
if ((changeValue + Value) > Maximum)
{
if (Value < Maximum)
{
Value = Maximum;
}
return;
}

if ((changeValue + Value) < Minimum)
{
if (Value > Minimum)
{
Value = Minimum;
}
return;
}

Value = changeValue + Value;
lastpoint = point;
}

private void Path_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Released) return;
lastpoint = e.GetPosition(this);
}

private void KnobButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
ReleaseMouseCapture();
}

private void Path_MouseWheel(object sender, MouseWheelEventArgs e)
{
double changeValue = (e.Delta / 120) * Step;
if ((changeValue + Value) > Maximum)
{
if (Value < Maximum)
{
Value = Maximum;
}
return;
}

if ((changeValue + Value) < Minimum)
{
if (Value > Minimum)
{
Value = Minimum;
}
return;
}

Value = Value + changeValue;
Update();
}
}
}

+ 0
- 372
BeDesignerSCADA/CustomerControls/NumberBox.cs View File

@@ -1,372 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
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 BeDesignerSCADA.CustomerControls
{
public class NumberBox : TextBox, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

static NumberBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(NumberBox), new FrameworkPropertyMetadata(typeof(NumberBox)));

FrameworkPropertyMetadata metadata = new FrameworkPropertyMetadata(CURVALUE, new PropertyChangedCallback(OnCurValueChanged));
CurValueProperty = DependencyProperty.Register("CurValue", typeof(double), typeof(NumberBox), metadata);

metadata = new FrameworkPropertyMetadata(MINVALUE, new PropertyChangedCallback(OnMinValueChanged));
MinValueProperty = DependencyProperty.Register("MinValue", typeof(double), typeof(NumberBox), metadata);

metadata = new FrameworkPropertyMetadata(MAXVALUE, new PropertyChangedCallback(OnMaxValueChanged));
MaxValueProperty = DependencyProperty.Register("MaxValue", typeof(double), typeof(NumberBox), metadata);

metadata = new FrameworkPropertyMetadata(DIGITS, new PropertyChangedCallback(OnDigitsChanged));
DigitsProperty = DependencyProperty.Register("Digits", typeof(int), typeof(NumberBox), metadata);
}
public string ControlType => "控件";

public NumberBox()
{
Width = 80;
Height = 30;
CurValue = 0.01;
Digits = 2;

VerticalContentAlignment = VerticalAlignment.Center;
Style = Application.Current.Resources["DesignNumberBox"] as Style;//FindResource("DesignNumberBox") as Style;

this.TextChanged += NumberBox_TextChanged;
this.PreviewKeyDown += NumberBox_KeyDown;
this.LostFocus += NumberBox_LostFocus;
DataObject.AddPastingHandler(this, NumberBox_Pasting);
Focusable = false;
}

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
IsEnabled = true;
Register();
Style = null;
Focusable = true;
}
}
}

public void Register()
{
}

#region DependencyProperty
private const double CURVALUE = 0; //当前值
private const double MINVALUE = double.MinValue; //最小值
private const double MAXVALUE = double.MaxValue; //最大值
private const int DIGITS = 15; //小数点精度

public static readonly DependencyProperty CurValueProperty;
public static readonly DependencyProperty MinValueProperty;
public static readonly DependencyProperty MaxValueProperty;
public static readonly DependencyProperty DigitsProperty;

public double CurValue
{
get
{
return (double)GetValue(CurValueProperty);
}
set
{
double v = value;
if (value < MinValue)
{
v = MinValue;
}
else if (value > MaxValue)
{
v = MaxValue;
}
v = Math.Round(v, Digits);

SetValue(CurValueProperty, v);
// if do not go into OnCurValueChanged then force update ui
if (v != value)
{
this.Text = v.ToString();
}
}
}
public double MinValue
{
get
{
return (double)GetValue(MinValueProperty);
}
set
{
SetValue(MinValueProperty, value);
}
}
public double MaxValue
{
get
{
return (double)GetValue(MaxValueProperty);
}
set
{
SetValue(MaxValueProperty, value);
}
}
public int Digits
{
get
{
return (int)GetValue(DigitsProperty);
}
set
{
int digits = value;
if (digits <= 0)
{
digits = 0;
}
if (digits > 15)
{
digits = 15;
}
SetValue(DigitsProperty, value);
}
}

private static void OnCurValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
double value = (double)e.NewValue;
NumberBox numericBox = (NumberBox)sender;
numericBox.Text = value.ToString();
}
private static void OnMinValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
double minValue = (double)e.NewValue;
NumberBox numericBox = (NumberBox)sender;
numericBox.MinValue = minValue;
}
private static void OnMaxValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
double maxValue = (double)e.NewValue;
NumberBox numericBox = (NumberBox)sender;
numericBox.MaxValue = maxValue;
}
private static void OnDigitsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
int digits = (int)e.NewValue;
NumberBox numericBox = (NumberBox)sender;
numericBox.CurValue = Math.Round(numericBox.CurValue, digits);
numericBox.MinValue = Math.Round(numericBox.MinValue, digits);
numericBox.MaxValue = Math.Round(numericBox.MaxValue, digits);
}
#endregion


void NumberBox_TextChanged(object sender, TextChangedEventArgs e)
{
NumberBox numericBox = sender as NumberBox;
if (string.IsNullOrEmpty(numericBox.Text))
{
return;
}

TrimZeroStart();

double value = MinValue;
if (!Double.TryParse(numericBox.Text, out value))
{
return;
}

if (value != this.CurValue)
{
this.CurValue = value;
}
}

void NumberBox_KeyDown(object sender, KeyEventArgs e)
{
Key key = e.Key;
if (IsControlKeys(key))
{
return;
}
else if (IsDigit(key))
{
return;
}
else if (IsSubtract(key)) //-
{
TextBox textBox = sender as TextBox;
string str = textBox.Text;
if (str.Length > 0 && textBox.SelectionStart != 0)
{
e.Handled = true;
}
}
else if (IsDot(key)) //point
{
if (this.Digits > 0)
{
TextBox textBox = sender as TextBox;
string str = textBox.Text;
if (str.Contains('.') || str == "-")
{
e.Handled = true;
}
}
else
{
e.Handled = true;
}
}
else
{
e.Handled = true;
}
}

void NumberBox_LostFocus(object sender, RoutedEventArgs e)
{
NumberBox numericBox = sender as NumberBox;
if (string.IsNullOrEmpty(numericBox.Text))
{
numericBox.Text = this.CurValue.ToString();
}
}

private void NumberBox_Pasting(object sender, DataObjectPastingEventArgs e)
{
e.CancelCommand();
}

private static readonly List<Key> _controlKeys = new List<Key>
{
Key.Back,
Key.CapsLock,
Key.Down,
Key.End,
Key.Enter,
Key.Escape,
Key.Home,
Key.Insert,
Key.Left,
Key.PageDown,
Key.PageUp,
Key.Right,
Key.Tab,
Key.Up
};
public static bool IsControlKeys(Key key)
{
return _controlKeys.Contains(key);
}

public static bool IsDigit(Key key)
{
bool shiftKey = (Keyboard.Modifiers & ModifierKeys.Shift) != 0;
bool retVal;
if (key >= Key.D0 && key <= Key.D9 && !shiftKey)
{
retVal = true;
}
else
{
retVal = key >= Key.NumPad0 && key <= Key.NumPad9;
}
return retVal;
}


public static bool IsDot(Key key)
{
bool shiftKey = (Keyboard.Modifiers & ModifierKeys.Shift) != 0;
bool flag = false;
if (key == Key.Decimal)
{
flag = true;
}
if (key == Key.OemPeriod && !shiftKey)
{
flag = true;
}
return flag;
}
public static bool IsSubtract(Key key)
{
bool shiftKey = (Keyboard.Modifiers & ModifierKeys.Shift) != 0;
bool flag = false;
if (key == Key.Subtract)
{
flag = true;
}
if (key == Key.OemMinus && !shiftKey)
{
flag = true;
}
return flag;
}

private void TrimZeroStart()
{
if (this.Text.Length == 1)
{
return;
}
string resultText = this.Text;
int zeroCount = 0;
foreach (char c in this.Text)
{
if (c == '0') { zeroCount++; }
else { break; }
}
if (zeroCount == 0)
{
return;
}

if (this.Text.Contains('.'))
{
if (this.Text[zeroCount] != '.')
{
resultText = this.Text.TrimStart('0');
}
else if (zeroCount > 1)
{
resultText = this.Text.Substring(zeroCount - 1);
}
}
else if (zeroCount > 0)
{
resultText = this.Text.TrimStart('0');
}
}

}
}

+ 0
- 101
BeDesignerSCADA/CustomerControls/StatusLight.cs View File

@@ -1,101 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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 BeDesignerSCADA.CustomerControls
{
public class StatusLight : Control, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public StatusLight()
{
Width = 80;
Height = 80;
}
public string ControlType => "控件";

static StatusLight()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(StatusLight), new FrameworkPropertyMetadata(typeof(StatusLight)));
}

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

/// <summary>
/// 状态值
/// </summary>
[Category("值设定")]
public int StatusValue
{
get { return (int)GetValue(StatusValueProperty); }
set { SetValue(StatusValueProperty, value); }
}
public static readonly DependencyProperty StatusValueProperty =
DependencyProperty.Register("StatusValue", typeof(int), typeof(StatusLight), new UIPropertyMetadata(0, OnStatusChanged));

private static void OnStatusChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as StatusLight).Refresh();

private void Refresh()
{
if (image != null)
{
switch (StatusValue)
{
case 0:
image.Source = new BitmapImage(new Uri("pack://application:,,,/Images/State0.png", UriKind.Absolute));
break;
case -1:
image.Source = new BitmapImage(new Uri("pack://application:,,,/Images/State11.png", UriKind.Absolute));
break;
case 1:
image.Source = new BitmapImage(new Uri("pack://application:,,,/Images/State1.png", UriKind.Absolute));
break;
case 2:
image.Source = new BitmapImage(new Uri("pack://application:,,,/Images/State2.png", UriKind.Absolute));
break;
default:
break;
}
}
}

Image image;
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
image = GetTemplateChild("ima") as Image;
Refresh();
}

public void Register()
{
}
}
}

+ 0
- 150
BeDesignerSCADA/CustomerControls/SwitchButton.cs View File

@@ -1,150 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;


namespace BeDesignerSCADA.CustomerControls
{
[TemplatePart(Name = ELLIPSE, Type = typeof(FrameworkElement))]
[TemplatePart(Name = TranslateX, Type = typeof(TranslateTransform))]
public class SwitchButton : ToggleButton, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public SwitchButton()
{
SetCurrentValue(WidthProperty, 120d);
SetCurrentValue(HeightProperty, 40d);
}

public const string ELLIPSE = "ELLIPSE";
public const string TranslateX = "TranslateX";
static SwitchButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(SwitchButton), new FrameworkPropertyMetadata(typeof(SwitchButton)));
}

/// <summary>
/// 不勾选时执行代码
/// </summary>
[Category("事件")]
public string UnCheckedExec
{
get { return (string)GetValue(UnCheckedExecProperty); }
set { SetValue(UnCheckedExecProperty, value); }
}
public static readonly DependencyProperty UnCheckedExecProperty =
DependencyProperty.Register("UnCheckedExec", typeof(string), typeof(SwitchButton), new PropertyMetadata(string.Empty));

/// <summary>
/// 勾选时执行代码
/// </summary>
[Category("事件")]
public string CheckedExec
{
get { return (string)GetValue(CheckedExecProperty); }
set { SetValue(CheckedExecProperty, value); }
}
public static readonly DependencyProperty CheckedExecProperty =
DependencyProperty.Register("CheckedExec", typeof(string), typeof(SwitchButton), new PropertyMetadata(string.Empty));

protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
ellipse.Width = Height - 8;
ellipse.Height = Height - 8;
Refresh();
}

TranslateTransform transX;
Ellipse ellipse;
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
ellipse = GetTemplateChild(ELLIPSE) as Ellipse;
transX = GetTemplateChild(TranslateX) as TranslateTransform;
}
protected override void OnChecked(RoutedEventArgs e)
{
base.OnChecked(e);
Refresh();
}
protected override void OnUnchecked(RoutedEventArgs e)
{
base.OnUnchecked(e);
Refresh();
}

void Refresh()
{
if (ellipse == null)
{
return;
}
DoubleAnimation da = new DoubleAnimation();
da.Duration = new Duration(TimeSpan.FromMilliseconds(250));
da.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };
if (IsChecked == true)
{
da.To = ActualWidth - ellipse.ActualWidth - 5;
ellipse.SetCurrentValue(Ellipse.FillProperty, Background);
}
else
{
da.To = 3;
ellipse.SetCurrentValue(Ellipse.FillProperty, Brushes.Gray);
}

transX.BeginAnimation(TranslateTransform.XProperty, da);
}

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

public void Register()
{
Checked += TheCheckBox_Checked;
Unchecked += TheCheckBox_Unchecked;
}
private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(UnCheckedExec);
}

private void TheCheckBox_Checked(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(CheckedExec);
}
public string ControlType => "控件";

}


}

+ 0
- 9
BeDesignerSCADA/CustomerControls/TheButton.xaml View File

@@ -1,9 +0,0 @@
<Button x:Class="BeDesignerSCADA.CustomerControls.TheButton"
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:BeDesignerSCADA.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</Button>

+ 0
- 77
BeDesignerSCADA/CustomerControls/TheButton.xaml.cs View File

@@ -1,77 +0,0 @@

using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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 BeDesignerSCADA.CustomerControls
{
/// <summary>
/// TheButton.xaml 的交互逻辑
/// </summary>
public partial class TheButton : Button, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public TheButton()
{
InitializeComponent();
Content = "按钮";
Width = 80;
Height = 30;
Style = Application.Current.Resources["DesignButton"] as Style;//FindResource("DesignButton") as Style;
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Style = null;
Register();
}
}
}

[Category("事件")]
public string ClickExec
{
get { return (string)GetValue(ClickExecProperty); }
set { SetValue(ClickExecProperty, value); }
}
public static readonly DependencyProperty ClickExecProperty =
DependencyProperty.Register("ClickExec", typeof(string), typeof(TheButton), new PropertyMetadata(string.Empty));

/// <summary>
/// 注册需要处理的事件
/// </summary>
public void Register()
{
this.Click += MyButton_Click;
}

private void MyButton_Click(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(ClickExec);
}
}
}

+ 0
- 9
BeDesignerSCADA/CustomerControls/TheCheckBox.xaml View File

@@ -1,9 +0,0 @@
<CheckBox x:Class="BeDesignerSCADA.CustomerControls.TheCheckBox"
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:BeDesignerSCADA.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</CheckBox>

+ 0
- 92
BeDesignerSCADA/CustomerControls/TheCheckBox.xaml.cs View File

@@ -1,92 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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 BeDesignerSCADA.CustomerControls
{
/// <summary>
/// TheCheckBox.xaml 的交互逻辑
/// </summary>
public partial class TheCheckBox : CheckBox, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public TheCheckBox()
{
InitializeComponent();
Content = "勾选框";
VerticalContentAlignment = VerticalAlignment.Center;
}

public string ControlType => "控件";


private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

/// <summary>
/// 不勾选时执行代码
/// </summary>
[Category("事件")]
public string UnCheckedExec
{
get { return (string)GetValue(UnCheckedExecProperty); }
set { SetValue(UnCheckedExecProperty, value); }
}
public static readonly DependencyProperty UnCheckedExecProperty =
DependencyProperty.Register("UnCheckedExec", typeof(string), typeof(TheCheckBox), new PropertyMetadata(string.Empty));

/// <summary>
/// 勾选时执行代码
/// </summary>
[Category("事件")]
public string CheckedExec
{
get { return (string)GetValue(CheckedExecProperty); }
set { SetValue(CheckedExecProperty, value); }
}
public static readonly DependencyProperty CheckedExecProperty =
DependencyProperty.Register("CheckedExec", typeof(string), typeof(TheCheckBox), new PropertyMetadata(string.Empty));

public void Register()
{
Checked += TheCheckBox_Checked;
Unchecked += TheCheckBox_Unchecked;
}

private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(UnCheckedExec);
}

private void TheCheckBox_Checked(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(CheckedExec);
}
}
}

+ 0
- 9
BeDesignerSCADA/CustomerControls/TheComboBox.xaml View File

@@ -1,9 +0,0 @@
<ComboBox x:Class="BeDesignerSCADA.CustomerControls.TheComboBox"
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:BeDesignerSCADA.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</ComboBox>

+ 0
- 75
BeDesignerSCADA/CustomerControls/TheComboBox.xaml.cs View File

@@ -1,75 +0,0 @@
using BeDesignerSCADA.Speical;
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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;

namespace BeDesignerSCADA.CustomerControls
{
/// <summary>
/// TheComboBox.xaml 的交互逻辑
/// </summary>
public partial class TheComboBox : ComboBox, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public TheComboBox()
{
InitializeComponent();
VerticalContentAlignment = VerticalAlignment.Center;
ItemsString = new ItemsList() { "AA", "BB" };
Style = Application.Current.Resources["DesignComboBox"] as Style;
Width = 80;
Height = 30;
Focusable = false;
}
public string ControlType => "控件";

public ItemsList ItemsString
{
get { return (ItemsList)GetValue(ItemsStringProperty); }
set { SetValue(ItemsStringProperty, value); }
}

public static readonly DependencyProperty ItemsStringProperty =
DependencyProperty.Register("ItemsString", typeof(ItemsList), typeof(TheComboBox), new PropertyMetadata(null));

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Focusable = true;
IsEnabled = true;
Register();
Style = null;
}
}
}

public void Register()
{
// 运行时进行项目绑定
Binding binding = new Binding();
binding.RelativeSource = new RelativeSource() { Mode = RelativeSourceMode.Self };
binding.Path = new PropertyPath("ItemsString");
SetBinding(ItemsSourceProperty, binding);
}
}
}

+ 0
- 9
BeDesignerSCADA/CustomerControls/TheGroupBox.xaml View File

@@ -1,9 +0,0 @@
<GroupBox x:Class="BeDesignerSCADA.CustomerControls.TheGroupBox"
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:BeDesignerSCADA.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</GroupBox>

+ 0
- 58
BeDesignerSCADA/CustomerControls/TheGroupBox.xaml.cs View File

@@ -1,58 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
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 BeDesignerSCADA.CustomerControls
{
/// <summary>
/// TheGroupBox.xaml 的交互逻辑
/// </summary>
public partial class TheGroupBox : GroupBox, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public TheGroupBox()
{
InitializeComponent();
Width = 150;
Height = 150;
Header = "分组";
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

/// <summary>
/// 注册需要处理的事件
/// </summary>
public void Register()
{
}
}
}

+ 0
- 9
BeDesignerSCADA/CustomerControls/TheImage.xaml View File

@@ -1,9 +0,0 @@
<Image x:Class="BeDesignerSCADA.CustomerControls.TheImage"
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:BeDesignerSCADA.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</Image>

+ 0
- 57
BeDesignerSCADA/CustomerControls/TheImage.xaml.cs View File

@@ -1,57 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
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 BeDesignerSCADA.CustomerControls
{
/// <summary>
/// TheImage.xaml 的交互逻辑
/// </summary>
public partial class TheImage : Image, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public TheImage()
{
InitializeComponent();
Stretch = Stretch.UniformToFill;
SetCurrentValue(SourceProperty, new BitmapImage(new Uri("pack://application:,,,/Images/win.png", UriKind.Absolute)));
Width = 120;
Height = 40;
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

public void Register()
{

}
}
}

+ 0
- 59
BeDesignerSCADA/CustomerControls/TheRadioButton.cs View File

@@ -1,59 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
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 BeDesignerSCADA.CustomerControls
{
public class TheRadioButton : RadioButton, IExecutable, IDisposable
{
public event EventHandler PropertyChange; //声明一个事件

public TheRadioButton()
{
SetCurrentValue(ContentProperty, "单选按钮");
}
static TheRadioButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TheRadioButton), new FrameworkPropertyMetadata(typeof(TheRadioButton)));
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
Style = null;
}
}
}

public void Register()
{

}

public void Dispose()
{
}
}
}

+ 0
- 69
BeDesignerSCADA/CustomerControls/TheSlider.cs View File

@@ -1,69 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
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 BeDesignerSCADA.CustomerControls
{
public class TheSlider : Slider, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

static TheSlider()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TheSlider), new FrameworkPropertyMetadata(typeof(TheSlider)));
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
Style = null;
}
}
}

public string ValueChangedExecute
{
get { return (string)GetValue(ValueChangedExecuteProperty); }
set { SetValue(ValueChangedExecuteProperty, value); }
}
public static readonly DependencyProperty ValueChangedExecuteProperty =
DependencyProperty.Register("ValueChangedExecute", typeof(string), typeof(TheSlider), new PropertyMetadata(string.Empty));


public void Register()
{
ValueChanged += TheSlider_ValueChanged;
}

private void TheSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Config.GetInstance().RunJsScipt(ValueChangedExecute);
}

public void Dispose()
{
}
}
}

+ 0
- 9
BeDesignerSCADA/CustomerControls/TheTextBlock.xaml View File

@@ -1,9 +0,0 @@
<TextBlock x:Class="BeDesignerSCADA.CustomerControls.TheTextBlock"
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:BeDesignerSCADA.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</TextBlock>

+ 0
- 55
BeDesignerSCADA/CustomerControls/TheTextBlock.xaml.cs View File

@@ -1,55 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
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 BeDesignerSCADA.CustomerControls
{
/// <summary>
/// TheTextBlock.xaml 的交互逻辑
/// </summary>
public partial class TheTextBlock : TextBlock, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public TheTextBlock()
{
InitializeComponent();
Text = "文本块";
Width = 80;
Height = 30;
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

public void Register()
{
}
}
}

+ 0
- 61
BeDesignerSCADA/CustomerControls/TheTextBox.cs View File

@@ -1,61 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
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 BeDesignerSCADA.CustomerControls
{
public class TheTextBox : TextBox, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

static TheTextBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TheTextBox), new FrameworkPropertyMetadata(typeof(TheTextBox)));
}

public TheTextBox()
{
Width = 80;
Height = 30;
Text = "0.01";
VerticalContentAlignment = VerticalAlignment.Center;
Style = Application.Current.Resources["DesignTheTextBox"] as Style;//FindResource("DesignTheTextBox") as Style;
Focusable = false;
}
public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
IsEnabled = true;
Focusable = true;
Register();
Style = null;
}
}
}

public void Register()
{
}
}
}

+ 0
- 99
BeDesignerSCADA/CustomerControls/TheTimer.cs View File

@@ -1,99 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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 System.Windows.Threading;

namespace BeDesignerSCADA.CustomerControls
{
public class TheTimer : Control, IExecutable, IDisposable
{
public event EventHandler PropertyChange; //声明一个事件

public TheTimer()
{
Width = 40;
Height = 40;
}
static TheTimer()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TheTimer), new FrameworkPropertyMetadata(typeof(TheTimer)));
}

public string ControlType => "控件";


private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
Style = null;
}
}
}

DispatcherTimer timer = new DispatcherTimer();
public void Register()
{
timer.Interval = TimeSpan.FromMilliseconds(Interval);
timer.Tick += Timer_Tick;
timer.Start();
}

private void Timer_Tick(object sender, EventArgs e)
{
Config.GetInstance().RunJsScipt(TikcExecute);
}

public void Start() => timer.Start();
public void Stop() => timer.Stop();

public void Dispose()
{
timer.Stop();
}

/// <summary>
/// 时间间隔
/// </summary>
public int Interval
{
get { return (int)GetValue(IntervalProperty); }
set { SetValue(IntervalProperty, value); }
}
public static readonly DependencyProperty IntervalProperty =
DependencyProperty.Register("Interval", typeof(int), typeof(TheTimer), new PropertyMetadata(0));


/// <summary>
/// 执行内容
/// </summary>
[Category("事件")]
public string TikcExecute
{
get { return (string)GetValue(TikcExecuteProperty); }
set { SetValue(TikcExecuteProperty, value); }
}
public static readonly DependencyProperty TikcExecuteProperty =
DependencyProperty.Register("TikcExecute", typeof(string), typeof(TheTimer), new PropertyMetadata(string.Empty));
}
}

+ 0
- 9
BeDesignerSCADA/CustomerControls/TheToggleButton.xaml View File

@@ -1,9 +0,0 @@
<ToggleButton x:Class="BeDesignerSCADA.CustomerControls.TheToggleButton"
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:BeDesignerSCADA.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</ToggleButton>

+ 0
- 96
BeDesignerSCADA/CustomerControls/TheToggleButton.xaml.cs View File

@@ -1,96 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
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 BeDesignerSCADA.CustomerControls
{
/// <summary>
/// TheToggleButton.xaml 的交互逻辑
/// </summary>
public partial class TheToggleButton : ToggleButton, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

public TheToggleButton()
{
InitializeComponent();
Content = "开关";
Width = 80;
Height = 30;
Style = Application.Current.Resources["DesignToggleButton"] as Style;//FindResource("DesignToggleButton") as Style;
VerticalContentAlignment = VerticalAlignment.Center;
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Style = Application.Current.Resources["ExecuteToggleButton"] as Style;//FindResource("ExecuteToggleButton") as Style;

Register();
}
}
}

/// <summary>
/// 不勾选时执行代码
/// </summary>
[Category("事件")]
public string UnCheckedExec
{
get { return (string)GetValue(UnCheckedExecProperty); }
set { SetValue(UnCheckedExecProperty, value); }
}
public static readonly DependencyProperty UnCheckedExecProperty =
DependencyProperty.Register("UnCheckedExec", typeof(string), typeof(TheToggleButton), new PropertyMetadata(string.Empty));

/// <summary>
/// 勾选时执行代码
/// </summary>
[Category("事件")]
public string CheckedExec
{
get { return (string)GetValue(CheckedExecProperty); }
set { SetValue(CheckedExecProperty, value); }
}
public static readonly DependencyProperty CheckedExecProperty =
DependencyProperty.Register("CheckedExec", typeof(string), typeof(TheToggleButton), new PropertyMetadata(string.Empty));

public void Register()
{
Checked += TheCheckBox_Checked;
Unchecked += TheCheckBox_Unchecked;
}

private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(UnCheckedExec);
}

private void TheCheckBox_Checked(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(CheckedExec);
}
}
}

+ 0
- 187
BeDesignerSCADA/CustomerControls/WaveProgressBar.cs View File

@@ -1,187 +0,0 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;

namespace BeDesignerSCADA.CustomerControls
{
/// <summary>
/// 波浪进度条
/// </summary>
[TemplatePart(Name = ElementWave, Type = typeof(FrameworkElement))]
[TemplatePart(Name = ElementClip, Type = typeof(FrameworkElement))]
public class WaveProgressBar : RangeBase, IExecutable
{
public event EventHandler PropertyChange; //声明一个事件

private const string ElementWave = "PART_Wave";

private const string ElementClip = "PART_Clip";

private FrameworkElement _waveElement;

private const double TranslateTransformMinY = -20;

private double _translateTransformYRange;

private TranslateTransform _translateTransform;

public WaveProgressBar()
{
Loaded += (s, e) => UpdateWave(Value);
SetCurrentValue(WidthProperty, 200d);
SetCurrentValue(HeightProperty, 200d);
SetCurrentValue(ValueProperty, 50d);
}

static WaveProgressBar()
{
FocusableProperty.OverrideMetadata(typeof(WaveProgressBar),
new FrameworkPropertyMetadata(ValueBoxes.FalseBox));
MaximumProperty.OverrideMetadata(typeof(WaveProgressBar),
new FrameworkPropertyMetadata(ValueBoxes.Double100Box));
}

protected override void OnValueChanged(double oldValue, double newValue)
{
base.OnValueChanged(oldValue, newValue);

UpdateWave(newValue);
}

private void UpdateWave(double value)
{
if (_translateTransform == null || IsVerySmall(Maximum)) return;
var scale = 1 - value / Maximum;
var y = _translateTransformYRange * scale + TranslateTransformMinY;
_translateTransform.Y = y;
}

public static bool IsVerySmall(double value) => Math.Abs(value) < 1E-06;

public override void OnApplyTemplate()
{
base.OnApplyTemplate();

_waveElement = GetTemplateChild(ElementWave) as FrameworkElement;
var clipElement = GetTemplateChild(ElementClip) as FrameworkElement;

if (_waveElement != null && clipElement != null)
{
_translateTransform = new TranslateTransform
{
Y = clipElement.Height
};
_translateTransformYRange = clipElement.Height - TranslateTransformMinY;
_waveElement.RenderTransform = new TransformGroup
{
Children = { _translateTransform }
};
}
}

public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
"Text", typeof(string), typeof(WaveProgressBar), new PropertyMetadata(default(string)));

public string Text
{
get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
}

public static readonly DependencyProperty ShowTextProperty = DependencyProperty.Register(
"ShowText", typeof(bool), typeof(WaveProgressBar), new PropertyMetadata(ValueBoxes.TrueBox));

public bool ShowText
{
get => (bool)GetValue(ShowTextProperty);
set => SetValue(ShowTextProperty, ValueBoxes.BooleanBox(value));
}

public static readonly DependencyProperty WaveFillProperty = DependencyProperty.Register(
"WaveFill", typeof(Brush), typeof(WaveProgressBar), new PropertyMetadata(default(Brush)));

public Brush WaveFill
{
get => (Brush)GetValue(WaveFillProperty);
set => SetValue(WaveFillProperty, value);
}

public static readonly DependencyProperty WaveThicknessProperty = DependencyProperty.Register(
"WaveThickness", typeof(double), typeof(WaveProgressBar), new PropertyMetadata(ValueBoxes.Double0Box));

public double WaveThickness
{
get => (double)GetValue(WaveThicknessProperty);
set => SetValue(WaveThicknessProperty, value);
}

public static readonly DependencyProperty WaveStrokeProperty = DependencyProperty.Register(
"WaveStroke", typeof(Brush), typeof(WaveProgressBar), new PropertyMetadata(default(Brush)));

public Brush WaveStroke
{
get => (Brush)GetValue(WaveStrokeProperty);
set => SetValue(WaveStrokeProperty, value);
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

public void Register()
{
}
}

internal static class ValueBoxes
{
internal static object TrueBox = true;

internal static object FalseBox = false;

internal static object Double0Box = .0;

internal static object Double01Box = .1;

internal static object Double1Box = 1.0;

internal static object Double10Box = 10.0;

internal static object Double20Box = 20.0;

internal static object Double100Box = 100.0;

internal static object Double200Box = 200.0;

internal static object Double300Box = 300.0;

internal static object DoubleNeg1Box = -1.0;

internal static object Int0Box = 0;

internal static object Int1Box = 1;

internal static object Int2Box = 2;

internal static object Int5Box = 5;

internal static object Int99Box = 99;

internal static object BooleanBox(bool value) => value ? TrueBox : FalseBox;
}
}

BIN
View File


BIN
View File


+ 1
- 297
BeDesignerSCADA/Themes/Styles.xaml View File

@@ -2,7 +2,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BeDesignerSCADA.Converters"
xmlns:ctrl="clr-namespace:BeDesignerSCADA.CustomerControls"
xmlns:dxmvmm="clr-namespace:BeDesignerSCADA.Converters"
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore">
@@ -443,302 +442,7 @@

<!--#endregion-->

<!--#region 控件集合-->
<!--<Style TargetType="ctrl:DigitalNumber">
<Setter Property="Background" Value="#FF1A1E22"/>
<Setter Property="Foreground" Value="#FF0AA74D"/>
<Setter Property="NumberValue" Value="0.01"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:DigitalNumber">
<Grid Background="{TemplateBinding Background}">
<TextBlock x:Name="line" VerticalAlignment="Center" HorizontalAlignment="Center"
FontFamily="{StaticResource Digital}" FontSize="{TemplateBinding FontSize}"
Text="{Binding NumberValue,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ctrl:DigitalNumber},Mode=TwoWay}"
Foreground="{TemplateBinding Foreground}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ctrl:TheTimer}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ctrl:TheTimer}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Image Source="../Images/timericon.png" RenderOptions.BitmapScalingMode="Fant"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>


<Style TargetType="{x:Type ctrl:StatusLight}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ctrl:StatusLight}">
<Border Width="{Binding Path=ActualHeight,RelativeSource={RelativeSource Self}}">
<Grid>
<Image x:Name="ima" Source="../Images/State0.png" RenderOptions.BitmapScalingMode="Fant">
</Image>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ctrl:ArcGauge}">
<Setter Property="Background" Value="#646464"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ctrl:ArcGauge}">
<Border Margin="10">
<Grid Width="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}">
<Ellipse Fill="#FF3B3B3B"/>
<Grid RenderTransformOrigin="0.5,0.5" Margin="2">
<Grid.RenderTransform>
<TransformGroup>
<RotateTransform Angle="{Binding Path=Angle,ElementName=PointRotate}"/>
</TransformGroup>
</Grid.RenderTransform>
<Ellipse Width="16" Height="14" Fill="Orange" VerticalAlignment="Top" >
<Ellipse.Effect>
<BlurEffect Radius="12"/>
</Ellipse.Effect>
</Ellipse>
</Grid>

<Grid x:Name="bdGrid" Margin="12" UseLayoutRounding="True" ClipToBounds="True">
<Ellipse>
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="#4D000000"/>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="2*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Ellipse Stroke="#464646" StrokeThickness="1" Grid.Column="1" Grid.Row="1"/>
<Ellipse Stroke="#959595" Margin="4" StrokeThickness="6" Grid.Column="1" Grid.Row="1"/>
<Ellipse Stroke="#464646" Margin="14" StrokeThickness="1" Grid.Column="1" Grid.Row="1"/>
</Grid>

<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Path Data="M5,0 5,0 10,120 0,120z" Fill="#0FA9CE" Stretch="Uniform" Margin="0 30 0 0" RenderTransformOrigin="0.5,1" HorizontalAlignment="Center">
<Path.RenderTransform>
<TransformGroup>
<RotateTransform x:Name="PointRotate"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
</Grid>

<Ellipse Width="28" Height="28" Fill="Black">
<Ellipse.Effect>
<DropShadowEffect Color="#0FA9CE" ShadowDepth="0" Direction="0" BlurRadius="16"/>
</Ellipse.Effect>
</Ellipse>

<Border VerticalAlignment="Bottom" BorderBrush="#10ABD1" BorderThickness="2" Margin="0 0 0 12" Background="Black" Padding="4 2" HorizontalAlignment="Center">
<TextBlock Text="{Binding Value,RelativeSource={RelativeSource Mode=TemplatedParent},StringFormat={}{0:f1}}" FontSize="16" Width="46" TextAlignment="Center" Foreground="White"/>
</Border>
</Grid>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ctrl:TheTextBox}" BasedOn="{StaticResource {x:Type TextBox}}"/>

<Style x:Key="DesignTheTextBox" TargetType="{x:Type ctrl:TheTextBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:TheTextBox">
<Border BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1" Background="{StaticResource ControlBackground}">
<TextBlock Margin="4 0 0 0" Text="{TemplateBinding Text}" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ctrl:NumberBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="input:InputMethod.IsInputMethodEnabled" Value="False"/>
</Style>

<Style x:Key="DesignNumberBox" TargetType="{x:Type ctrl:NumberBox}">
<Setter Property="input:InputMethod.IsInputMethodEnabled" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:NumberBox">
<Border BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1" Background="{StaticResource ControlBackground}">
<TextBlock Margin="4 0 0 0" Text="{TemplateBinding Text}" VerticalAlignment="Center" Foreground="BlueViolet"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ctrl:TheSlider}" BasedOn="{StaticResource {x:Type Slider}}">
<Setter Property="Width" Value="140"/>
<Setter Property="Maximum" Value="100"/>
<Setter Property="IsSnapToTickEnabled" Value="True"/>
<Setter Property="Minimum" Value="0"/>
<Setter Property="AutoToolTipPlacement" Value="BottomRight"/>
<Setter Property="SmallChange" Value="0.1"/>
<Setter Property="LargeChange" Value="0.1"/>
</Style>


<Style TargetType="{x:Type ctrl:TheRadioButton}" BasedOn="{StaticResource {x:Type RadioButton}}">
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>

<Style TargetType="{x:Type ctrl:WaveProgressBar}">
<Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="WaveFill" Value="#36E7AE"/>
<Setter Property="WaveThickness" Value="2"/>
<Setter Property="WaveStroke" Value="#3649E7"/>
<Setter Property="ShowText" Value="True" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:WaveProgressBar">
<ControlTemplate.Resources>
<Storyboard x:Key="StoryboardOnLoaded" RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="PART_Wave">
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="-400"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<StackPanel>
<Border Background="{TemplateBinding Background}">
<Viewbox>
<Border x:Name="PART_Clip" BorderThickness="{TemplateBinding BorderThickness}" ClipToBounds="True"
BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="100" Width="200" Height="200">
<Border.Clip>
<EllipseGeometry RadiusX="100" RadiusY="100" Center="100,100"/>
</Border.Clip>
<Grid>
<Path x:Name="PART_Wave" Stroke="{TemplateBinding WaveStroke}" ClipToBounds="True" StrokeThickness="{TemplateBinding WaveThickness}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600" Height="250" Fill="{TemplateBinding WaveFill}" Stretch="Fill" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" Margin="0,0,-400,-20">
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="0,1">
<PolyBezierSegment Points="0.5,1 0.5,0 1,0"/>
<PolyBezierSegment Points="1.5,0 1.5,1 2,1"/>
<PolyBezierSegment Points="2.5,1 2.5,0 3,0"/>
<PolyLineSegment Points="3,0 3,10, 0,10 0,1"/>
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
<TextBlock Visibility="{Binding ShowText,RelativeSource={RelativeSource TemplatedParent},Converter={x:Static dxmvmm:BoolToVisibilityConverter.Instance}}"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
Text="{Binding Value,RelativeSource={RelativeSource Mode=TemplatedParent},StringFormat={}{0:f2}%}"/>
</Grid>

</Border>
</Viewbox>
</Border>

</StackPanel>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded" SourceName="PART_Wave">
<BeginStoryboard Name="BeginStoryboardWave" Storyboard="{StaticResource StoryboardOnLoaded}"/>
</EventTrigger>
<EventTrigger RoutedEvent="FrameworkElement.Unloaded" SourceName="PART_Wave">
<StopStoryboard BeginStoryboardName="BeginStoryboardWave"/>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>


<Style TargetType="{x:Type ctrl:SwitchButton}">
<Setter Property="Background" Value="#00F4D5"/>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:SwitchButton">
<Border CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=ActualHeight,Converter={StaticResource HalfNumber}}"
BorderThickness="1" Background="{StaticResource ControlBackground}" BorderBrush="{TemplateBinding BorderBrush}">
<Grid>
<Ellipse x:Name="ELLIPSE" HorizontalAlignment="Left" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5"
Fill="Gray" Stroke="{StaticResource ControlBorderBrush}" StrokeThickness="1">
<Ellipse.RenderTransform>
<TransformGroup>
<TranslateTransform x:Name="TranslateX" X="2"/>
</TransformGroup>
</Ellipse.RenderTransform>
</Ellipse>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>


<Style TargetType="{x:Type ctrl:KnobButton}">
<Setter Property="Background" Value="#0068F4"/>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:KnobButton">
<Grid x:Name="bdGrid" Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}">
<Grid Margin="16" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<RotateTransform x:Name="rotatevalue" Angle="00"/>
</Grid.RenderTransform>

<Ellipse Margin="4" Fill="#FFF6F6F6" Stroke="{StaticResource ControlBorderBrush}" >
<Ellipse.Effect>
<DropShadowEffect ShadowDepth="2" BlurRadius="8" Direction="-90" Color="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Background.(SolidColorBrush.Color)}"/>
</Ellipse.Effect>
</Ellipse>
<Ellipse Margin="12" Fill="{TemplateBinding Background}" Width="8" Height="8" VerticalAlignment="Bottom">
</Ellipse>
</Grid>
<TextBlock Text="{Binding Value,RelativeSource={RelativeSource Mode=TemplatedParent}, StringFormat={}{0:F2}}"
VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>-->
<!--#endregion-->

<!--#region 控制集合-->
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Foreground" Value="White" />


+ 6
- 1
SCADA.Test/SCADA.Test.csproj View File

@@ -17,12 +17,17 @@

<ItemGroup>
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.Compiler\BPASmartClient.Compiler.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" />
<ProjectReference Include="..\BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="BPASmartClient.Compiler">
<HintPath>..\BPASmartClient.SCADAControl\DLL\BPASmartClient.Compiler.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<Resource Include="bj.png" />
</ItemGroup>


+ 1
- 50
SmartClient.sln View File

@@ -148,12 +148,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2.消息名称管理", "2.
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3.组态控件集", "3.组态控件集", "{5300552F-560D-474A-8D96-0A2747D08F64}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Compiler", "BPASmartClient.Compiler\BPASmartClient.Compiler.csproj", "{B6213013-2A0E-41DD-BA9F-775D53C19374}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "4.界面测试加载实例", "4.界面测试加载实例", "{309D579E-DDA8-4B01-A0AA-0F381BC37801}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SCADA.Test", "SCADA.Test\SCADA.Test.csproj", "{1696D557-C908-4136-A5F2-FF59D69E642C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.VariableManager", "BPASmart.VariableManager\BPASmart.VariableManager.csproj", "{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DistributedHostComputer", "DistributedHostComputer", "{CDC1E762-5E1D-4AE1-9DF2-B85761539086}"
@@ -180,7 +174,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.RecipeManagement",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.SmallBatchingSystem", "BPASmart.SmallBatchingSystem\BPASmart.SmallBatchingSystem.csproj", "{DB6DC970-859C-4C63-AE9B-BA415D56CECD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmart.ConfigurationSoftware", "BPASmart.ConfigurationSoftware\BPASmart.ConfigurationSoftware.csproj", "{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.ConfigurationSoftware", "BPASmart.ConfigurationSoftware\BPASmart.ConfigurationSoftware.csproj", "{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1396,46 +1390,6 @@ Global
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|x64.Build.0 = Release|Any CPU
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|x86.ActiveCfg = Release|Any CPU
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|x86.Build.0 = Release|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|ARM.ActiveCfg = Debug|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|ARM.Build.0 = Debug|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|ARM64.Build.0 = Debug|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|x64.ActiveCfg = Debug|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|x64.Build.0 = Debug|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|x86.ActiveCfg = Debug|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|x86.Build.0 = Debug|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|Any CPU.Build.0 = Release|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|ARM.ActiveCfg = Release|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|ARM.Build.0 = Release|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|ARM64.ActiveCfg = Release|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|ARM64.Build.0 = Release|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|x64.ActiveCfg = Release|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|x64.Build.0 = Release|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|x86.ActiveCfg = Release|Any CPU
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|x86.Build.0 = Release|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Debug|ARM.Build.0 = Debug|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Debug|ARM64.Build.0 = Debug|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Debug|x64.ActiveCfg = Debug|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Debug|x64.Build.0 = Debug|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Debug|x86.ActiveCfg = Debug|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Debug|x86.Build.0 = Debug|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Release|Any CPU.Build.0 = Release|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Release|ARM.ActiveCfg = Release|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Release|ARM.Build.0 = Release|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Release|ARM64.ActiveCfg = Release|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Release|ARM64.Build.0 = Release|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Release|x64.ActiveCfg = Release|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Release|x64.Build.0 = Release|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Release|x86.ActiveCfg = Release|Any CPU
{1696D557-C908-4136-A5F2-FF59D69E642C}.Release|x86.Build.0 = Release|Any CPU
{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -1724,9 +1678,6 @@ Global
{7BED8969-7EA7-409C-8BBC-D2777ECDA2F1} = {7B0175AD-BB74-4A98-B9A7-1E289032485E}
{28BE5235-2399-4EBA-B1F0-88E0F32AC869} = {7B0175AD-BB74-4A98-B9A7-1E289032485E}
{5300552F-560D-474A-8D96-0A2747D08F64} = {7B0175AD-BB74-4A98-B9A7-1E289032485E}
{B6213013-2A0E-41DD-BA9F-775D53C19374} = {5300552F-560D-474A-8D96-0A2747D08F64}
{309D579E-DDA8-4B01-A0AA-0F381BC37801} = {7B0175AD-BB74-4A98-B9A7-1E289032485E}
{1696D557-C908-4136-A5F2-FF59D69E642C} = {309D579E-DDA8-4B01-A0AA-0F381BC37801}
{2C17B9A9-B27B-4F07-AFB0-0F56A975D501} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{00C5B45D-9799-43F1-B07B-9F638AA9FF72} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{5083C91F-B23E-445D-8B7F-AF87E636E847} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}


Loading…
Cancel
Save