You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
3.1 KiB
102 lines
3.1 KiB
using Module.Plc.ModbusTcp.Tool;
|
|
using Sunny.UI;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using MorClient;
|
|
using MorClient.UserControls;
|
|
|
|
namespace MorClient
|
|
{
|
|
|
|
public class PublicPara
|
|
{
|
|
/// <summary>
|
|
/// Modbus工具
|
|
/// </summary>
|
|
public static PlcModbusTool PlcTool = null;
|
|
public static string ip = "192.168.1.5";
|
|
public static int port = 502;
|
|
public static Common common = new Common();
|
|
public static string nowUser = "Ad";
|
|
|
|
|
|
/// <summary>
|
|
/// 随机生成4位数
|
|
/// </summary>
|
|
/// <param name="s"></param>
|
|
/// <param name="rm"></param>
|
|
/// <returns></returns>
|
|
public static string random(string s, Random rm)
|
|
{
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
int k = rm.Next();
|
|
|
|
char j = (char)('0' + (char)(k % 10));
|
|
|
|
s += j.ToString();
|
|
}
|
|
return s;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 一级功能按钮
|
|
/// </summary>
|
|
public static string fristFunctionButtons;
|
|
|
|
public void GetFristFunctionButtons(string str)
|
|
{
|
|
fristFunctionButtons = str;
|
|
common.GetNowFristPage(str);
|
|
}
|
|
/// <summary>
|
|
/// 二级功能按钮
|
|
/// </summary>
|
|
public static string twoFunctionButtons;
|
|
/// <summary>
|
|
/// 二级功能按钮
|
|
/// </summary>
|
|
/// <param name="str"></param>
|
|
public void GetTwoFunctionButtons(string str)
|
|
{
|
|
twoFunctionButtons = str;
|
|
common.GetNowTwoPage(str);
|
|
}
|
|
//客户端主框架
|
|
public static FrmMainFrame pubMainFrameObject;
|
|
public void GetMainFrameObject(FrmMainFrame instanceObject)
|
|
{
|
|
pubMainFrameObject = instanceObject;
|
|
}
|
|
//客户端主框架
|
|
public static UserControl_SecMenu userControl_SecMenu;
|
|
public void GetHomepageObject(UserControl_SecMenu userControl_SecMenuObject)
|
|
{
|
|
userControl_SecMenu = userControl_SecMenuObject;
|
|
}
|
|
/// <summary>
|
|
/// 设置左侧界面尺寸
|
|
/// </summary>
|
|
/// <param name="height"></param>
|
|
/// <returns></returns>
|
|
public static int LeftPageSet(out int height)
|
|
{
|
|
int width;
|
|
double Width = (double)Screen.PrimaryScreen.Bounds.Width / pubMainFrameObject.Width;
|
|
double Height = (double)Screen.PrimaryScreen.Bounds.Height / pubMainFrameObject.Height;
|
|
width = Convert.ToInt32(pubMainFrameObject.plMain.Width * Width + 15 * Width);
|
|
height = Convert.ToInt32(pubMainFrameObject.plMain.Height * Height - 20 * Height);
|
|
return width;
|
|
}
|
|
public static Dictionary<string, Tuple<string, int>> armAndaddress = new Dictionary<string, Tuple<string, int>>();
|
|
public static Dictionary<string, string> armAnCode = new Dictionary<string, string>();
|
|
|
|
}
|
|
}
|