FrmMenu.cs 2.8 KB
using System; 
using System.Windows.Forms;   
using URSoldering.Common;
using URSoldering.DeviceLibrary;

namespace URSoldering.Client
{
    public partial class FrmMenu : FrmBase
    {
        /// <summary>
        /// 是否已经按了按钮,没有按时才会自动进入机器人焊接界面
        /// </summary>
        private bool isClick = false;
        public FrmMenu()
        {
            CheckForIllegalCrossThreadCalls = false;
            InitializeComponent(); 
            this.MaximizeBox = false;
            this.MinimizeBox = false; 
        }
        private System.Timers.Timer timer = new System.Timers.Timer();
        private void FrmMenu_Load(object sender, EventArgs e)
        {
            //加载板卡
            WorkCountManager.LoadData(); 
            BoardManager.LoadBoard(); 
            RobotManager.InitRobotConfig();
            RobotBean.ConnectionIO();
            this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);

        }

        private void btnWelding_Click(object sender, EventArgs e)
        {
            if (BoardManager.CurrBoard == null)
            {
                if (BoardManager.boardList.Count > 0)
                {
                    BoardManager.UpdateCurrBoard(BoardManager.boardList[0].boardId);
                }
                else
                {
                    MessageBox.Show("请先配置程序");
                    return;
                }
            }
            isClick = true;
            FrmWork fw = new FrmWork();
            this.Visible = false; ;
            fw.ShowDialog();
            this.Visible = true;
        }
      
        private void btnProduct_Click(object sender, EventArgs e)
        {
            isClick = true;
            FrmBoardList board = new FrmBoardList();
            this.Visible = false; ;
            board.ShowDialog();
            this.Visible = true;
        }
       
        private void btnDebug_Click(object sender, EventArgs e)
        {
            isClick = true;
            //FrmDebugMenu main = new FrmDebugMenu();
            FrmOrgConfig frmOrgConfig = new FrmOrgConfig();
            this.Visible = false;
            frmOrgConfig.ShowDialog();
            this.Visible = true;
        }
     
        private void FrmMenu_FormClosing(object sender, FormClosingEventArgs e)
        {
            isClick = true; 
         
            URRobotControl.StopRobot();
            KNDManager.CloseAllDO();
            KNDManager.CloseAllConnection();
            SolderingManager.Release();
            SendWireManager.Release();
            Application.Exit();
        }  
        private void FrmMenu_SizeChanged(object sender, EventArgs e)
        {
            return;
        }
         

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
          
    }
}