应用程序关闭时,我的应用程序会很好地接收推送通知 但是当应用程序运行时,我什么都没得到.这是我与出任何问题之前的应用程序都使用相同的代码,那些在WindowsPhone8和新的应用程序是在WindowsPhone8.1设备上运行.
我在创建原始应用程序时使用了这个Push Tutorial.如果您想在应用程序打开时接收通知,我确实有一行说明添加此项.
如果8.1更新已经对推送通知做了一些很好的了解.其他任何事情也将不胜感激.
HttpNotificationChannel pushChannel;
string channelName = "PushChannel";
pushChannel = HttpNotificationChannel.Find(channelName);
//Push Notifications
if (pushChannel == null)
{
pushChannel = new HttpNotificationChannel(channelName);
//// Register for all the events before attempting to open the channel.
pushChannel.ChannelUriUpdated +=
new EventHandler<NotificationChannelUriEventArgs>(
PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred +=
new EventHandler<NotificationChannelErrorEventArgs>(
PushChannel_ErrorOccurred);
// Register for this notification only if you need to receive
// the notifications while your application is running.
pushChannel.ShellToastNotificationReceived +=
new EventHandler<NotificationEventArgs>(
PushChannel_ShellToastNotificationReceived);
pushChannel.Open();
// Bind this new channel for …Run Code Online (Sandbox Code Playgroud) 我有一个带有2个图钉的地图,当我加载页面时,我正在设置后面代码中的一个图钉的位置.但是,当我尝试引用该引脚时,它为空.
XAML
<maps:Map x:Name="mapEventLocation" ZoomLevel="15" Grid.Row="1" Tap="mapEventLocation_Tap" >
<maptoolkit:MapExtensions.Children>
<maptoolkit:Pushpin x:Name="userLocationPin" Content="You" Visibility="Collapsed" />
<maptoolkit:Pushpin x:Name="eventLocationPin" Content="Event" Visibility="Collapsed" />
</maptoolkit:MapExtensions.Children>
</maps:Map>
Run Code Online (Sandbox Code Playgroud)
C#
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
if (this.NavigationContext.QueryString.ContainsKey("lat"))
{
userLocationPin.GeoCoordinate = new GeoCoordinate(double.Parse(this.NavigationContext.QueryString["lat"]), double.Parse(this.NavigationContext.QueryString["lon"]));
userLocationPin.Visibility = System.Windows.Visibility.Visible;
mapEventLocation.Center = new GeoCoordinate(double.Parse(this.NavigationContext.QueryString["lat"]), double.Parse(this.NavigationContext.QueryString["lon"]));
}
}
Run Code Online (Sandbox Code Playgroud)
Lat和Lon肯定在QueryString中.
在此之前,使用过
Pushpin pin = (Pushpin)this.FindName("userLocationPin");
Run Code Online (Sandbox Code Playgroud)
这适用于模拟器,但不适用于真正的手机.
我试图在一个层中手动制作图钉,但是针脚转到了拐角处
Pushpin userLocation = new Pushpin();
userLocation.GeoCoordinate = new GeoCoordinate(double.Parse(this.NavigationContext.QueryString["lat"]), double.Parse(this.NavigationContext.QueryString["lon"]));
userLocation.Content = "You";
MapLayer layer = new MapLayer();
MapOverlay overlay = new MapOverlay();
overlay.Content = …Run Code Online (Sandbox Code Playgroud) 我正在创建一个XML Form Reader.每种控件类型都是用户控件.但是,当用户点击不是聚焦控件(即TextBlock)的表单上的某个位置时,表单会将焦点跳转到页面中的第一个可聚焦控件.(即TextBox)
这会将页面滚动到顶部(通常),使用户远离他们正在处理的内容.
我在焦点事件周围尝试了很多不同的事情,但是如何解决这个问题却遇到了障碍.
处理这个问题的最佳方法是什么?任何提示或技巧将不胜感激.
谢谢
编辑(更多信息)
"MASTER"页面有一个 StackPanel
<StackPanel x:Name="pnlFormMain" ScrollViewer.BringIntoViewOnFocusChange="False"/>
Run Code Online (Sandbox Code Playgroud)
对于xml表单中的每个控件,UserControl将添加到stackpanel.
<UserControl.Resources>
<Storyboard x:Name="Show">
<DoubleAnimation Duration="0:0:0.6" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="_WidgetMaster" d:IsOptimized="True"/>
</Storyboard>
<Storyboard x:Name="Hide">
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="_WidgetMaster" d:IsOptimized="True"/>
</Storyboard>
</UserControl.Resources>
<Grid x:Name="grdInput" ScrollViewer.BringIntoViewOnFocusChange="False">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Grid.Row="0" ScrollViewer.BringIntoViewOnFocusChange="False">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<!-- label -->
<TextBlock x:Name="lblLabel" Text="Label" Grid.Column="0" VerticalAlignment="Center" Margin="3,6,5,5" TextWrapping="Wrap" />
<!-- …Run Code Online (Sandbox Code Playgroud) 我已经制作了一个REST Web服务,它与Visual Studios WCF测试客户端一起使用.可以使用位于其旁边的网站调用它,并使用使用svcutil创建的"代理"类.
当我浏览到.svc文件时,我也可以看到服务存在.(http://localhost/service1.svc)它提出了"你已经创建了一个服务".网页.
然而
当我尝试调用服务中的函数(http://localhost/service.svc/firstName/lastName)时,它返回400错误代码.
我最近有一个单独的错误,我无法弄清楚所以我找到了一个关于非常基本的Web服务的教程" http://blog.weareon.net/how-to-create-and-consume-rest-web-service- using-wcf / ",那个停止了上一个错误,但在尝试调用函数时仍然有400错误.
我的.config文件被削减到了骨头,以便在我进入太远之前尝试让它工作.
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="VService">
<endpoint address="" binding="webHttpBinding" contract="ServiceName.IService1" behaviorConfiguration="webBehavior" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below …Run Code Online (Sandbox Code Playgroud) 我已经创建了一个Web服务(REST),我从Windows服务中调用它.
一些电话似乎没有工作和问题.而其他一些人正在返回Bad Request.我将服务器设置为在反序列化数据为NULL时返回Bad Request.
Web Service使用EDMX从数据库生成对象类.
本地服务具有对Web服务的服务引用,因此它具有相同的对象类.
我正在使用Microsoft.AspNet.WebApi.Client Nuget Package来从本地服务进行调用.
代码低于Web服务操作
//NOT WORKING
[OperationContract]
[WebInvoke(Method = "POST",
UriTemplate = "{entity}/consent/{consent_id}/info")]
bool ConsentInformation(string entity, string consent_id, consent info);
//WORKING
[OperationContract]
[WebInvoke(Method = "POST",
UriTemplate = "{entity}/council/users")]
void GoGetUsers(string entity, IEnumerable<council_user> user);
Run Code Online (Sandbox Code Playgroud)
WEB服务代码
//NOT WORKING
public void ConsentStatus(string entity, string consent_id, consent_status status)
{
Utilities.SetResponseFormat();
if (status == null)
{
WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.BadRequest;
return;
}
gosubmitEntity entitys = new gosubmitEntity();
consent_status consent = entitys.consent_status.FirstOrDefault(c => c.consent_id == consent_id && c.council_code == entity); …Run Code Online (Sandbox Code Playgroud)