コード例 #1
0
        public void Button_Click(RVIClientContext context)
        {
            string          connString = "Server=192.168.2.111; Port=3306; Database=IEN; Uid=remoteUser; Pwd=12342580;";
            MySqlConnection connection = new MySqlConnection(connString);

            connection.Open();
            MySqlCommand    command = new MySqlCommand("SELECT * FROM test", connection);
            MySqlDataReader reader  = command.ExecuteReader();
            DataTable       table   = new DataTable();

            table.Load(reader);
            connection.Close();

            List <string> instructions = new List <string>()
            {
                RVIInstructions.DisableClickableRect("button"),         // Disable button
                RVIInstructions.DeleteFrame("button"),                  // Delete button frame
                RVIInstructions.Delay(20),                              // Delay server for 20ms
                RVIInstructions.SetFrame("resultFrame")                 // Set the frame for the result
            };

            int tableCountH = table.Columns.Count;
            int tableCountV = table.Rows.Count + 1;

            List <string> headers = new List <string>();
            List <string> cells   = new List <string>();


            foreach (DataColumn col in table.Columns)
            {
                headers.Add(col.ColumnName);
            }

            foreach (DataRow row in table.Rows)
            {
                foreach (object o in row.ItemArray)
                {
                    cells.Add(o.ToString());
                }
            }

            string finalString = "";

            foreach (string c in cells)
            {
                finalString += c + "·";
            }
            // Create scaled-borderless table with the headers, and a scaled only one with the cell contents
            instructions.Add(RVIInstructions.TableArraySB(new RVIVector2(0, 0.4f + 0.05f), 1f / tableCountH, 0.05f, (byte)tableCountH, (byte)tableCountV, 0.03f, headers.ToArray()));
            instructions.Add(RVIInstructions.TableArrayS(new RVIVector2(0, 0.4f), 1f / tableCountH, 0.02f, (byte)tableCountH, (byte)tableCountV, 0.01f, cells.ToArray()));
            instructions.Add(RVIInstructions.ReleaseFrame("resultFrame"));
            context.Run(instructions);
        }
コード例 #2
0
ファイル: RVIServer.cs プロジェクト: ien646/RVI
        public void ListenerThread()
        {
            Thread t = new Thread(() =>
            {
                while (true)
                {
                    TcpClient client         = _listener.AcceptTcpClient();
                    RVIClientContext context = new RVIClientContext(client, (IPEndPoint)client.Client.RemoteEndPoint, _debug, Log);
                    _contexts.Add(context);
                    context.Start();
                    Log("Client connected! IP::" + context.GetEndPoint().Address + " Port::" + context.GetEndPoint().Port);
                }
            });

            t.IsBackground = true;
            t.Start();
        }
コード例 #3
0
 public static void RunAction(string name, RVIClientContext context)
 {
     Actions[name].Invoke(context);
 }