更新:情节变浓.我更改了我的频道名称,它突然正常工作(这意味着我的推送服务不是问题,因为我从Microsoft推送通知服务器获得了相同的HTTP响应).
但是,对我来说,这不是一个解决方案.我怎样才能测试这个并知道我的用户是否正在获得他们的推送通知,如果我得到相同的响应,当它不像我那样工作时?
[原始帖子]
我一直试图将推送通知发送到我的Windows Phone 7设备,但我遇到了很大的问题,我找不到任何答案.我将从c#代码开始.
我使用以下C#代码设置推送通知.
private HttpNotificationChannel channel;
private static string PUSH_CHANNEL = "MySpecialPushChannel";
private Uri PushUri = null;
private bool IsPushRegistered = false;
public void StartPushSubscription()
{
try
{
channel = HttpNotificationChannel.Find(PUSH_CHANNEL);
}
catch
{}
if (channel != null)
{
PushUri = channel.ChannelUri;
if (!channel.IsShellTileBound)
channel.BindToShellTile();
}
else
{
channel = new HttpNotificationChannel(PUSH_CHANNEL);
channel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(channel_ChannelUriUpdated);
channel.HttpNotificationReceived += new EventHandler<HttpNotificationEventArgs>(channel_HttpNotificationReceived);
channel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(channel_ErrorOccurred);
try
{
channel.Open();
channel.BindToShellTile();
}
catch (Exception err)
{
channel = null; …Run Code Online (Sandbox Code Playgroud) silverlight silverlight-3.0 push-notification windows-phone-7 mpns
我正在为Windows Phone 7+构建一个可以进行增强现实图像处理的自定义控件.控件在实践中运行得非常好(当我运行应用程序时),但因为我在单独的线程上运行图像处理,当我尝试在Blend或Visual Studio设计器中打开页面时,它会中断.
这是我正在尝试运行的线程的示例(基本上取自http://msdn.microsoft.com/en-us/library/hh202982(v=vs.92).aspx):
public override void OnApplyTemplate()
{
// assigning template stuff, initializing my camera
_myManualResetEvent = new ManualResetEvent(true);
_myCameraProcessingThread = new System.Threading.Thread(ProcessingMethod);
_myCameraProcessingThread.Start();
}
void ProcessingMethod()
{
int[] myBuffer = new int[640 * 480];
while(_someCondition)
{
_myManualResetEvent.WaitOne();
_myCamera.GetPreviewBufferArgb32(myBuffer);
// do my processing stuff
_myManualResetEvent.Set();
}
}
Run Code Online (Sandbox Code Playgroud)
这打破了Blend的爱好.很想知道为什么.
silverlight expression-blend windows-phone-7 windows-phone-7.1