Пример #1
0
 protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
 {
     await InternalActivatedAsync(args);
 }
Пример #2
0
        protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs e)
        {
            if (Helper.DontUseTimersAndOtherStuff)
            {
                return;
            }
            try
            {
                if (DeviceUtil.IsXbox)
                {
                    Helper.FullscreenModeInXbox();
                }
            }
            catch { }
            try
            {
                Frame rootFrame = CreateRootFrame();
                var   isNull    = false;
                var   isRunning = false;
                if (rootFrame.Content == null)
                {
                    isRunning = isNull = true;
                    rootFrame.NavigationFailed += OnNavigationFailed;
                    if (e.PreviousExecutionState != ApplicationExecutionState.Running)
                    {
                        SplashView extendedSplash = new SplashView(e.SplashScreen);
                        rootFrame.Content      = extendedSplash;
                        Window.Current.Content = rootFrame;
                    }
                    else
                    {
                        SplashView extendedSplash = new SplashView(e.SplashScreen);
                        rootFrame.Content      = extendedSplash;
                        Window.Current.Content = rootFrame;
                    }
                    Window.Current.Content = rootFrame;
                }
                Window.Current.Activate();
                if (isNull)
                {
                    await Task.Delay(6500);
                }
                try
                {
                    ShareOperation shareOperation = e.ShareOperation;
                    if (shareOperation.Data.Contains(StandardDataFormats.StorageItems))
                    {
                        var items = await shareOperation.Data.GetStorageItemsAsync();

                        if (items.Count > 0)
                        {
                            if (items[0] is StorageFile file)
                            {
                                MainPage.Current?.HandleUriFile(file);
                            }
                        }
                    }
                }
                catch { }
            }
            catch { }
        }
Пример #3
0
 protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
 {
     await ActivationService.ActivateFromShareTargetAsync(args);
 }
Пример #4
0
 protected override sealed void OnShareTargetActivated(ShareTargetActivatedEventArgs e)
 {
     DebugWrite(); StartupOrchestratorAsync(e, StartKind.Activate);
 }
Пример #5
0
 protected override sealed async void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
 {
     DebugWrite(); await InternalActivatedAsync(args);
 }
Пример #6
0
 protected override sealed async void OnShareTargetActivated(ShareTargetActivatedEventArgs e) => await InternalStartAsync(new StartArgs(e, StartKinds.Activate));
Пример #7
0
 protected sealed override async void OnShareTargetActivated(ShareTargetActivatedEventArgs e)
 {
     this.DebugWriteMessage(); await InternalActivatedAsync(e);
 }
Пример #8
0
 protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
 {
     ShareTargetViewModel.ShareOperation = args.ShareOperation;
     DisplayRootViewFor <ShareTargetViewModel>();
 }
        /// <summary>
        /// Invoked when another application wants to share content through this application.
        /// </summary>
        /// <param name="args">Activation data used to coordinate the process with Windows.</param>
        public async void Activate(ShareTargetActivatedEventArgs args)
        {
            _shareOperation = args.ShareOperation;

            // Communicate metadata about the shared content through the view model
            DataPackagePropertySetView shareProperties = _shareOperation.Data.Properties;
            var thumbnailImage = new BitmapImage();

            DefaultViewModel["Title"]           = shareProperties.Title;
            DefaultViewModel["Description"]     = shareProperties.Description;
            DefaultViewModel["Image"]           = thumbnailImage;
            DefaultViewModel["Sharing"]         = false;
            DefaultViewModel["ShowImage"]       = false;
            DefaultViewModel["Comment"]         = String.Empty;
            DefaultViewModel["SupportsComment"] = true;
            Window.Current.Content = this;
            Window.Current.Activate();

            // Update the shared content's thumbnail image in the background
            if (shareProperties.Thumbnail != null)
            {
                var stream = await shareProperties.Thumbnail.OpenReadAsync();

                thumbnailImage.SetSource(stream);
                DefaultViewModel["ShowImage"] = true;
            }

            DefaultViewModel["ShowBlog"] = false;

            const string BLOG_POST = "http://schema.org/BlogPosting";

            if (!_shareOperation.Data.Contains(BLOG_POST))
            {
                return;
            }

            var data = await _shareOperation.Data.GetDataAsync(BLOG_POST);

            if (data == null)
            {
                return;
            }

            DefaultViewModel["ShowBlog"] = true;
            DefaultViewModel["BlogPost"] = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType((string)data,
                                                                                                new
            {
                type       = "http://shema.org/BlogPosting",
                properties = new
                {
                    description   = string.Empty,
                    image         = new Uri("http://schema.org/"),
                    name          = string.Empty,
                    url           = new Uri("http://schema.org/"),
                    audience      = "Windows 8 Developers",
                    datePublished = DateTime.Now,
                    headline      = string.Empty,
                    articleBody   = string.Empty
                }
            });
        }
Пример #10
0
        protected override void OnShareTargetActivated( ShareTargetActivatedEventArgs args )
        {
            Contract.Assume( args != null );

            IServiceProvider serviceProvider = Host;

            if ( serviceProvider == null )
                return;

            IEventBroker eventBroker;

            // publish search event for the entire application
            if ( !serviceProvider.TryGetService( out eventBroker ) )
                return;

            var e = new ShareEventArgs( args.PreviousExecutionState, args.ShareOperation );
            eventBroker.Publish( "Share", null, e );
        }
 public void ShareTargetActivate(ShareTargetActivatedEventArgs e)
 {
     EventDispatcher.Dispatch(() => Activated?.Invoke(this, e));
 }
Пример #12
0
        protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
        {
            var shareTargetPage = new ShareTargetView();

            shareTargetPage.Activate(args);
        }