当前位置: 首页>>代码示例>>C#>>正文


C# IActivatedEventArgs类代码示例

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


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


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