using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using SystemFramework;

namespace MisDataName
{
    public partial class MisData
    {
        void OpenSecondForm_Thread()
        {
            try
            {
                ToolStripMenuItem_VWSStatus.Checked = true;
                
                Thread t = new Thread(new ParameterizedThreadStart(OpenSecondForm));
                t.Start(this);
                SecondForm.MainMenuRefresh = new MisDataName.SecondAct(RefreshToolStripMenuItem_Checked_ByName);
            }
            catch (Exception err)
            {
                ApplicationLog.WriteLog(err, err.Message );
            }
        }

        Form Sencondform;
        void OpenSecondForm( object ThisForm)
        {
            try
            { 
                SecondForm f1 = new SecondForm( ThisForm);
                Sencondform = f1;
                f1.ShowDialog();
             }
            catch (Exception err)
            {
                ApplicationLog.WriteLog(err, err.Message );
            }
        }

        void RefreshToolStripMenuItem_Checked_ByName(string ControlName)
        {
            try
            {
                ToolStripItem[] tsItems = menuStrip_Main.Items.Find(ControlName, true);
                ToolStripMenuItem tsmItem = (ToolStripMenuItem)tsItems[0];
                if (PlcChange == null)
                {
                    tsmItem.Checked = false;
                }
                else
                {
                    tsmItem.Checked = true;
                }
            }
            catch (Exception err)
            {
                ApplicationLog.WriteLog(err, err.Message );
            }
}
        
        object QueryFormPosition(object obj)
        {
            try
            {
                return new Point(this.Left + this.Width, this.Top);
            }
            catch (Exception err)
            {
                ApplicationLog.WriteLog(err, err.Message);
                return null;
                
            }

        }
        
       
    }
}
