init: 导入项目到 meswork Gitea
This commit is contained in:
176
DataMirrorTools_Simulator/ModelBasic/Base/MM.cs
Normal file
176
DataMirrorTools_Simulator/ModelBasic/Base/MM.cs
Normal file
@@ -0,0 +1,176 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
//using static SqlManage.ExecSql;
|
||||
using System.IO;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
truncate table [DeviceSignalSimTree]
|
||||
truncate table [DeviceTree]
|
||||
truncate table [ModelProcess]
|
||||
truncate table [OperationTree]
|
||||
truncate table [ProcesslLabelList]
|
||||
truncate table [ProjectList]
|
||||
truncate table [SignalViewer]
|
||||
truncate table [TagTriggerHandler]
|
||||
truncate table [Z_Save_Position]
|
||||
truncate table [Z_Save_Tag]
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
namespace DTTest
|
||||
{
|
||||
public partial class E { }
|
||||
public partial class ModelManagement
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ModelManagement()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用数据库链接创建项目
|
||||
/// 所有
|
||||
/// </summary>
|
||||
/// <param name="connectionString"></param>
|
||||
public ModelManagement(string connectionString,string projectCode)
|
||||
{
|
||||
LoadModel(connectionString);
|
||||
ReLoadPara(projectCode);
|
||||
while (!PP.ReLoadPara_IsCompleted)
|
||||
{
|
||||
System.Threading.Thread.Sleep(300);
|
||||
}
|
||||
}
|
||||
|
||||
#region 加载模型
|
||||
|
||||
/// <summary>
|
||||
/// 装载模型
|
||||
/// </summary>
|
||||
/// <param name="ipPortOpName_1"></param>
|
||||
/// <param name="prefix"></param>
|
||||
/// <param name="objectHeader"></param>
|
||||
/// <param name="sendInterval"></param>
|
||||
public void LoadModel(string connectionStringCurr)
|
||||
{
|
||||
//if (!DataLinkMesWork.KeyWordTest.KeyWordNew(out string sn1))
|
||||
//{
|
||||
// new DataLinkMesWork.Reg().ShowDialog();
|
||||
// if (!DataLinkMesWork.KeyWordTest.KeyWordNew(out string sn2))
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (connectionStringCurr.ToLower() == "file")
|
||||
connectionStringCurr = "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=" + PP.currExecPath + "\\ModelData.mdf;Integrated Security=True;Connect Timeout=30";
|
||||
|
||||
PP.ConnectionStr = connectionStringCurr;
|
||||
|
||||
if (!SqlOperation.Project.SelectConnect(PP.ConnectionStr))
|
||||
{
|
||||
string[] txt = PP.ConnectionStr.Split(';');
|
||||
string server = txt[0].Split('=')[1];
|
||||
string database = txt[1].Split('=')[1];
|
||||
string uid = txt[2].Split('=')[1];
|
||||
string pwd = txt[3].Split('=')[1];
|
||||
|
||||
MessageBox.Show("【未找到数据源,请检查链接】\r\n\r\n" +"当前链接是:"+ server + "\\"+ database + "\r\n\r\n" +"用户名:" + uid + "\r\n\r\n" +"密码:" + pwd + "\r\n\r\n位置:DataMirrorTools.exe.config");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void ReLoadPara(string projectCode)
|
||||
{
|
||||
SqlOperation.SqlProject.Refresh_Project_Para(projectCode);
|
||||
|
||||
try
|
||||
{
|
||||
var tipsBuilder = new System.Text.StringBuilder();
|
||||
if (!PP.PCP.ConnMode)
|
||||
tipsBuilder.AppendLine("【提示】没有使用通讯服务!").AppendLine();
|
||||
if (PP.PCP.IsRecordData)
|
||||
tipsBuilder.AppendLine("【警告】程序将记录数据到数据库!").AppendLine();
|
||||
if (!PP.PCP.IsAllowVisible)
|
||||
tipsBuilder.AppendLine("【警告】发布后的程序将不会控制模型显示和隐藏!").AppendLine();
|
||||
if (!PP.PCP.IsStartChrome)
|
||||
tipsBuilder.AppendLine("【警告】程序启动将不启动浏览界面!").AppendLine();
|
||||
if (tipsBuilder.Length > 0)
|
||||
MessageBox.Show(tipsBuilder.ToString());
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
LogNet.LogisTrac.WriteLog(typeof(ModelManagement), err);
|
||||
|
||||
Console.WriteLine(err);
|
||||
MessageBox.Show("程序启动配置判断有误!");
|
||||
}
|
||||
|
||||
// UsedCefOrSocket(PP.PCP.ConnMode);
|
||||
// SelectTagID_Handler();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检测行为是否存在
|
||||
/// </summary>
|
||||
/// <param name="actCode"></param>
|
||||
/// <returns></returns>
|
||||
public ActControl ActObjectExist(string actCode)
|
||||
{
|
||||
ActControl actControl = null;
|
||||
try
|
||||
{
|
||||
if (dc_ActCode_Object.ContainsKey(actCode))
|
||||
{
|
||||
actControl = dc_ActCode_Object[actCode];
|
||||
}
|
||||
else
|
||||
{
|
||||
actControl = new ActControl();
|
||||
actControl.CurrRunInfoEvent += new Action<int, int, C_Frames>(ModelControl_CurrRunInfoEvent);
|
||||
actControl.CurrRunInfoEvent += new Action<int, int, C_Frames>(CurrRunInfoSend);
|
||||
actControl.PlayTaskEnd += new Action(ModelControl_PlayTaskEnd);
|
||||
dc_ActCode_Object.Add(actCode, actControl);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
LogNet.LogisTrac.WriteLog(typeof(ModelManagement), err);
|
||||
|
||||
Console.WriteLine(err);
|
||||
}
|
||||
|
||||
return actControl;
|
||||
}
|
||||
|
||||
|
||||
protected internal void CurrRunInfoSend(int arg1, int arg2, C_Frames arg3)
|
||||
{
|
||||
// SendPlayFrameData(arg3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user