private void m_hSendBtn_Click(object sender, RoutedEventArgs e) { String szRequestUrl = UserDataDAO.m_szBaseUrl + "/NewLog"; String szSW = UserDataDAO.CreateSW(); HttpWebRequest hRequest = (HttpWebRequest)WebRequest.Create(szRequestUrl); hRequest.Method = "POST"; hRequest.ContentType = "application/json"; hRequest.Timeout = 10000; AwsLog_Transmit log = new AwsLog_Transmit(); log.mSW = UserDataDAO.CreateSW(); log.mFormat = "yyyy-MM-dd"; log.mFormatDate = DateTime.Now.ToString(log.mFormat); log.mTitle = m_hLogTitleBox.Text; log.mDetail = m_hLogDetailBox.Text; JsonSerializerSettings jsSettings = new JsonSerializerSettings(); jsSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; string json = JsonConvert.SerializeObject(log, jsSettings); Stream req = hRequest.GetRequestStream(); byte[] bytes = Encoding.UTF8.GetBytes(json); req.Write(bytes, 0, bytes.Length); hRequest.BeginGetResponse(new AsyncCallback(LogWriteResponse), hRequest); }
private void m_hLogViewer_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) { AwsLog_Transmit log = (AwsLog_Transmit)m_hLogViewer.SelectedItem; m_hDetailbox.Text = "详细:" + log.mDetail; }