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.

281 lines
10 KiB

using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MorClient;
using RS.Module.Common;
namespace MorClient.UserControls
{
public partial class UnitMainFrm : UserControl
{
UnitHandact unitHandact_SCR = PubStaticClass.unitHandact;//new UnitHandact();
static UnitUAFrom unitHandact_CA = new UnitUAFrom();
public UnitMainFrm()
{
InitializeComponent();
}
static UnitMainFrm unitMainFrm;
/// <summary>
/// 传入数据界面
/// </summary>
/// <param name="unitMainFrmObject"></param>
public void GetUnitMainFrm(UnitMainFrm unitMainFrmObject)
{
unitMainFrm = unitMainFrmObject;
}
public void SetUnitMainFrmPanel()
{
unitMainFrm.panel1.Enabled = true;
}
/// <summary>
/// 设置按钮颜色
/// </summary>
public void SetUnitMainFrm()
{
//124, 156, 214 点击之后 199, 213, 237
unitMainFrm.uiButton1.FillColor = Color.FromArgb(199, 213, 237);
unitMainFrm.uiButton2.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton3.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton4.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton5.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.panel1.Controls.Clear();
unitHandact_SCR.Dock = DockStyle.Fill;
unitHandact_SCR.setValue();
unitMainFrm.panel1.Controls.Add(unitHandact_SCR);
unitMainFrm.panel1.Show();
}
public static int state = 1;
public void SetHightLigth(int state)
{
switch (state)
{
case 1:
unitMainFrm.uiButton1.FillColor = Color.FromArgb(199, 213, 237);
unitMainFrm.uiButton2.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton3.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton4.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton5.FillColor = Color.FromArgb(124, 156, 214);
break;
case 2:
unitMainFrm.uiButton2.FillColor = Color.FromArgb(199, 213, 237);
unitMainFrm.uiButton1.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton3.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton4.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton5.FillColor = Color.FromArgb(124, 156, 214);
break;
case 3:
unitMainFrm.uiButton3.FillColor = Color.FromArgb(199, 213, 237);
unitMainFrm.uiButton2.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton1.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton4.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton5.FillColor = Color.FromArgb(124, 156, 214);
break;
case 4:
unitMainFrm.uiButton4.FillColor = Color.FromArgb(199, 213, 237);
unitMainFrm.uiButton2.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton3.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton1.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton5.FillColor = Color.FromArgb(124, 156, 214);
break;
case 5:
unitMainFrm.uiButton5.FillColor = Color.FromArgb(199, 213, 237);
unitMainFrm.uiButton2.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton3.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton4.FillColor = Color.FromArgb(124, 156, 214);
unitMainFrm.uiButton1.FillColor = Color.FromArgb(124, 156, 214);
break;
}
}
#region 单元SCR1~4
/// <summary>
/// SCR1鼠标点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnLoad(object sender, EventArgs e)
{
PublicPara.common.GetUnitPageState(1);
if (state != 1)
{
unitHandact_SCR.SetState(1);
unitMainFrm.panel1.Controls.Clear();
unitHandact_SCR.Dock = DockStyle.Fill;
unitHandact_SCR.UnitHandact_Load(sender, e);
unitMainFrm.panel1.Controls.Add(unitHandact_SCR);
unitMainFrm.panel1.Show();
state = 1;
SetHightLigth(1);
}
}
/// <summary>
/// SCR1鼠标点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void uiButton1_Click(object sender, EventArgs e)
{
PublicPara.common.GetUnitPageState(1);
unitHandact_SCR.GetUnitHandact(unitHandact_SCR);
if (state != 1)
{
unitHandact_SCR.SetState(1);
unitHandact_SCR.Dock = DockStyle.Fill;
unitHandact_SCR.UnitHandact_Load(sender, e);
if (!unitMainFrm.panel1.Controls.Contains(unitHandact_SCR))
{
unitMainFrm.panel1.Controls.Clear();
unitMainFrm.panel1.Controls.Add(unitHandact_SCR);
unitMainFrm.panel1.Show();
}
state = 1;
SetHightLigth(1);
}
else
{
unitHandact_SCR.SetState(1);
unitHandact_SCR.Dock = DockStyle.Fill;
unitHandact_SCR.UnitHandact_Load(sender, e);
if (!unitMainFrm.panel1.Controls.Contains(unitHandact_SCR))
{
unitMainFrm.panel1.Controls.Clear();
unitMainFrm.panel1.Controls.Add(unitHandact_SCR);
unitMainFrm.panel1.Show();
}
state = 1;
SetHightLigth(1);
}
}
/// <summary>
/// SCR2
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void uiButton2_Click(object sender, EventArgs e)
{
PublicPara.common.GetUnitPageState(2);
unitHandact_SCR.GetUnitHandact(unitHandact_SCR);
if (state != 2)
{
unitHandact_SCR.SetState(2);
unitHandact_SCR.Dock = DockStyle.Fill;
unitHandact_SCR.UnitHandact_Load(sender, e);
if (!unitMainFrm.panel1.Controls.Contains(unitHandact_SCR))
{
unitMainFrm.panel1.Controls.Clear();
unitMainFrm.panel1.Controls.Add(unitHandact_SCR);
unitMainFrm.panel1.Show();
}
//unitMainFrm.panel1.Controls.Add(unitHandact_SCR);
//unitMainFrm.panel1.Show();
state = 2;
SetHightLigth(2);
}
}
/// <summary>
/// SCR3
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void uiButton3_Click(object sender, EventArgs e)
{
PublicPara.common.GetUnitPageState(3);
unitHandact_SCR.GetUnitHandact(unitHandact_SCR);
if (state != 3)
{
unitHandact_SCR.SetState(3);
unitHandact_SCR.Dock = DockStyle.Fill;
unitHandact_SCR.UnitHandact_Load(sender, e);
if (!unitMainFrm.panel1.Controls.Contains(unitHandact_SCR))
{
unitMainFrm.panel1.Controls.Clear();
unitMainFrm.panel1.Controls.Add(unitHandact_SCR);
unitMainFrm.panel1.Show();
}
//unitMainFrm.panel1.Controls.Add(unitHandact_SCR);
//unitMainFrm.panel1.Show();
state = 3;
SetHightLigth(3);
}
}
/// <summary>
/// SCR4
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void uiButton4_Click(object sender, EventArgs e)
{
PublicPara.common.GetUnitPageState(4);
unitHandact_SCR.GetUnitHandact(unitHandact_SCR);
if (state != 4)
{
unitHandact_SCR.SetState(4);
unitHandact_SCR.Dock = DockStyle.Fill;
unitHandact_SCR.UnitHandact_Load(sender, e);
if (!unitMainFrm.panel1.Controls.Contains(unitHandact_SCR))
{
unitMainFrm.panel1.Controls.Clear();
unitMainFrm.panel1.Controls.Add(unitHandact_SCR);
unitMainFrm.panel1.Show();
}
//unitMainFrm.panel1.Controls.Add(unitHandact_SCR);
//unitMainFrm.panel1.Show();
state = 4;
SetHightLigth(4);
}
}
#endregion 单元SCR1~4
/// <summary>
/// SCR-CA
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void uiButton5_Click(object sender, EventArgs e)
{
//PublicPara.common.GetUnitPageState(5);
if (state != 5)
{
unitMainFrm.panel1.Controls.Clear();
unitHandact_CA.Dock = DockStyle.Fill;
unitHandact_CA.GetUnitUAFrom(unitHandact_CA);
unitMainFrm.panel1.Controls.Add(unitHandact_CA);
unitMainFrm.panel1.Show();
state = 5;
SetHightLigth(5);
}
//if (PublicParams.currUserInfo.userGroup == "Operator")
//{
// unitMainFrm.panel1.Enabled = false;
//}
}
private void UnitMainFrm_Load(object sender, EventArgs e)
{
btnLoad(sender, e);
}
}
}