我如何使用Async/Await模式转换我传统的HttpWebRequest"POST"调用,这里有我附加我当前的代码,任何人请帮我转换这个代码使用Async/Await模式为Windows Phone 8.
public void GetEnvironmentVariables(Action<Credentials> getResultCallback, Action<Exception> getErrorCallback)
{
CredentialsCallback = getResultCallback;
ErrorCallback = getErrorCallback;
var uri = new Uri(BaseUri);
var request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "POST";
request.ContentType = "application/json";
var jsonObject = new JObject
{
new JProperty("apiKey",_api),
new JProperty("affiliateId",_affid),
};
var serializedResult = JsonConvert.SerializeObject(jsonObject);
byte[] requestBody = Encoding.UTF8.GetBytes(serializedResult);
request.BeginGetRequestStream(GetRequestStreamCallback, new object[] { request, requestBody });
}
private void GetRequestStreamCallback(IAsyncResult asynchronousResult)
{
var request = (HttpWebRequest)((object[])asynchronousResult.AsyncState)[0];
using (var postStream = request.EndGetRequestStream(asynchronousResult))
{
var byteArray = (byte[])((object[])asynchronousResult.AsyncState)[1];
// Write to …Run Code Online (Sandbox Code Playgroud) 
我在我的Windows Phone 8应用程序中使用上面给出的弹出窗口.我的问题是黑色列表项目,无法区分项目与其他项目.所以我的问题是如何将圆形白色边框放到这个特定的黑名单项目中.
这是我在我的应用程序中使用的模板.
<DataTemplate x:Key="ColorListTemplate">
<Grid Height="70" Margin="0,0,0,5" toolkit:TiltEffect.IsTiltEnabled="True">
<StackPanel Orientation="Horizontal">
<Ellipse Height="52" Width="52" Fill="{Binding SelectedColor}"/>
<TextBlock Text="{Binding ColorName}" Margin="32,0" FontSize="34" Style="{StaticResource NormalText}"/>
<CheckBox IsChecked="{Binding CheckedStatus}" Style="{StaticResource CheckBoxStyle}" IsHitTestVisible="False"/>
</StackPanel>
</Grid>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)
有人请帮我设计我的要求.
我正在尝试为我们的组织已经创建的库创建一个绑定项目。我添加了 .aar 文件,当我尝试构建时,出现以下两个错误。
Error JAVAC0000: error: OnCompletionListenerImplementor is not abstract and does not override abstract method onCompletion(LockEvent,int,Metadata) in OnCompletionListener
Run Code Online (Sandbox Code Playgroud)
公共类 OnCompletionListenerImplementor (JAVAC0000)
Error JAVAC0000: error: SingleStepView_OnSelectionListenerImplementor is not abstract and does not override abstract method onSelected(Metadata,LockEvent) in OnSelectionListener
public class SingleStepView_OnSelectionListenerImplementor
(JAVAC0000)
Run Code Online (Sandbox Code Playgroud)
在API.xaml 中
它是这样生成的,
<interface abstract="true" deprecated="not deprecated" final="false" name="OnCompletionListener" static="false" visibility="public" jni-signature="Lno/zedoapp/zebra/key_ui/ui/listener/OnCompletionListener;"></interface>
<interface abstract="true" deprecated="not deprecated" final="false" name="SingleStepView.OnSelectionListener" static="true" visibility="public" jni-signature="Lno/zedoapp/zebra/key_ui/ui/view/SingleStepView$OnSelectionListener;"></interface>
Run Code Online (Sandbox Code Playgroud)
另外我在对象浏览器中注意到该类没有正确生成。
public interface IOnCompletionListener : IJavaObject, IDisposable, IJavaPeerable
{
}
internal sealed class IOnCompletionListenerImplementor : Java.Lang.Object, …Run Code Online (Sandbox Code Playgroud) 任何人都可以给我一些关于如何使用azure自签名证书在Xamarin Forms iOS和Android应用程序中验证Azure AD的背景知识.
我试图在没有凭证的情况下对azure AD进行身份验证,我已经提供了身份验证证书,但我对身份验证部分没有明确规定.
我 从微软看到了这个 指南.但是不知道如何使用Xamarin在客户端实现相同的功能.任何人都可以帮我解决这个问题.
我是Xamarin和Azure的新手.所以任何形式的链接/样本的帮助都非常感谢.我在谷歌搜索了一个解决方案.但最终会产生完全混乱.
在我的应用程序中,我使用下面提到的帮助方法将我的独立存储图像绑定到Image控件.我从这个链接辅助方法," 绑定存储在独立存储图像控制在Windows Phone的图片 "
public class IsoStoreImageSource : DependencyObject
{
public static void SetIsoStoreFileName(UIElement element, string value)
{
element.SetValue(IsoStoreFileNameProperty, value);
}
public static string GetIsoStoreFileName(UIElement element)
{
return (string)element.GetValue(IsoStoreFileNameProperty);
}
// Using a DependencyProperty as the backing store for IsoStoreFileName. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IsoStoreFileNameProperty =
DependencyProperty.RegisterAttached("IsoStoreFileName", typeof(string), typeof(IsoStoreImageSource), new PropertyMetadata("", Changed));
private static void Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Image img = d as Image;
if (img != null)
{
var path = …Run Code Online (Sandbox Code Playgroud) 如何以给定的格式(7/24/13,11:24 AM)格式化DateTime,我找到了一个以类似方式格式化字符串的选项[Text ="{Binding CreatedDate,StringFormat = {0:g}}" ],但我不能在日期和时间之间添加(",")逗号.我怎么能在Windows手机上做到这一点.目前使用字符串格式我得到这样的日期(2013年7月24日上午11:24).
是否可以取消HttpClient GET web request in Windows 8.我正在寻找一个解决方案来取消我的网页请求,如果用户从页面按回键.在我的应用程序中,我使用的static class是创建Web请求.
Alos我正在使用MVVM Light,并static viewmodels在应用程序内.
在当前情况下,即使用户按下后退按钮,vm保持活动和回叫也会到达并执行VM.
所以我正在寻找一个解决方案来取消背面的请求.
Xamarin 是否支持Google Firebase MLKit Vision API?我试图使用 MLKit 实现条形码阅读器。
在搜索时,我的印象是 Google 将停止支持 Mobile Vision API。
如何在windows phone 8 Bing地图应用程序中实现可拖动图钉.是否有任何内置的方法可用于在Windows Phone 8中实现这一点?
是否有任何鸟眼图模式可用,Windows Phone 8诺基亚地图.在MapCartographicMode中,我只喜欢以下枚举值.
public enum MapCartographicMode
{
Road,
Aerial,
Hybrid,
Terrain,
}
Run Code Online (Sandbox Code Playgroud)
然后我们如何在Windows Phone 8中实现鸟瞰视图.是否有其他选项可用于设置此模式.
c#-5.0 ×2
xamarin ×2
xaml ×2
async-await ×1
azure ×1
azure-ad-b2c ×1
bing-maps ×1
c# ×1
here-api ×1
silverlight ×1
windows-8 ×1