本文整理汇总了C#中HttpMethod.Deserialize方法的典型用法代码示例。如果您正苦于以下问题:C# HttpMethod.Deserialize方法的具体用法?C# HttpMethod.Deserialize怎么用?C# HttpMethod.Deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpMethod
的用法示例。
在下文中一共展示了HttpMethod.Deserialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compare
public FaceCompare Compare(string photo)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param.Add("name", ConfigProfile.Current.Name);
param.Add("timeout", ConfigProfile.Current.Timeout.ToString());
var url = string.Concat("http://" + ConfigProfile.Current.KoalaIp + ":8080", "/video_verify");
var data = photo.FileToByte();
Stopwatch sw = Stopwatch.StartNew();
var responsestr = new HttpMethod().Post(url, data, param);
sw.Stop();
LogHelper.Info("比对->" + sw.ElapsedMilliseconds);
FaceCompare face = responsestr.Deserialize<FaceCompare>();
return face;
}
示例2: Login
private void Login()
{
var url = string.Format(url_login, koalaIp);
Dictionary<string, string> dicts = new Dictionary<string, string>();
dicts.Add("username", username);
dicts.Add("password", password);
dicts.Add("pad_id", pad_id);
dicts.Add("device_type", device_type);
var responsestr = new HttpMethod().Post(url, dicts);
var json = responsestr.Deserialize<PadLoginJson>();
screen_token = json.data.screen_token;
}
示例3: btnSnap_click
private void btnSnap_click(object sender, RoutedEventArgs e)
{
var filepath = System.IO.Path.Combine(FileManager.GetFolder(), DateTime.Now.ToString("HHmmss") + ".jpg");
filepath = camera.Snap();
CompareResultWindow window = null;
//window = new CompareResultWindow(filepath, filepath.ToImageSource(), "张三", result_ok, true);
//var p = host.TransformToAncestor(this).Transform(new Point(0, 0));
//p = this.PointToScreen(p);
//window.Left = p.X;
//window.Top = p.Y;
//window.ShowDialog();
//return;
//if (!player.HaveUsbCamera)
//{
// return;
//}
//player.Snap(filepath);
var imageBytes = filepath.FileToByte();
//CompareResultVisibility = Visibility.Visible;
//imgsnap.Source = filepath.ToImageSource();
#region 测试代码
//lblResult.Content = "相同";
//lblResult.Foreground = Brushes.Green;
//imgAvatar.Source = filepath.ToImageSource();
//imgResult.Source = new BitmapImage(new Uri(okImageSource, UriKind.Relative));
//StartAnimation();
//return;
#endregion
Dictionary<string, string> parms = new Dictionary<string, string>();
parms.Add("screen_token", screen_token);
Stopwatch sw = Stopwatch.StartNew();
var compare = new HttpMethod().Post(url, imageBytes, parms);
sw.Stop();
LogHelper.Info("比对耗时->" + sw.ElapsedMilliseconds);
if (!compare.IsEmpty())
{
var entity = compare.Deserialize<CompareJson>();
if (entity.error == 7)
{
//陌生人
LogHelper.Info("陌生人->" + filepath);
window = new CompareResultWindow(filepath, null, "陌生人", result_error, false);
var p = host.TransformToAncestor(this).Transform(new Point(0, 0));
p = this.PointToScreen(p);
window.Left = p.X;
window.Top = p.Y;
window.ShowDialog();
return;
}
var tag = entity.person.tag.Deserialize<Tag>();
if (entity.person.confidence > ok)
{
//比对通过
var avatar = tag.avatar;
var avatarImageSource = Utility.DownloadData(avatar).ToImageSource();
//imgAvatar.Source = avatarImageSource;
//imgResult.Source = new BitmapImage(new Uri(okImageSource, UriKind.Relative));
//lblResult.Content = "相同";
//lblResult.Foreground = Brushes.Green;
//StartAnimation();
LogHelper.Info("职员->" + tag.name + " " + filepath);
window = new CompareResultWindow(filepath, avatarImageSource, tag.name, result_ok, true);
var p = host.TransformToAncestor(this).Transform(new Point(0, 0));
p = this.PointToScreen(p);
window.Left = p.X;
window.Top = p.Y;
window.ShowDialog();
}
else
{
//imgAvatar.Source = avatarImageSource;
//lblResult.Content = "不同";
//lblResult.Foreground = Brushes.Red;
//imgResult.Source = new BitmapImage(new Uri(errorImageSource, UriKind.Relative));
//StartAnimation();
}
}
else
{
//window = new CompareResultWindow(filepath, null, 0.0d, null);
//window.ShowDialog();
}
}