async void LoadResource() { codecManager = new CodecManager(); codecManager.RegisterDefaultCodecs(); await Task.Delay(1000); Frame.Navigate(typeof(MainMenuPage)); }
/// <summary> /// 初始化单一实例应用程序对象。这是执行的创作代码的第一行, /// 已执行,逻辑上等同于 main() 或 WinMain()。 /// </summary> public App() { Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync( Microsoft.ApplicationInsights.WindowsCollectors.Metadata | Microsoft.ApplicationInsights.WindowsCollectors.Session); this.InitializeComponent(); _codecManager.RegisterDefaultCodecs(); this.Suspending += OnSuspending; }
public void OnActivated(BackgroundMediaPlayer mediaPlayer) { _codecManager = new CodecManager(); _codecManager.RegisterDefaultCodecs(); this.mediaPlayer = mediaPlayer; smtc = mediaPlayer.SystemMediaTransportControls; ConfigureSystemMediaTransportControls(); mediaPlayer.MediaOpened += MediaPlayer_MediaOpened; mediaPlayer.MediaEnded += MediaPlayer_MediaEnded; mediaPlayer.CurrentStateChanged += MediaPlayer_CurrentStateChanged; Switch(); }
/// <summary> /// 初始化单一实例应用程序对象。这是执行的创作代码的第一行, /// 已执行,逻辑上等同于 main() 或 WinMain()。 /// </summary> public App() { LogManager.GetLog = type => new DebugLog(type); _logger = LogManager.GetLog(typeof(App)); //Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync( // Microsoft.ApplicationInsights.WindowsCollectors.Metadata | // Microsoft.ApplicationInsights.WindowsCollectors.Session | // Microsoft.ApplicationInsights.WindowsCollectors.PageView | // Microsoft.ApplicationInsights.WindowsCollectors.UnhandledException); //TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; //this.UnhandledException += App_UnhandledException; _codecManager.RegisterDefaultCodecs(); this.InitializeComponent(); }
/// <summary> /// 在应用程序由最终用户正常启动时进行调用。 /// 将在启动应用程序以打开特定文件等情况下使用。 /// </summary> /// <param name="e">有关启动请求和过程的详细信息。</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif codecManager = new CodecManager(); codecManager.RegisterDefaultCodecs(); Frame rootFrame = Window.Current.Content as Frame; // 不要在窗口已包含内容时重复应用程序初始化, // 只需确保窗口处于活动状态 if (rootFrame == null) { // 创建要充当导航上下文的框架,并导航到第一页 rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: 从之前挂起的应用程序加载状态 } // 将框架放在当前窗口中 Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // 当导航堆栈尚未还原时,导航到第一页, // 并通过将所需信息作为导航参数传入来配置 // 参数 rootFrame.Navigate(typeof(MainPage), e.Arguments); } // 确保当前窗口处于活动状态 Window.Current.Activate(); }