194 lines
5.1 KiB
C#
194 lines
5.1 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Runtime.InteropServices;
|
|
using System.Windows.Forms;
|
|
using AGVSystem.Cls;
|
|
using Microsoft.Data.ConnectionUI;
|
|
|
|
namespace AGVSystem
|
|
{
|
|
// Token: 0x0200000F RID: 15
|
|
public partial class DatabaseSet : Form
|
|
{
|
|
// Token: 0x060000D3 RID: 211
|
|
[DllImport("user32.dll")]
|
|
private static extern int SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw);
|
|
|
|
// Token: 0x060000D4 RID: 212
|
|
[DllImport("gdi32.dll")]
|
|
private static extern IntPtr CreateRoundRectRgn(int x1, int y1, int x2, int y2, int cx, int cy);
|
|
|
|
// Token: 0x060000D5 RID: 213 RVA: 0x00016F6C File Offset: 0x0001516C
|
|
public DatabaseSet()
|
|
{
|
|
this.InitializeComponent();
|
|
this.tempconnectStr = Param.connectStr;
|
|
string[] array = Param.connectStr.Split(new char[]
|
|
{
|
|
';'
|
|
});
|
|
try
|
|
{
|
|
this.textBox1.Text = array[0].Split(new char[]
|
|
{
|
|
'='
|
|
})[1];
|
|
this.textBox2.Text = array[1].Split(new char[]
|
|
{
|
|
'='
|
|
})[1];
|
|
this.textBox5.Text = Param.Pro_id;
|
|
this.textBox3.Text = array[2].Split(new char[]
|
|
{
|
|
'='
|
|
})[1];
|
|
bool flag = this.textBox3.Text == "True";
|
|
if (flag)
|
|
{
|
|
this.textBox3.Text = "Windows身份验证";
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x060000D6 RID: 214 RVA: 0x00017068 File Offset: 0x00015268
|
|
private void savebtn_Click(object sender, EventArgs e)
|
|
{
|
|
bool flag = Param.UserName_temp == "" && mainfrm.newmainfrm != null;
|
|
if (flag)
|
|
{
|
|
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
}
|
|
else
|
|
{
|
|
bool flag2 = Param.connectStr == this.tempconnectStr || this.textBox5.Text.Trim() == "";
|
|
if (!flag2)
|
|
{
|
|
FileRW.WriteIniValue("conn", "conn", this.tempconnectStr, Application.StartupPath + "\\info.ini");
|
|
FileRW.WriteIniValue("item_id", "item_id", Param.Pro_id, Application.StartupPath + "\\info.ini");
|
|
bool flag3 = mainfrm.newmainfrm != null;
|
|
if (flag3)
|
|
{
|
|
MessageBox.Show("数据库连接配置已保存成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
base.Close();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("数据库连接配置已保存成功,请重启软件!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
Application.Exit();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060000D7 RID: 215 RVA: 0x00017178 File Offset: 0x00015378
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
DataConnectionDialog dataConnectionDialog = new DataConnectionDialog();
|
|
dataConnectionDialog.DataSources.Add(DataSource.SqlDataSource);
|
|
dataConnectionDialog.SelectedDataSource = DataSource.SqlDataSource;
|
|
dataConnectionDialog.SelectedDataProvider = DataProvider.SqlDataProvider;
|
|
bool flag = DataConnectionDialog.Show(dataConnectionDialog) == DialogResult.OK;
|
|
if (flag)
|
|
{
|
|
this.tempconnectStr = dataConnectionDialog.ConnectionString;
|
|
string[] array = this.tempconnectStr.Split(new char[]
|
|
{
|
|
';'
|
|
});
|
|
try
|
|
{
|
|
this.textBox1.Text = array[0].Split(new char[]
|
|
{
|
|
'='
|
|
})[1];
|
|
this.textBox2.Text = array[1].Split(new char[]
|
|
{
|
|
'='
|
|
})[1];
|
|
this.textBox5.Text = this.textBox2.Text.Split(new char[]
|
|
{
|
|
'_'
|
|
})[2];
|
|
this.tempconnectStr = this.tempconnectStr.Replace(this.textBox5.Text, "XXXXX");
|
|
Param.Pro_id = this.textBox5.Text;
|
|
this.textBox3.Text = array[2].Split(new char[]
|
|
{
|
|
'='
|
|
})[1];
|
|
bool flag2 = this.textBox3.Text == "True";
|
|
if (flag2)
|
|
{
|
|
this.textBox3.Text = "Windows身份验证";
|
|
}
|
|
this.textBox4.Text = array[3].Split(new char[]
|
|
{
|
|
'='
|
|
})[1];
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060000D8 RID: 216 RVA: 0x00008E3F File Offset: 0x0000703F
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
base.Close();
|
|
}
|
|
|
|
// Token: 0x060000D9 RID: 217 RVA: 0x00017318 File Offset: 0x00015518
|
|
private void panel3_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
bool flag = this.isMouseDown;
|
|
if (flag)
|
|
{
|
|
Point mousePosition = Control.MousePosition;
|
|
mousePosition.Offset(this.mouseOffset.X, this.mouseOffset.Y);
|
|
base.Location = mousePosition;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060000DA RID: 218 RVA: 0x00017360 File Offset: 0x00015560
|
|
private void panel3_MouseUp(object sender, MouseEventArgs e)
|
|
{
|
|
bool flag = e.Button == MouseButtons.Left;
|
|
if (flag)
|
|
{
|
|
this.isMouseDown = false;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060000DB RID: 219 RVA: 0x00017388 File Offset: 0x00015588
|
|
private void panel3_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
bool flag = e.Button == MouseButtons.Left;
|
|
if (flag)
|
|
{
|
|
int x = -e.X - 2 * SystemInformation.FrameBorderSize.Width;
|
|
int y = -e.Y - 99;
|
|
this.mouseOffset = new Point(x, y);
|
|
this.isMouseDown = true;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060000DC RID: 220 RVA: 0x00002460 File Offset: 0x00000660
|
|
protected override void OnResize(EventArgs e)
|
|
{
|
|
}
|
|
|
|
// Token: 0x04000170 RID: 368
|
|
private Point mouseOffset;
|
|
|
|
// Token: 0x04000171 RID: 369
|
|
private bool isMouseDown;
|
|
|
|
// Token: 0x04000172 RID: 370
|
|
private string tempconnectStr;
|
|
}
|
|
}
|