Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SunVote
- {
- class Program
- {
- static bool flag = false;
- static BaseManage baseManage;
- static Vote vote;
- static void Main(string[] args)
- {
- BaseConnection baseConn = new SunVote.BaseConnection();
- baseConn.BaseOnLine += BaseConn_BaseOnLine;
- baseConn.BaseIP = "192.168.10.200";
- baseConn.Open(2, "1");
- baseManage = new SunVote.BaseManage();
- baseManage.BaseConnection = baseConn;
- baseManage.KeyIDHide += BaseManage_KeyIDHide;
- baseManage.KeyNotPowerOff += BaseManage_KeyNotPowerOff;
- baseManage.CheckCodeFirst += BaseManage_CheckCodeFirst;
- //keypadManage = new SunVote.KeypadManage();
- //keypadManage.BaseConnection = baseConn;
- HardwareTest hardwareTest = new SunVote.HardwareTest();
- hardwareTest.Mode = 0;
- hardwareTest.FirstCommitTime = 0;
- hardwareTest.IntervalCommitTime = 0;
- hardwareTest.StartMode = 1;
- hardwareTest.KeyMonitorStatus += HardwareTest_KeyMonitorStatus;
- hardwareTest.BaseConnection = baseConn;
- hardwareTest.Start();
- vote = new SunVote.Vote();
- vote.BaseConnection = baseConn;
- vote.Mode = 1;
- vote.ModifyMode = 0;
- vote.StartMode = 1;
- vote.TitleVoteMode=1;
- vote.KeyStatus += Vote_KeyStatus;
- Console.ReadLine();
- hardwareTest.Stop();
- Console.ReadLine();
- vote.Start();
- Console.ReadLine();
- vote.Stop();
- Console.ReadLine();
- }
- private static void Vote_KeyStatus(string BaseTag, int KeyID, string KeyValue)
- {
- string str = string.Format("BaseTag:{0}, KeyID:{1}, KeyValue:{2}", BaseTag, KeyID, KeyValue);
- Console.WriteLine(str);
- }
- private static void BaseManage_CheckCodeFirst(int BaseID, int CheckMode)
- {
- string str = string.Format("BaseTag:{0}, KeyID:{1}", BaseID, CheckMode);
- Console.WriteLine(str);
- }
- private static void BaseManage_KeyNotPowerOff(int BaseID, int NotPowerOff)
- {
- string str = string.Format("BaseTag:{0}, KeyID:{1}", BaseID, NotPowerOff);
- Console.WriteLine(str);
- }
- private static void BaseManage_KeyIDHide(int BaseID, int KeyIDHide)
- {
- string str = string.Format("BaseTag:{0}, KeyID:{1}", BaseID, KeyIDHide);
- Console.WriteLine(str);
- }
- private static void HardwareTest_KeyMonitorStatus(string BaseTag, int KeyID, int InputStatus, int ChargeStatus, double BatteryVoltage, int RfIntensity)
- {
- string str = string.Format("BaseTag:{0}, KeyID:{1}, InputStatus:{2}, ChargeStatus:{3}, BatteryVoltage:{4}, RfIntensity: {5}", BaseTag, KeyID, InputStatus, ChargeStatus, BatteryVoltage, RfIntensity);
- Console.WriteLine(str);
- }
- private static void HardwareMonitor_KeyStatus(string BaseTag, int KeyID, int InputStatus, int ChargeStatus, double BatteryVoltage, int RfIntensity)
- {
- string str = string.Format("BaseTag:{0}, KeyID:{1}, InputStatus:{2}, ChargeStatus:{3}, BatteryVoltage:{4}, RfIntensity: {5}", BaseTag, KeyID, InputStatus, ChargeStatus, BatteryVoltage, RfIntensity);
- Console.WriteLine(str);
- }
- private static void BaseConn_BaseOnLine(int BaseID, int BaseState)
- {
- if (BaseState == 1 &&!flag)
- {
- flag = true;
- Console.WriteLine("ONLINE " + BaseID + " - " + BaseState);
- baseManage.SetKeyVibration(0, 1);
- // baseManage.SetCheckCodeFirst(0, 2);
- //baseManage.GetKeyIDHide(0);
- // baseManage.SetKeyNotPowerOff(0, 1);
- // baseManage.GetKeyNotPowerOff(0);
- //keypadManage.ShowKeyInfo(0, 1);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement