Advertisement
iceriver102

SUNVOTE

Jan 24th, 2018
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.20 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace SunVote
  8. {
  9.     class Program
  10.     {
  11.         static bool flag = false;
  12.         static BaseManage baseManage;
  13.         static Vote vote;
  14.         static void Main(string[] args)
  15.         {
  16.  
  17.  
  18.             BaseConnection baseConn = new SunVote.BaseConnection();
  19.             baseConn.BaseOnLine += BaseConn_BaseOnLine;
  20.             baseConn.BaseIP = "192.168.10.200";
  21.            
  22.             baseConn.Open(2, "1");
  23.  
  24.  
  25.  
  26.             baseManage = new SunVote.BaseManage();
  27.             baseManage.BaseConnection = baseConn;
  28.             baseManage.KeyIDHide += BaseManage_KeyIDHide;
  29.             baseManage.KeyNotPowerOff += BaseManage_KeyNotPowerOff;
  30.             baseManage.CheckCodeFirst += BaseManage_CheckCodeFirst;
  31.             //keypadManage = new SunVote.KeypadManage();
  32.             //keypadManage.BaseConnection = baseConn;
  33.  
  34.  
  35.             HardwareTest hardwareTest = new SunVote.HardwareTest();
  36.             hardwareTest.Mode = 0;
  37.             hardwareTest.FirstCommitTime = 0;
  38.             hardwareTest.IntervalCommitTime = 0;
  39.             hardwareTest.StartMode = 1;
  40.             hardwareTest.KeyMonitorStatus += HardwareTest_KeyMonitorStatus;
  41.             hardwareTest.BaseConnection = baseConn;
  42.             hardwareTest.Start();
  43.  
  44.             vote = new SunVote.Vote();
  45.             vote.BaseConnection = baseConn;
  46.             vote.Mode = 1;
  47.             vote.ModifyMode = 0;
  48.             vote.StartMode = 1;
  49.             vote.TitleVoteMode=1;
  50.             vote.KeyStatus += Vote_KeyStatus;
  51.  
  52.             Console.ReadLine();
  53.             hardwareTest.Stop();
  54.             Console.ReadLine();
  55.             vote.Start();
  56.             Console.ReadLine();
  57.             vote.Stop();
  58.             Console.ReadLine();
  59.  
  60.         }
  61.  
  62.         private static void Vote_KeyStatus(string BaseTag, int KeyID, string KeyValue)
  63.         {
  64.             string str = string.Format("BaseTag:{0}, KeyID:{1}, KeyValue:{2}", BaseTag, KeyID, KeyValue);
  65.             Console.WriteLine(str);
  66.         }
  67.  
  68.         private static void BaseManage_CheckCodeFirst(int BaseID, int CheckMode)
  69.         {
  70.             string str = string.Format("BaseTag:{0}, KeyID:{1}", BaseID, CheckMode);
  71.             Console.WriteLine(str);
  72.         }
  73.  
  74.         private static void BaseManage_KeyNotPowerOff(int BaseID, int NotPowerOff)
  75.         {
  76.             string str = string.Format("BaseTag:{0}, KeyID:{1}", BaseID, NotPowerOff);
  77.             Console.WriteLine(str);
  78.         }
  79.  
  80.         private static void BaseManage_KeyIDHide(int BaseID, int KeyIDHide)
  81.         {
  82.             string str = string.Format("BaseTag:{0}, KeyID:{1}", BaseID, KeyIDHide);
  83.             Console.WriteLine(str);
  84.         }
  85.  
  86.         private static void HardwareTest_KeyMonitorStatus(string BaseTag, int KeyID, int InputStatus, int ChargeStatus, double BatteryVoltage, int RfIntensity)
  87.         {
  88.             string str = string.Format("BaseTag:{0}, KeyID:{1}, InputStatus:{2}, ChargeStatus:{3}, BatteryVoltage:{4}, RfIntensity: {5}", BaseTag, KeyID, InputStatus, ChargeStatus, BatteryVoltage, RfIntensity);
  89.             Console.WriteLine(str);
  90.         }
  91.  
  92.         private static void HardwareMonitor_KeyStatus(string BaseTag, int KeyID, int InputStatus, int ChargeStatus, double BatteryVoltage, int RfIntensity)
  93.         {
  94.             string str = string.Format("BaseTag:{0}, KeyID:{1}, InputStatus:{2}, ChargeStatus:{3}, BatteryVoltage:{4}, RfIntensity: {5}", BaseTag, KeyID, InputStatus, ChargeStatus, BatteryVoltage, RfIntensity);
  95.             Console.WriteLine(str);
  96.         }
  97.  
  98.         private static void BaseConn_BaseOnLine(int BaseID, int BaseState)
  99.         {
  100.            
  101.             if (BaseState == 1 &&!flag)
  102.             {
  103.                 flag = true;
  104.                 Console.WriteLine("ONLINE " + BaseID + " - " + BaseState);
  105.                 baseManage.SetKeyVibration(0, 1);
  106.                // baseManage.SetCheckCodeFirst(0, 2);
  107.                //baseManage.GetKeyIDHide(0);
  108.                // baseManage.SetKeyNotPowerOff(0, 1);
  109.                // baseManage.GetKeyNotPowerOff(0);
  110.                //keypadManage.ShowKeyInfo(0, 1);
  111.             }
  112.         }
  113.     }
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement