• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IActivatedEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IActivatedEventArgs的典型用法代码示例。如果您正苦于以下问题:C# IActivatedEventArgs类的具体用法?C# IActivatedEventArgs怎么用?C# IActivatedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IActivatedEventArgs类属于命名空间,在下文中一共展示了IActivatedEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Activate

        // *** Methods ***

        public async Task<bool> Activate(IActivatedEventArgs activatedEventArgs)
        {
            // Raise Activating event

            EventHandler<IActivatedEventArgs> activatingEventHandler = Activating;

            if (activatingEventHandler != null)
                activatingEventHandler(this, activatedEventArgs);

            // Call activate on all activation handlers
            // NB: We convert to an array so that the Select is not called multiple times

            IEnumerable<Task<bool>> activationTasks = registeredServices.Select(service => service.Activate(activatedEventArgs)).ToArray();
            await Task.WhenAll(activationTasks);

            // Raise Activated event

            EventHandler<IActivatedEventArgs> activatedEventHandler = Activated;

            if (activatedEventHandler != null)
                activatedEventHandler(this, activatedEventArgs);

            // Determine if the activation was handled by any of the handlers

            Task<bool> firstHandlingTask = activationTasks.FirstOrDefault(task => task.Result == true);
            bool handled = firstHandlingTask != null;

            // If the activation was handled then activate the current window
            
            if (handled && Window.Current != null)
                Window.Current.Activate();

            return handled;
        }
开发者ID:Valks,项目名称:Okra,代码行数:36,代码来源:ActivationManager.cs


示例2: OnActivated

        protected override void OnActivated(IActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }


            switch (args.Kind)
            {
                case ActivationKind.VoiceCommand:
                    HandleVoiceCommand(args, rootFrame);
                    break;
                    
                default:
                    break;
            }

            Window.Current.Activate();

            base.OnActivated(args);
        }
开发者ID:Pinoplast,项目名称:WinDevWorkshop,代码行数:30,代码来源:App.xaml.cs


示例3: OnInitializeAsync

 // runs even if restored from state
 public override async Task OnInitializeAsync(IActivatedEventArgs args)
 {
     // setup hamburger shell
     var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include);
     Window.Current.Content = new Views.Shell(nav);
     await Task.Yield();
 }
开发者ID:timothius2005,项目名称:Template10,代码行数:8,代码来源:App.xaml.cs


示例4: OnActivated

 protected override void OnActivated(IActivatedEventArgs args)
 {
     if (args.Kind == ActivationKind.Protocol)
     {
         OnProtocolActivated((ProtocolActivatedEventArgs)args);
     }
 }
开发者ID:christophwille,项目名称:winrt-ris,代码行数:7,代码来源:App.xaml.cs


示例5: OnActivated

        protected override void OnActivated(IActivatedEventArgs e)
        {
            if (e.Kind == ActivationKind.Protocol)
            {
                var protocolArgs = e as ProtocolActivatedEventArgs;
                var uri = protocolArgs.Uri;

                if (uri.AbsoluteUri.IndexOf("?access_token=") != -1)
                {
                    int Start = uri.AbsoluteUri.IndexOf("?access_token=");
                    int offset = ("?access_token=").Length;
                    int End = uri.AbsoluteUri.IndexOf("&expires_in");
                    string FBtoken = uri.AbsoluteUri.Substring(Start + offset, End - Start - offset);
                    if (OnProtocolActivated != null)
                        OnProtocolActivated.Invoke(this, FBtoken);
                }
                else
                {
                    SocialAuthentication.RaiseAuthenFail();
                }
                return;
            }

            base.OnActivated(e);
        }
开发者ID:thang2410199,项目名称:ProMe,代码行数:25,代码来源:App.xaml.cs


示例6: OnActivated

		/// <summary>
		/// Invoked when application is launched through protocol.
		/// Read more - http://msdn.microsoft.com/library/windows/apps/br224742
		/// </summary>
		/// <param name="args"></param>
		protected override void OnActivated(IActivatedEventArgs args)
		{
			string appArgs = "";
			
			switch (args.Kind)
			{
				case ActivationKind.Protocol:
					ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs;
					splashScreen = eventArgs.SplashScreen;
					appArgs += string.Format("Uri={0}", eventArgs.Uri.AbsoluteUri);
					break;
                case ActivationKind.VoiceCommand:
                    var commandArgs = args as VoiceCommandActivatedEventArgs;
                    SpeechRecognitionResult speechRecognitionResult = commandArgs.Result;
                    string voiceCommandName = speechRecognitionResult.RulePath[0];

                    // This is one way of handling different commands found in the VCD file with code.
                    switch (voiceCommandName)
                    {
                        case "startPlay":
                            {
                                break;
                            }
                        case "checkScore":
                            if (speechRecognitionResult.SemanticInterpretation.Properties.ContainsKey("message"))
                            {
                                // Just to show you can get the message as well..
                                string message = speechRecognitionResult.SemanticInterpretation.Properties["message"][0];
                            }
                            break;
                    }
                    break;
            }
			InitializeUnity(appArgs);
		}
开发者ID:Tapanito,项目名称:F20CA,代码行数:40,代码来源:App.xaml.cs


示例7: OnActivated

        protected override void OnActivated(IActivatedEventArgs args)
        {
            var rootFrame = Window.Current.Content as Frame;
            if (rootFrame == null)
            {
                base.OnActivated(args);
                return;
            }

            // Return to Reply Page with image.

            var replyPage = rootFrame.Content as ReplyPage;
            if (replyPage != null && args is FileOpenPickerContinuationEventArgs)
            {
                replyPage.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs);
            }

            var editPage = rootFrame.Content as EditPage;
            if (editPage != null && args is FileOpenPickerContinuationEventArgs)
            {
                editPage.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs);
            }

            // Voice command!111!!!11!

            if (args.Kind == ActivationKind.VoiceCommand)
            {
                VoiceCommandActivatedEventArgs vcArgs = (VoiceCommandActivatedEventArgs) args;
                string voiceCommandName = vcArgs.Result.RulePath.First();
                rootFrame.Navigate(typeof(VoiceHandlePage), vcArgs.Result);
            }
            base.OnActivated(args);

        }
开发者ID:llenroc,项目名称:AwfulMetro,代码行数:34,代码来源:App.xaml.cs


示例8: OnActivated

    protected override void OnActivated(IActivatedEventArgs args)
    {
      var launchContinuationArgs = args as ProtocolWithResultsContinuationActivatedEventArgs;
      if (launchContinuationArgs != null)
      {

        Frame rootFrame = Window.Current.Content as Frame;

        // Do not repeat app initialization when the Window already has content,
        // just ensure that the window is active
        if (rootFrame == null)
        {
          // Create a Frame to act as the navigation context and navigate to the first page
          rootFrame = new Frame();
          // Set the default language
          rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

          rootFrame.NavigationFailed += OnNavigationFailed;

          // Place the frame in the current Window
          Window.Current.Content = rootFrame;
        }

        // Navigate to the continuation page, configuring the new page by passing the 
        // results ValueSet as a navigation parameter
        rootFrame.Navigate(typeof(ContinuationPage),launchContinuationArgs.Result);
        
        // Ensure the current window is active
        Window.Current.Activate();
      }
    }
开发者ID:h82258652,项目名称:Samples,代码行数:31,代码来源:App.xaml.cs


示例9: Activate

        // *** Methods ***

        public Task<bool> Activate(IActivatedEventArgs activatedEventArgs)
        {
            if (activatedEventArgs == null)
                throw new ArgumentNullException(nameof(activatedEventArgs));

            return ActivateInternal(activatedEventArgs);
        }
开发者ID:deepakpal9046,项目名称:Okra.Core,代码行数:9,代码来源:SearchManager.cs


示例10: OnActivated

 protected override async void OnActivated(IActivatedEventArgs e)
 {
   switch (e.Kind)
   {
     // See http://go.microsoft.com/fwlink/?LinkID=288842
     case ActivationKind.Launch:
       var args = e as LaunchActivatedEventArgs;
       if (args.TileId == "App" && !args.Arguments.Any())
       { await OnActivatedByPrimaryTileAsync(args); }
       else if (args.TileId == "App" && args.Arguments.Any())
       { await OnActivatedBySecondaryTileAsync(args); }
       else
       { await OnActivatedByToastNotificationAsync(args); }
       break;
     case ActivationKind.Protocol:
     case ActivationKind.ProtocolForResults:
     case ActivationKind.ProtocolWithResultsContinuation:
       await OnActivatedByProtocolAsync(e as ProtocolActivatedEventArgs);
       break;
     default:
       break;
   }
   // this is to handle any other type of activation
   await this.OnActivatedAsync(e);
   Window.Current.Activate();
 }
开发者ID:h82258652,项目名称:Samples,代码行数:26,代码来源:ApplicationBase.cs


示例11: OnActivated

 protected override void OnActivated(IActivatedEventArgs e)
 {
     base.OnActivated(e);
     try
     {
         if (e.Kind == ActivationKind.VoiceCommand)
         {
             VoiceCommandActivatedEventArgs args = (VoiceCommandActivatedEventArgs)e;
             Library.Command = args.Result.SemanticInterpretation.Properties["colour"].FirstOrDefault();
         }
     }
     catch { }
     Frame rootFrame = Window.Current.Content as Frame;
     if (rootFrame == null)
     {
         rootFrame = new Frame();
         rootFrame.NavigationFailed += OnNavigationFailed;
         Window.Current.Content = rootFrame;
     }
     if (rootFrame.Content == null)
     {
         rootFrame.Navigate(typeof(MainPage), e);
     }
     Window.Current.Activate();
 }
开发者ID:RoguePlanetoid,项目名称:Windows-10-Universal-Windows-Platform,代码行数:25,代码来源:App.xaml.cs


示例12: OnStartAsync

 public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
 {
     CoreApp.Initialize(Services.LocationServices.LocationService.Current, Services.DataServices.ProtoDataService.Current);
     await Task.Delay(500);
     NavigationService.Navigate(typeof(Views.MainPage));
     await Task.CompletedTask;
 }
开发者ID:RareNCool,项目名称:Renttracker,代码行数:7,代码来源:App.xaml.cs


示例13: OnStartAsync

        public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            GoogleAnalytics.EasyTracker.GetTracker().SendEvent("Lifecycle", startKind.ToString(), null, 0);
            bool isNewLaunch = args.PreviousExecutionState == ApplicationExecutionState.NotRunning;
            if (isNewLaunch)
            {
                await InitLibrary();

                var nav = new MergedNavigationService(NavigationService);
                nav.Configure(ViewModelLocator.SplashPageKey, typeof(Pages.SplashScreen));
                nav.Configure(ViewModelLocator.FrontPageKey, typeof(FrontPage));
                nav.Configure(ViewModelLocator.SubGalleryPageKey, typeof(SubGalleryPage));
                nav.Configure(ViewModelLocator.SubredditBrowserPageKey, typeof(SubredditBrowserPage));
                nav.Configure(ViewModelLocator.BrowserPageKey, typeof(BrowserPage));
                if (!SimpleIoc.Default.IsRegistered<GalaSoft.MvvmLight.Views.INavigationService>())
                    SimpleIoc.Default.Register<GalaSoft.MvvmLight.Views.INavigationService>(() => nav);
                SimpleIoc.Default.Register<IViewModelLocator>(() => ViewModelLocator.GetInstance());
                SimpleIoc.Default.Register<RemoteDeviceHelper>();
            }
            JObject navigationParam = new JObject();
            navigationParam["isNewLaunch"] = isNewLaunch;
            if (args is ProtocolActivatedEventArgs)
            {
                var protoArgs = args as ProtocolActivatedEventArgs;
                if (args.Kind == ActivationKind.Protocol)
                    navigationParam["url"] = protoArgs.Uri.AbsoluteUri;
            }
            Portable.Helpers.StateHelper.SessionState["LaunchData"] = navigationParam;
            SimpleIoc.Default.GetInstance<GalaSoft.MvvmLight.Views.INavigationService>().NavigateTo(ViewModelLocator.SplashPageKey);
        }
开发者ID:akshay2000,项目名称:MonocleGiraffe,代码行数:30,代码来源:App.xaml.cs


示例14: OnStartAsync

        public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            // long-running startup tasks go here

            NavigationService.Navigate(typeof(Views.MainPage));
            await Task.CompletedTask;
        }       
开发者ID:ericsnap,项目名称:Template10,代码行数:7,代码来源:App.xaml.cs


示例15: OnActivated

        protected override void OnActivated(IActivatedEventArgs args)
        {
            InitializeApp();

            // Was the app activated by a voice command?
            if (args.Kind == Windows.ApplicationModel.Activation.ActivationKind.VoiceCommand)
            {
                var commandArgs = args as Windows.ApplicationModel.Activation.VoiceCommandActivatedEventArgs;
                Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult = commandArgs.Result;

                // If so, get the name of the voice command and the values for the semantic properties from the grammar file
                string voiceCommandName = speechRecognitionResult.RulePath[0];
                var interpretation = speechRecognitionResult.SemanticInterpretation.Properties;
                IReadOnlyList<string> dictatedSearchTerms;
                interpretation.TryGetValue("dictatedSearchTerms", out dictatedSearchTerms);

                switch (voiceCommandName)
                {
                    case "NearMeSearch":
                        MainViewModel.SearchNearMeCommand.Execute(null);
                        break;

                    case "PlaceSearch":
                        MainViewModel.SearchTerm = dictatedSearchTerms[0];
                        MainViewModel.SearchTrailsCommand.Execute(null);
                        break;

                    default:
                        // There is no match for the voice command name.
                        break;
                }
            }
        }
开发者ID:vikramadhav,项目名称:AzureSearch-MVA,代码行数:33,代码来源:App.xaml.cs


示例16: ActivateInternal

        private async Task<bool> ActivateInternal(IActivatedEventArgs activatedEventArgs)
        {
            if (activatedEventArgs.Kind == ActivationKind.Search)
            {
                ISearchActivatedEventArgs searchEventArgs = (ISearchActivatedEventArgs)activatedEventArgs;

                // If the previous execution state was terminated then attempt to restore the navigation stack

                if (activatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated)
                    await _navigationManager.RestoreNavigationStack();

                // Otherwise if the application is a new instance navigate to the home page

                else if (activatedEventArgs.PreviousExecutionState == ApplicationExecutionState.ClosedByUser
                      || activatedEventArgs.PreviousExecutionState == ApplicationExecutionState.NotRunning)
                    _navigationManager.NavigateTo(_navigationManager.HomePageName);

                // Then display the search results

                DisplaySearchResults(searchEventArgs.QueryText, searchEventArgs.Language);

                return true;
            }

            return false;
        }
开发者ID:deepakpal9046,项目名称:Okra.Core,代码行数:26,代码来源:SearchManager.cs


示例17: Activate

 void Activate(IActivatedEventArgs e)
 {
     switch (e.Kind)
     {
         case ActivationKind.Launch:
             {
                 var args = e as ILaunchActivatedEventArgs;
                 if (args.PreviousExecutionState == ApplicationExecutionState.Running)
                     this.Frame.Navigate(typeof(Views.Splash));
                 else
                 {
                     // do not activate, let the splash activate itself
                     var page = new Views.Splash()
                     {
                         SplashScreen = args.SplashScreen,
                         Navigate = () => this.Frame.Navigate(typeof(Views.MainPage))
                     };
                     Window.Current.Content = page as UIElement;
                     page.Start();
                 }
                 break;
             }
         default:
             throw new NotImplementedException(e.Kind.ToString());
     }
 }
开发者ID:noriike,项目名称:xaml-106136,代码行数:26,代码来源:App.xaml.cs


示例18: OnStartAsync

        public override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            if (args.Kind == ActivationKind.VoiceCommand)
            {
                var result = (args as VoiceCommandActivatedEventArgs).Result;
                var properties = result.SemanticInterpretation.Properties
                    .ToDictionary(x => x.Key, x => x.Value);

                var command = result.RulePath.First();
                if (command.Equals("FreeTextCommand"))
                {
                    // get spoken text
                    var text = properties.First(x => x.Key.Equals("textPhrase")).Value[0];

                    // remember to handle response appropriately
                    var mode = properties.First(x => x.Key.Equals("commandMode")).Value;
                    if (mode.Equals("voice")) { /* okay to speak */ }
                    else { /* not okay to speak */ }

                    // update value
                    ViewModels.MainPageViewModel.Instance.Value = text;
                }
                else { /* unexpected command */ }
            }
            else
            {
                NavigationService.Navigate(typeof(Views.MainPage));
            }
			return Task.CompletedTask;
		}
开发者ID:Kryptryx,项目名称:Template10,代码行数:30,代码来源:App.xaml.cs


示例19: OnActivated

 protected override void OnActivated(IActivatedEventArgs args)
 {
     if (args.Kind == ActivationKind.ProtocolForResults)
     {
         ShowPage(typeof(ProtocolPage), args);
     }
 }
开发者ID:bospoort,项目名称:Win10UWPDemo,代码行数:7,代码来源:App.xaml.cs


示例20: OnActivated

        protected override void OnActivated(IActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            string uri = string.Empty;
            var protocolArgs = args as ProtocolActivatedEventArgs;
            if(protocolArgs != null)
            {
                uri = protocolArgs.Uri.ToString();
            }

            rootFrame.Navigate(typeof(ProtocolActivationPage), uri);

            // Ensure the current window is active
            Window.Current.Activate();
        }
开发者ID:mweilb,项目名称:SampleCode,代码行数:26,代码来源:App.xaml.cs



注:本文中的IActivatedEventArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IActivationContext类代码示例发布时间:2022-05-24
下一篇:
C# IActionScriptSerializer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap