Template 10 Windows アプリケーションで OnLaunched() 関数をオーバーライドしようとしていますが、問題は Template 10 BootStrapper クラス (Application クラスから継承) で封印されていることです。
これが私の方法です:
using Windows.UI.Xaml;
...
namespace Sample {
...
sealed partial class App : Template10.Common.BootStrapper {
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
/*************** My stuff *****************
***********************************************/
}
...
}
このアプリには Template10 Blank アプリを使用しています。BootStrapper クラスの OnLaunched() メソッドは次のとおりです。
namespace Template10.Common
{
public abstract class BootStrapper : Application
{
...
protected sealed override void OnLaunched(LaunchActivatedEventArgs e);
...
}
...
}
BootStrapper の OnLaunched() から封印された修飾子を削除できません (「メタデータから」であるためと推測されます)。
抽象クラスに封印されたメソッドを含める意味は何ですか?
OnLaunched() の代わりに、OnResume()、OnStartAsync() など、オーバーライドする他のメソッドを取得しますか?
更新: 参考までに、BootStrapper のすべてのメンバーを次に示します。
public abstract class BootStrapper : Application
{
public const string DefaultTileID = "App";
protected BootStrapper();
public static BootStrapper Current { get; }
public TimeSpan CacheMaxDuration { get; set; }
public INavigationService NavigationService { get; }
public StateItems SessionState { get; set; }
public bool ShowShellBackButton { get; set; }
protected Func<SplashScreen, UserControl> SplashFactory { get; set; }
public event EventHandler<WindowCreatedEventArgs> WindowCreated;
public static AdditionalKinds DetermineStartCause(IActivatedEventArgs args);
public NavigationService NavigationServiceFactory(BackButton backButton, ExistingContent existingContent);
[AsyncStateMachine(typeof(<OnInitializeAsync>d__44))]
public virtual Task OnInitializeAsync(IActivatedEventArgs args);
public virtual void OnResuming(object s, object e);
public abstract Task OnStartAsync(StartKind startKind, IActivatedEventArgs args);
[AsyncStateMachine(typeof(<OnSuspendingAsync>d__45))]
public virtual Task OnSuspendingAsync(object s, SuspendingEventArgs e);
public Dictionary<T, Type> PageKeys<T>() where T : struct, IConvertible;
public virtual T Resolve<T>(Type type);
public virtual INavigable ResolveForPage(Type page, NavigationService navigationService);
public void UpdateShellBackButton();
[AsyncStateMachine(typeof(<OnActivated>d__26))]
protected sealed override void OnActivated(IActivatedEventArgs e);
[AsyncStateMachine(typeof(<OnCachedFileUpdaterActivated>d__27))]
protected sealed override void OnCachedFileUpdaterActivated(CachedFileUpdaterActivatedEventArgs args);
[AsyncStateMachine(typeof(<OnFileActivated>d__28))]
protected sealed override void OnFileActivated(FileActivatedEventArgs args);
[AsyncStateMachine(typeof(<OnFileOpenPickerActivated>d__29))]
protected sealed override void OnFileOpenPickerActivated(FileOpenPickerActivatedEventArgs args);
[AsyncStateMachine(typeof(<OnFileSavePickerActivated>d__30))]
protected sealed override void OnFileSavePickerActivated(FileSavePickerActivatedEventArgs args);
protected sealed override void OnLaunched(LaunchActivatedEventArgs e);
[AsyncStateMachine(typeof(<OnSearchActivated>d__31))]
protected sealed override void OnSearchActivated(SearchActivatedEventArgs args);
[AsyncStateMachine(typeof(<OnShareTargetActivated>d__32))]
protected sealed override void OnShareTargetActivated(ShareTargetActivatedEventArgs args);
protected sealed override void OnWindowCreated(WindowCreatedEventArgs args);
public enum AdditionalKinds
{
Primary,
Toast,
SecondaryTile,
Other
}
public enum BackButton
{
Attach,
Ignore
}
public enum ExistingContent
{
Include,
Exclude
}
public enum StartKind
{
Launch,
Activate
}
}
助けてください :}