Exemple #1
0
        public void setPacket()
        {
            IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(message));

            Marshal.Copy(dataBytes, 0, ptr, Marshal.SizeOf(message));
            message = (structMsgUdpT01)Marshal.PtrToStructure(ptr, message.GetType());
            Marshal.FreeHGlobal(ptr);
        }
Exemple #2
0
 public void update(ListView lv, structMsgUdpT01 data)
 {
     foreach (var prop in data.GetType().GetProperties())
     {
         ListViewItem lvi = lv.FindItemWithText(prop.Name);
         if (lvi != null)
         {
             lvi.SubItems[1].Text = string.Format("{0,8:0.00}", Convert.ToDouble(prop.GetValue(data, null).ToString()));
         }
     }
 }
Exemple #3
0
        public void init(ListView lv, structMsgUdpT01 data)
        {
            lv.DoubleBuffered(true);

            foreach (var prop in data.GetType().GetProperties())
            {
                ListViewItem lvi = new ListViewItem(prop.Name);
                lvi.SubItems.Add(prop.GetValue(data, null).ToString());
                lv.Items.Add(lvi);
            }
        }