示例#1
0
文件: Receiver.cs 项目: mszubart/UCLA
        static void Main(string[] args)
        {
            Console.Write("Hi there! You will be receiving a random numbers from remote input.\n");
            Console.Write("Use them to win the lottery!\n");
            Console.Write("Waiting for connection...\n");

            try {
                UReceiver receiver = new ULoader_JSON("config.json").GetReceiver("input1");
                receiver.DataReceived += new UReceiveHandler(OnDataReceived);

                receiver.Run();
            } catch (UException ex) {
                Console.Write(String.Format("Something went horribly wrong:\n\t{0}\n", ex.Message));
            }

            Console.ReadKey();
        }
示例#2
0
 static void Main(string[] args)
 {
     ULoader_JSON config = new ULoader_JSON("config.json");
     UReceiver uReceiver = config.GetReceiver("input1");
     while(true)
     {
         try
         {
             uReceiver.DataReceived += new UReceiveHandler(OnData);
             uReceiver.Receive();
         }
         catch (UException exc)
         {
             Console.Write(exc.Message);
         }
         Thread.Sleep(1000);
     }
 }
示例#3
0
文件: Sender.cs 项目: mszubart/UCLA
        static void Main(string[] args)
        {
            Console.Write("Me is client. Me is input. Me sending random number things.\n");
            Console.Write("Me waiting connection...\n");

            try {
                USender sender = new ULoader_JSON("config.json").GetSender("output1");

                for (int i = 0; i < 3; i++) {
                    sender.SendData(_8randomBytes());
                }

                Console.Write("Data sent successfully. Me exiting after you pressing return.\n");
            } catch (UException ex) {
                Console.Write(String.Format("Something went horribly wrong:\n\t{0}\n", ex.Message));
            }

            Console.ReadKey();
        }
示例#4
0
 public MainWindow()
 {
     InitializeComponent();
     foreach (string port in SerialPort.GetPortNames())
         portsComboBox.Items.Add(port);
     portsComboBox.SelectedIndex = 1;
     attentionValuesCollection = new DataCollection();
     var attentionDataSource = new EnumerableDataSource<Data>(attentionValuesCollection);
     attentionDataSource.SetXMapping(x => dateAttention.ConvertToDouble(x.Date));
     attentionDataSource.SetYMapping(y => y.Value);
     plotterAttention.AddLineGraph(attentionDataSource, Colors.Red, 2, "Attention");
     randomWordNumber = new Random();
     wordNumber = 0;
     attentionComingCounter = 0;
     attentionValueSum = 0;
     puzzlesSolved = 0;
     currentWord = "";
     config = new ULoader_JSON("config.json");
     uSender = config.GetSender("output1");
 }