Exemplo n.º 1
0
 private void GetDeviceTimeInfo(object sender, RoutedEventArgs e)
 {
     if (SiteHardwareList.Items != null && SiteHardwareList.Items.Count > 0)
     {
         string hid = null;
         for (int i = 0; i < SiteHardwareList.Items.Count; i++)
         {
             TextBlock hwText = SiteHardwareList.Items[i] as TextBlock;
             if (hwText != null)
             {
                 hid = hwText.Text;
             }
             if (string.IsNullOrEmpty(hid))
             {
                 CheckBox hwCheck = SiteHardwareList.Items[i] as CheckBox;
                 if (hwCheck != null)
                 {
                     if (hwCheck.IsChecked == true)
                     {
                         HardwareComplete hc = hwCheck.Tag as HardwareComplete;
                         if (hc != null)
                         {
                             hid = hc.HardwareID.ToString();
                         }
                         else
                         {
                             hid = hwCheck.Content as string;
                         }
                     }
                 }
             }
         }
         if (string.IsNullOrEmpty(hid))
         {
             AddMessage("*** hardware not specified");
             return;
         }
         TimestampResult result = api.GetTimestamp(login.SessionID, hid);
         if ((AEResultCodes)result.Code == AEResultCodes.OK)
         {
             AddMessage("*** TimestampResult OK");
             AddMessage(string.Format("*** TimestampResult ({0}), ServerUTC : {1}", hid, result.ServerUTC.ToString()));
             AddMessage(string.Format("*** LastData: {0}", result.LastData.ToString()));
             AddMessage(string.Format("*** LastUpdate: {0}", result.LastUpdate.ToString()));
         }
         else
         {
             AddMessage(string.Format("*** TimestampResult ({0}) returned {1}", hid, result.ResultCodeString()));
         }
     }
 }