private void UploadByteData(object sender, RoutedEventArgs e)
        {
            try {
                DateTime Timestamp = DateTime.Parse(timestamp.Text);
                int      dataLen   = 100;
                string[] chops     = uploadData.Text.Split(',');
                byte[]   data;
                if (chops.Length == 1 && chops[0].ToLower() == "delta")
                {
                    //**** TEST for Delta
                    data = new byte[300];
                    byte[] dataInit =
                    {
                        0,                 0,         0,         0,       255,       255,       255,       255, // Special header for Delta Weblog protocol
                        1,                 0,         0,         0,                                             // Device address == 1 (must match the physical device address)
                        1,                 0,                                                                   // Register address == 1 (non-zero)
                        1,                                                                                      // numregs = 1 (non-zero)
                        // Data:
                        (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'0', (byte)'0', (byte)'0', (byte)'0', (byte)'0', (byte)'0', (byte)'0',
                        1,                 2,         3,         4,         5,         6,         7,         8,         9,        10,        11,12, 13, 14, 15, 16, 17, 18, 19, 20
                    };
                    dataInit.CopyTo(data, 0);
                    //**** TEST
                }
                else
                {
                    int.TryParse(chops[0], out dataLen);
                    data = new byte[dataLen];
                    if (chops.Length > 1)
                    {
                        int adr;
                        if (int.TryParse(chops[1], out adr))
                        {
                            byte[] bytes = BitConverter.GetBytes(adr);
                            bytes.CopyTo(data, 0);
                        }
                    }
                }
                UploadResult result = api.UploadByteData(login.SessionID, hwID.Text, Timestamp, isLog.IsChecked == true, notResponding.IsChecked == true, data);
                if ((AEResultCodes)result.Code == AEResultCodes.OK)
                {
                    AddMessage(string.Format("*** Uploaded {0} rows", result.UploadCount));
                }
                else
                {
                    AddMessage(string.Format("*** UploadData returned {0}", result.ResultCodeString()));
                }

                Registry.CurrentUser.SetValue(RegGateway, gatewayID.Text);
                Registry.CurrentUser.SetValue(RegUploadData, uploadData.Text);
            } catch (Exception ex) {
                AddMessage(ex.ToString());
            }
        }