Exemplo n.º 1
0
        public void Init()
        {
            saveVarible saveVarible1 = new saveVarible();

            SAVE.ReadVar(this.Text, ref saveVarible1);
            //ipInput1.ipText = saveVarible1.ip;



            int chaoshi = 0;
            int max     = 4;

            while (!njCompolet1.IsConnected && chaoshi < max)
            {
                Thread.Sleep(1000);
                if (onLogEvent != null)
                {
                    onLogEvent(new OnLogEventArgs("LOG:PLC尝试连接" + chaoshi.ToString() + "次!"));
                }
                chaoshi++;
            }
            if (chaoshi == max)
            {
                if (onLogEvent != null)
                {
                    onLogEvent(new OnLogEventArgs("ERR:PLC连接超时!"));
                }
            }
            else
            {
                if (onLogEvent != null)
                {
                    onLogEvent(new OnLogEventArgs("LOG:PLC初始化成功!"));
                }

                OmroPLCvar后电子秤1监测实例.Start();   //开启值扫描实例循环扫描
                OmroPLCvar后电子秤2监测实例.Start();   //开启值扫描实例循环扫描
                OmroPLCvar前电子秤1监测实例.Start();   //开启值扫描实例循环扫描
                OmroPLCvar前电子秤2监测实例.Start();   //开启值扫描实例循环扫描

                //OmroPLCvarPLCMFG监测实例.Start();   //开启值扫描实例循环扫描

                OmroPLCvarPLC报警监测实例.Start();   //开启值扫描实例循环扫描

                //OmroPLCvarPLC心跳监测实例.Start();   //开启值扫描实例循环扫描

                OmroPLCvarPLC相机NG和设备启动监测实例.Start();

                OmroPLCvarPLC清数据监测实例.Start();

                if (设置界面.电芯扫码)
                {
                    OmroPLCvarPLC扫电芯码监测实例.Start();
                }
                if (设置界面.弹夹扫码)
                {
                    OmroPLCvarPLC扫弹夹码监测实例.Start();
                }
            }
        }
Exemplo n.º 2
0
        private void menuButton1_SelectedChanged(object sender, EventArgs e)
        {
            njCompolet1.PeerAddress = ipInput1.ipText;
            saveVarible saveVarible1 = new saveVarible();

            saveVarible1.ip = ipInput1.ipText;
            SAVE.SaveVar(this.Text, saveVarible1);
            menuButton1.Selected = false;
        }
Exemplo n.º 3
0
        public static void SaveVar(string FName, saveVarible saveVarible1)
        {
            IFormatter formatter = new BinaryFormatter();
            Stream     stream    = new FileStream(@"" + FName + ".bin", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);

            formatter.Serialize(stream, saveVarible1);
            stream.Close();
            stream.Dispose();
        }
Exemplo n.º 4
0
        public static void ReadVar(string FName, ref saveVarible saveVarible1)
        {
            if (!File.Exists(@"" + FName + ".bin"))
            {
                IFormatter formatter0 = new BinaryFormatter();
                Stream     stream0    = new FileStream(@"" + FName + ".bin", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
                formatter0.Serialize(stream0, saveVarible1);
                stream0.Close();
                stream0.Dispose();
            }
            IFormatter formatter = new BinaryFormatter();
            Stream     streamc   = new FileStream(@"" + FName + ".bin", FileMode.Open, FileAccess.Read, FileShare.Read);

            saveVarible1 = formatter.Deserialize(streamc) as saveVarible;
            streamc.Close();
            streamc.Dispose();
        }
Exemplo n.º 5
0
 public void Init()
 {
     try
     {
         saveVarible saveVarible1 = new saveVarible();
         SAVE.ReadVar(FName, ref saveVarible1);
         if (saveVarible1.comboBox1select > comboBox1.Items.Count - 1)
         {
             return;
         }
         try
         {
             comboBox1.SelectedIndex = saveVarible1.comboBox1select;
             comboBox2.SelectedIndex = saveVarible1.comboBox2select;
             comboBox3.SelectedIndex = saveVarible1.comboBox3select;
             comboBox4.SelectedIndex = saveVarible1.comboBox4select;
             comboBox5.SelectedIndex = saveVarible1.comboBox5select;
             SetSerialPort();
         }
         catch
         {
             this.Invoke(new Action(() =>
             {
                 comboBox1.SelectedIndex = saveVarible1.comboBox1select;
                 comboBox2.SelectedIndex = saveVarible1.comboBox2select;
                 comboBox3.SelectedIndex = saveVarible1.comboBox3select;
                 comboBox4.SelectedIndex = saveVarible1.comboBox4select;
                 comboBox5.SelectedIndex = saveVarible1.comboBox5select;
                 SetSerialPort();
             }));
         }
         TASKconnect();
     }
     catch (Exception exp)
     {
     }
 }