当我在基于Template 10的应用程序上运行App Certification时,出现以下错误:
发现错误:应用程序预启动验证检测到以下错误:◦应用程序启动前测试失败 - 49581RisingSoundMedia.ElectionCentral_1.1.7.0_x64__xrbjpqg44kdgm.
•即使没有修复也会产生影响:即使启用了预启动,应用也需要更长的时间才能启动.
•如何修复:在应用程序的OnLaunched方法实现中,确保您处理LaunchActivatedEventArgs.PreLaunch选项以预启动事件感知.
显然,即使使用Template 10,我也无法覆盖OnLaunched,因为Bootstrap类将它封装起来.
我尝试重写OnPreLaunchAsync并设置continueStartup = false; 但它没有解决问题.
有任何想法吗?
我有一个基于Template10的应用程序,并希望使用IoC处理我的依赖注入.我倾向于使用Unity来实现这个目标.我的应用程序分为三个程序集:
我有这些问题:
我已经阅读了很多关于DI和IoC的内容,但我需要知道如何在实践中应用所有理论,特别是在Template10中.
注册代码:
// where should I put this code?
var container = new UnityContainer();
container.RegisterType<ISettingsService, RoamingSettingsService);
Run Code Online (Sandbox Code Playgroud)
然后是检索实例的代码:
var container = ???
var settings = container.Resolve<ISettingsService>();
Run Code Online (Sandbox Code Playgroud) 我正在使用UWP和Template 10通过遵循MVVM模式来构建GUI应用程序.作为应用程序的一部分,我需要通过按主页面上的按钮来调用内容对话框.因此,为独立的.xaml文件创建了单独的ContentDialog:
<ContentDialog
x:Class="UWP1.Views.Speech"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UWP1.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Dictate"
PrimaryButtonText="Accept"
SecondaryButtonText="Cancel"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
SecondaryButtonClick="ContentDialog_SecondaryButtonClick"
>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
</Grid.ColumnDefinitions>
<Button Margin="15" Content="Dictate" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch"/>
<Button Margin="15" Content="Clear Text" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Text="Tap 'Dictate', and speak" FontSize="12" />
<TextBlock Margin="0 10 0 0" Grid.Row="2" Grid.ColumnSpan="2" Text="Message Dication" HorizontalAlignment="Center" FontSize="24" />
<ScrollViewer Grid.Row="3" Grid.ColumnSpan="2" Height="300">
<TextBox Margin="5 5 5 10" AcceptsReturn="True" /> …Run Code Online (Sandbox Code Playgroud) 将项目调整为Template10,我进入App.xaml中的继承样式正在崩溃.
它看起来像Template10,不支持继承或扩展样式.我试图从TitleStyle扩展SubTitleStyle但我在XamlTypeInfo.g.cs中的GetXamlType上获得了COM异常
我的App.xaml.cs
sealed partial class App : BootStrapper
{
public App() { InitializeComponent(); }
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
NavigationService.Navigate(typeof(ShellView))
await Task.CompletedTask;
}
}
Run Code Online (Sandbox Code Playgroud)
我的App.xaml
<Style x:Key="TitleStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource TextTitleForeground}"/>
<Setter Property="FontSize" Value="26"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="FontWeight" Value="Medium"/>
</Style>
<Style x:Key="SubTitleStyle" TargetType="TextBlock" BasedOn="{StaticResource TitleStyle}">
<Setter Property="Foreground" Value="{StaticResource TextForeground}"/>
<Setter Property="FontSize" Value="20"/>
</Style>
Run Code Online (Sandbox Code Playgroud)
例外信息:
Error HRESULT E_FAIL has been returned from …Run Code Online (Sandbox Code Playgroud) 我已按照说明启动并运行模板10,但我遇到了单个程序集错误CS0234
错误CS0234命名空间"Microsoft"中不存在类型或命名空间名称"ApplicationInsights"(您是否缺少程序集引用?)WindowsApp1 C:\ Users\Keshi\AppData\Local\Temporary Projects\WindowsApp1\App.xaml.cs
任何想法都是为什么这个装配丢失了.我已经安装了整个VS包.为什么会丢失这个集会.
Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
Microsoft.ApplicationInsights.WindowsCollectors.Session);
Run Code Online (Sandbox Code Playgroud)
谢谢
在使用 Template10 的 UWP-Windows 10 C#/XAML 应用程序中,我目前正在尝试让我的页面/视图从继承自Windows.UI.Xaml.Controls.Page.
这一直正常工作,但是当我尝试使基类通用并以以下方式在子类和 XAML 中包含类型参数时,它不起作用:
namespace App.Views
{
public abstract class InfoListViewBase<M> : Page where M : InfoListViewModelBase
{
public InfoListViewBase() { }
}
public sealed partial class ModelPage : InfoListViewBase<Model>
{
public Model()
{
InitializeComponent();
NavigationCacheMode = NavigationCacheMode.Disabled;
}
}
}
<local:InfoListViewBase
x:Class="App.Views.ModelPage"
x:TypeArguments="l:Model"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Behaviors="using:Template10.Behaviors"
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:controls="using:Template10.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:App.Views"
xmlns:l="using:Library"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
</local:InfoListViewBase>
Run Code Online (Sandbox Code Playgroud)
我收到的错误是:
The name "InfoListViewBase`1" does not exist in the namespace "using:App.Views".
Run Code Online (Sandbox Code Playgroud)
每次我将该行添加x:TypeArguments="l:Model"到 XAML时都会出现该错误。
在visual …
我花了两个多星期的时间搜索 google、bing、stack overflow 和 msdn 文档,试图找出如何为我正在开发的移动应用程序进行适当的依赖注入。需要明确的是,我每天都在 Web 应用程序中进行 DI。我不需要关于什么、谁以及为什么 DI 很重要的速成课程。我知道它是,并且我总是拥抱它。
我需要了解的是这在移动应用程序世界中是如何工作的,尤其是 UWP 模板 10 移动应用程序。
从我过去开始,在 .net/Asp 应用程序中,我可以“RegisterType(new XYZ).Singleton() blah”{请原谅语法;只是 App_Start.ConfigureServices 中的一个示例}。这在 .netcore 中的工作原理几乎相同,但进行了一些语法更改。
我的问题是现在我试图将我的 api 提供给需要消化我的 IXYZ 服务的 UWP 应用程序。我绝不认为他们应该每次都“新建”一个实例。必须有一种方法将其注入 UWP 端的容器中;我觉得我在这个过程中遗漏了一些非常简单的东西。
这是我的代码:
应用程序.xaml.cs
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// TODO: add your long-running task here
//if (args.Kind == ActivationKind.LockScreen)
//{
//}
RegisterServices();
await NavigationService.NavigateAsync(typeof(Views.SearchCompanyPage));
}
public static IServiceProvider Container { get; private set; }
private static void RegisterServices()
{
var services …Run Code Online (Sandbox Code Playgroud) uac dependency-injection inversion-of-control uwp template10
这适用于UWP,如何禁用列表视图项的动画?我有一个每隔几秒运行一次的方法,并且飞入式动画效果使它在视觉上令人不悦.我想禁用这个效果.分享的代码不多,但这是我的ListView:
<ListView RelativePanel.Below="pageHeader" ItemsSource="{Binding DataItems}" />
Run Code Online (Sandbox Code Playgroud) 我有问题如何在UWP中实现子页面导航.该页面位于RootFrame中,我可以在导航中使用.但我想使用这样的东西:
<Page>
<Grid>
<Frame x:Name="MyFrame"/>
</Grid>
</Page>
Run Code Online (Sandbox Code Playgroud)
我想要的是,在ViewModel中使用控制MyFrame的Navigate方法.我可以从代码隐藏调用该方法,但我正在使用MVVM开发我的应用程序.我不确定,如果Template10可以使用子帧.
我很感激任何建议.
编辑: 更多细节:我在页面中有枢轴控制.枢轴有2个选项卡(pivotitems).pivotitem的内容必须是可导航的.我的意思是:我的第一部分,我需要有一个框架,并在枢轴实现中使用它进行导航.我的问题是,如何使用或如何从ViewModel调用pivotitem中的帧,特别是我需要调用Navigate方法.现在我正在使用Template10的导航服务,它正在使用rootframe.我不知道,如何将其用于其他让我们说的子帧.
是否有关于Prism特征的详细比较研究.StoreApps与Template10?来自stackoverflow,Template10使用下面的PRISM.
但是,我们如何评估使用Prism.StoreApps和Template10的端到端通用应用程序?
经历了很多麻烦之后,我运行了Enable-Migrations,我终于正确地使用了命令,以便它在我的项目中创建了Migrations目录。
但是,这是它给我的文件。我已将Using语句移至顶部,并删除了无效的语句,但这就是我所做的全部更改。
原始代码。错误在上面的图像链接中。
internal sealed class Configuration : DbMigrationsConfiguration<RapidDeploy.Models.BloggingContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(RapidDeploy.Models.BloggingContext context)
{
// This method will be called after migrating to the latest version.
// You can use the DbSet<T>.AddOrUpdate() helper extension method
// to avoid creating duplicate seed data. E.g.
//
// context.People.AddOrUpdate(
// p => p.FullName,
// new Person { FullName = "Andrew Peters" },
// new Person { FullName = "Brice Lambson" },
// new Person …Run Code Online (Sandbox Code Playgroud) 我正在开发一个UWP应用程序,我正在使用Template10汉堡包模板.我想在PageHeader中添加一个AutoSuggestBox,如果我没有设置任何主命令或辅助命令,它可以正常工作.如果我设置了任何命令,则命令和AutoSuggestBox重叠.我所做的是为PageHeader设置一个padding right值,如下所示:
<controls:PageHeader x:Name="pageHeader" Text="Main Page" Padding="0,0,283,0">
<!-- place stretched, across top -->
<RelativePanel.AlignTopWithPanel>True</RelativePanel.AlignTopWithPanel>
<RelativePanel.AlignLeftWithPanel>True</RelativePanel.AlignLeftWithPanel>
<RelativePanel.AlignRightWithPanel>True</RelativePanel.AlignRightWithPanel>
<!-- secondary commands -->
<controls:PageHeader.SecondaryCommands>
<AppBarButton Click="{x:Bind ViewModel.GotoSettings}" Label="Settings" />
<AppBarButton Click="{x:Bind ViewModel.GotoPrivacy}" Label="Privacy" />
<AppBarButton Click="{x:Bind ViewModel.GotoAbout}" Label="About" />
</controls:PageHeader.SecondaryCommands>
</controls:PageHeader>
<AutoSuggestBox Margin="0,8,12,0" Width="270" QueryIcon="Find" PlaceholderText="Search">
<RelativePanel.AlignRightWithPanel>True</RelativePanel.AlignRightWithPanel>
</AutoSuggestBox>
Run Code Online (Sandbox Code Playgroud)
我的问题是这是建议的做法还是另外一种方式?提前致谢
我正在使用模板10开发一个UWP应用程序,该应用程序将固定到灯光主题.(对不起,这是业务要求)
Visual Studio设计器正在默认的Dark主题中显示应用程序.如何更改此设置以便设计师(而不是VS)在设计时显示Light主题?
谢谢.
template10 ×13
uwp ×7
c# ×5
xaml ×4
mvvm ×2
winrt-xaml ×2
.net ×1
modal-dialog ×1
prism ×1
uac ×1
windows-10 ×1
wpf ×1