/// <summary> /// 在将要挂起应用程序执行时调用。 在不知道应用程序 /// 无需知道应用程序会被终止还是会恢复, /// 并让内存内容保持不变。 /// </summary> /// <param name="sender">挂起的请求的源。</param> /// <param name="e">有关挂起请求的详细信息。</param> private async void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); await JYAnalytics.StartTrackAsync(ApiHelper.JyAppkey); //TODO: 保存应用程序状态并停止任何后台活动 deferral.Complete(); }
protected override async void OnFileActivated(FileActivatedEventArgs args) { StartModel par = new StartModel() { StartType = StartTypes.File, Par3 = args.Files }; Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), par); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(MainPage), par); await JYAnalytics.StartTrackAsync(ApiHelper.JyAppkey); }
/// <summary> /// 在应用程序由最终用户正常启动时进行调用。 /// 当启动应用程序以打开特定的文件或显示时使用 /// 搜索结果等 /// </summary> /// <param name="e">有关启动请求和过程的详细信息。</param> protected async override void OnLaunched(LaunchActivatedEventArgs e) { //初始化九幽数据统计插件,appkey(密钥)请登陆九幽后台获取:http://www.windows.sc,可以替换成你的appkey在demo中测试 //为保证数据的完整和准确性,请尽量在OnLaunched中优先调用此方法 await JYAnalytics.StartTrackAsync("6d97ca1a3adb2853dad982d20d37dc95"); //初始化更新和公告插件,appkey请登陆九幽开发者后台获取http://www.windows.sc await JYUpdateSDK.JYUpdateManager.UpdateInitialize("6d97ca1a3adb2853dad982d20d37dc95", false); #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif Frame rootFrame = Window.Current.Content as Frame; // 不要在窗口已包含内容时重复应用程序初始化, // 只需确保窗口处于活动状态 if (rootFrame == null) { // 创建要充当导航上下文的框架,并导航到第一页 rootFrame = new Frame(); // TODO: 将此值更改为适合您的应用程序的缓存大小 rootFrame.CacheSize = 1; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { // TODO: 从之前挂起的应用程序加载状态 } // 将框架放在当前窗口中 Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { #if WINDOWS_PHONE_APP // 删除用于启动的旋转门导航。 if (rootFrame.ContentTransitions != null) { this.transitions = new TransitionCollection(); foreach (var c in rootFrame.ContentTransitions) { this.transitions.Add(c); } } rootFrame.ContentTransitions = null; rootFrame.Navigated += this.RootFrame_FirstNavigated; #endif // 当导航堆栈尚未还原时,导航到第一页, // 并通过将所需信息作为导航参数传入来配置 // 参数 if (!rootFrame.Navigate(typeof(SplashPage), e.Arguments)) { throw new Exception("Failed to create initial page"); } } // 确保当前窗口处于活动状态 Window.Current.Activate(); }
protected async override void OnActivated(IActivatedEventArgs args) { base.OnActivated(args); await JYAnalytics.StartTrackAsync("6d97ca1a3adb2853dad982d20d37dc95"); }
async void OnResuming(object sender, object e) { await JYAnalytics.StartTrackAsync("6d97ca1a3adb2853dad982d20d37dc95"); }
/// <summary> /// 在应用程序由最终用户正常启动时进行调用。 /// 将在启动应用程序以打开特定文件等情况下使用。 /// </summary> /// <param name="e">有关启动请求和过程的详细信息。</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG //if (System.Diagnostics.Debugger.IsAttached) //{ // this.DebugSettings.EnableFrameRateCounter = true; //} #endif SqlHelper sql = new SqlHelper(); sql.CreateTable(); Frame rootFrame = Window.Current.Content as Frame; // 不要在窗口已包含内容时重复应用程序初始化, // 只需确保窗口处于活动状态 if (rootFrame == null) { if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) { // StatusBar.GetForCurrentView().HideAsync(); StatusBar statusBar = StatusBar.GetForCurrentView(); statusBar.ForegroundColor = Colors.White; statusBar.BackgroundColor = Color.FromArgb(255, 223, 133, 160); statusBar.BackgroundOpacity = 100; } //电脑标题栏颜色 var titleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar; Color co = Color.FromArgb(255, 223, 133, 160); titleBar.BackgroundColor = co; titleBar.ForegroundColor = Color.FromArgb(255, 254, 254, 254);//Colors.White纯白用不了。。。 titleBar.ButtonHoverBackgroundColor = Color.FromArgb(255, 223, 133, 180); titleBar.ButtonBackgroundColor = co; titleBar.ButtonForegroundColor = Color.FromArgb(255, 254, 254, 254); titleBar.InactiveBackgroundColor = co; titleBar.ButtonInactiveBackgroundColor = co; // 创建要充当导航上下文的框架,并导航到第一页 rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: 从之前挂起的应用程序加载状态 } // 将框架放在当前窗口中 Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // 当导航堆栈尚未还原时,导航到第一页, // 并通过将所需信息作为导航参数传入来配置 // 参数 rootFrame.Navigate(typeof(LoadPage), e.Arguments); } // 确保当前窗口处于活动状态 Window.Current.Activate(); await JYAnalytics.StartTrackAsync(ApiHelper.JyAppkey); }
protected override async void OnActivated(IActivatedEventArgs args) { //new MessageDialog("卧槽").ShowAsync(); if (args.Kind == ActivationKind.Protocol) { ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs; string ban3 = Regex.Match(eventArgs.Uri.AbsoluteUri, @"^bilibili://video/(.*?)$").Groups[1].Value; string live = Regex.Match(eventArgs.Uri.AbsoluteUri, @"^bilibili://live/(.*?)$").Groups[1].Value; if (live.Length != 0) { //args.Handled = true; object[] par = new object[2]; par[0] = LoadType.OpenLive; par[1] = live; Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage)); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(MainPage), par); return; } if (ban3.Length != 0) { //args.Handled = true; object[] par = new object[2]; par[0] = LoadType.OpenAvNum; par[1] = ban3; Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage)); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(MainPage), par); } else { Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage)); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(MainPage)); } } await JYAnalytics.StartTrackAsync(ApiHelper.JyAppkey); }
/// <summary> /// 在应用程序由最终用户正常启动时进行调用。 /// 将在启动应用程序以打开特定文件等情况下使用。 /// </summary> /// <param name="e">有关启动请求和过程的详细信息。</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG //if (System.Diagnostics.Debugger.IsAttached) //{ // this.DebugSettings.EnableFrameRateCounter = true; //} #endif 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 (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // 当导航堆栈尚未还原时,导航到第一页, // 并通过将所需信息作为导航参数传入来配置 // 参数 ApiHelper.access_key = SettingHelper.Get_Access_key(); UserManage.access_key = SettingHelper.Get_Access_key(); var par = new StartModel() { StartType = StartTypes.None }; if (e.Arguments.Length != 0) { par.StartType = StartTypes.Video; par.Par1 = e.Arguments; } if (SettingHelper.Get_PlayerMode()) { rootFrame.Navigate(typeof(PlayerModePage)); } else { rootFrame.Navigate(typeof(SplashPage), par); } } // 确保当前窗口处于活动状态 Window.Current.Activate(); await JYAnalytics.StartTrackAsync(ApiHelper.JyAppkey); } }
protected override async void OnActivated(IActivatedEventArgs args) { //new MessageDialog("卧槽").ShowAsync(); if (args.Kind == ActivationKind.Protocol) { StartModel par = new StartModel() { StartType = StartTypes.None }; ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs; string ban3 = Regex.Match(eventArgs.Uri.AbsoluteUri, @"^bilibili://video/(.*?)$").Groups[1].Value; string live = Regex.Match(eventArgs.Uri.AbsoluteUri, @"^bilibili://live/(.*?)$").Groups[1].Value; string minivideo = Regex.Match(eventArgs.Uri.AbsoluteUri, @"^bililive://clip/(.*?)$").Groups[1].Value; Frame rootFrame = Window.Current.Content as Frame; if (live.Length != 0) { par.StartType = StartTypes.Live; par.Par1 = live; //args.Handled = true; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(SplashPage), par); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(SplashPage), par); return; } if (ban3.Length != 0) { par.StartType = StartTypes.Video; par.Par1 = ban3; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(SplashPage), par); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(SplashPage), par); return; } if (minivideo.Length != 0) { //args.Handled = true; par.StartType = StartTypes.MiniVideo; par.Par1 = minivideo; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(SplashPage), par); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(SplashPage), par); return; } if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(SplashPage), par); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(SplashPage), par); } await JYAnalytics.StartTrackAsync(ApiHelper.JyAppkey); }
private async void track() { await JYAnalytics.StartTrackAsync("95da5b5ebcc881d470104c1543763bbc"); }