Inheritance: IDataTransferManager
 private void ShareLinkHandler(DataTransferManager sender, DataRequestedEventArgs args)
 {
     DataRequest request = args.Request;
     request.Data.Properties.Title = "分享文章[来自UWP应用:知乎日报]";
     request.Data.Properties.Description = "向好友分享这篇文章";
     request.Data.SetWebLink(new Uri(_viewModel.ShareUrl));
 }
        private async void ShareLinkHandler(DataTransferManager sender, DataRequestedEventArgs e)
        {
            DataRequest request = e.Request;
            var uri = string.Format("http://www.last.fm/music/{0}/{1}", Locator.MusicPlayerVM.CurrentArtist?.Name, Locator.MusicPlayerVM.CurrentAlbum?.Name);
            var title = string.Format("#NowPlaying {0} - {1}", Locator.MusicPlayerVM.CurrentTrack?.Name, Locator.MusicPlayerVM.CurrentArtist?.Name);

            request.Data.Properties.Title = title;
            request.Data.Properties.Description = title;
            request.Data.SetWebLink(new Uri(uri, UriKind.Absolute));

            DataRequestDeferral deferral = request.GetDeferral();
            try
            {
                string fileName = string.Format("{0}.jpg", Locator.MusicPlayerVM.CurrentAlbum.Id);
                var albumPic = await ApplicationData.Current.LocalFolder.GetFolderAsync("albumPic");
                if (await albumPic.ContainsFileAsync(fileName))
                {
                    var file = await albumPic.GetFileAsync(fileName);
                    request.Data.SetStorageItems(new List<StorageFile> { file });
                }
            }
            catch
            {
                deferral.Complete();
            }
            finally
            {
                deferral.Complete();
            }
        }
Beispiel #3
0
		private void dataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
		{
			if (OnShareRequested != null)
			{
				OnShareRequested(args.Request.Data);
			}
		}
 private void ShareLinkHandler(DataTransferManager sender, DataRequestedEventArgs args)
 {
     DataRequest request = args.Request;
     request.Data.Properties.Title = "分享博客";
     request.Data.Properties.Description = "向好友分享这篇博客";
     request.Data.SetWebLink(new Uri(_blog.BlogRawUrl));
 }
Beispiel #5
0
        private void MessageLine_DataRequested(Windows.ApplicationModel.DataTransfer.DataTransferManager sender, Windows.ApplicationModel.DataTransfer.DataRequestedEventArgs args)
        {
            args.Request.Data.SetWebLink(hyperlinkManager.FirstLink);
            args.Request.Data.Properties.Title = Windows.ApplicationModel.Package.Current.DisplayName;

            DataTransferManager.GetForCurrentView().DataRequested -= MessageLine_DataRequested;
        }
        private void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
        {
            DataRequest request = e.Request;
            request.Data.Properties.Title = "كلام جرايد";

            request.Data.SetText("يقوم هذا البرنامج بتجميع الأخبار من مصادر متنوعة و تقسيمه حسب نوعه ويقوم بعرض العناوين الأخبار فى الصفحة الرئيسية و يقوم ايضا بعرض الخبر كامل من مصدره" + "\n" + (new Uri("ms-windows-store:navigate?appid=" + CurrentApp.AppId)).ToString());
        }
 private void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     DataRequest request = args.Request;
     var currentImage = dataContext.AlbumItem.AlbumImages[dataContext.SelectedIndex];
     request.Data.Properties.Title = currentImage.Title ?? dataContext.AlbumItem.Title;
     request.Data.SetWebLink(new Uri(currentImage.Link));
 }
        private void PageExplorerDataRequested(DataTransferManager sender,
           DataRequestedEventArgs args)
        {
            DataPackage data = args.Request.Data;

            DataRequestDeferral waiter = args.Request.GetDeferral();
            try
            {
                List<IStorageItem> files = new List<IStorageItem>();
                int index = 0;
                foreach (var item in itemGridView.SelectedItems)
                {
                    ExplorerItem explorerItem = (ExplorerItem)item;
                    if (explorerItem != null)
                    {
                        if (index == 0)
                        {
                            data.Properties.Title = explorerItem.Name;
                            RandomAccessStreamReference image = RandomAccessStreamReference.CreateFromFile(explorerItem.StorageFile);
                            data.Properties.Thumbnail = image;
                            data.SetBitmap(image);
                        }
                        files.Add(explorerItem.StorageFile);
                    }
                    index++;
                }
                data.SetStorageItems(files);
                data.SetText("\n");
            }
            finally
            {
                waiter.Complete();
            }
        }
 /// <summary>
 /// This is the text handler for the sharing purposes.
 /// </summary>
 /// <param name="sender">Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.</param>
 /// <param name="e">DataRequestedEventArgs e is a parameter called e that contains the event data, see the DataRequestedEventArgs MSDN page for more information.</param>
 public static void ShareTextHandler(DataTransferManager sender, DataRequestedEventArgs e)
 {
     DataRequest request = e.Request;
     request.Data.Properties.Title = "BuildmLearn Store";
     request.Data.Properties.Description = "BuildmLearn Store Share";
     request.Data.SetText("Share Text");
 }
 private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     if (HeyIsItOnVODModel != null)
     {
         HeyIsItOnVODModel.GetShareContent(args.Request);
     }
 }
        /// <summary>
        /// Instantiates the <see cref="RNShareModule"/>.
        /// </summary>
        internal RNShareModule()
        {
            _dataTransferManager = DataTransferManager.GetForCurrentView();
            _dataTransferManager.DataRequested += DataRequested;

            _queue = new Queue<RequestData>();
        }
        private void ShareTextHandler(DataTransferManager sender, DataRequestedEventArgs e)
        {
            try
            {
                DataRequest request = e.Request;
                // The Title is mandatory
#if WINDOWS_UWP
                request.Data.Properties.Title = title ?? Windows.ApplicationModel.Package.Current.DisplayName;
#elif WINDOWS_APP
                request.Data.Properties.Title = title ?? Windows.ApplicationModel.Package.Current.DisplayName;
#else
                request.Data.Properties.Title = title ?? string.Empty;

#endif

                if (!string.IsNullOrWhiteSpace(url))
                {
                  
                    request.Data.SetWebLink(new Uri(url));

                }
                request.Data.SetText(text ?? string.Empty);
            }
            catch(Exception ex)
            {
                Debug.WriteLine("Unable to share text: " + ex);
            }
        }
Beispiel #13
0
 private void OnShareRequested(DataTransferManager sender,
     DataRequestedEventArgs args)
 {
     DataPackage data = args.Request.Data;
     data.Properties.Title = _title;
     data.SetText(_content);
 }
        async void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
        {
            if (this.selectedTrip.LocalPathImage.Equals(loader.GetString("DefaultParentImage")))
            {
                await App.ShowSimpleMessage("You can't share the default trip image", "Sharing photo");
            }
            else
            {
                ParentViewModel trip = MainViewModel.GetSelectedTrip();

                DataPackage requestData = e.Request.Data;
                e.Request.Data.Properties.Title = trip.Title;
                e.Request.Data.Properties.Description = trip.Description;

                // It's recommended to use both SetBitmap and SetStorageItems for sharing a single image
                // since the target app may only support one or the other.
                Uri imageUri = new Uri(selectedTrip.LocalPathImage);

                List<IStorageItem> imageItems = new List<IStorageItem>();
                imageItems.Add(await StorageFile.GetFileFromApplicationUriAsync(imageUri));
                requestData.SetStorageItems(imageItems);

                RandomAccessStreamReference imageStreamRef = RandomAccessStreamReference.CreateFromUri(imageUri);
                requestData.Properties.Thumbnail = imageStreamRef;
                requestData.SetBitmap(imageStreamRef);
            }

        }
 private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     if (GoProFacebookModel != null)
     {
         GoProFacebookModel.GetShareContent(args.Request);
     }
 }
 private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     if (AthleteTipsModel != null)
     {
         AthleteTipsModel.GetShareContent(args.Request);
     }
 }
 void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
 {
     if (_dataRequested != null)
     {
         _dataRequested((DataTransferManager)sender, new SettableDataRequestedEventArgs(e));
     }
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            _dataTransferManager = DataTransferManager.GetForCurrentView();
            _dataTransferManager.DataRequested += OnDataRequested;

            base.OnNavigatedTo(e);
        }
 private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     if (SpecialOffersModel != null)
     {
         SpecialOffersModel.GetShareContent(args.Request);
     }
 }
 private void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     DataRequest request = args.Request;
     request.Data.Properties.Title = "【番剧】"+txt_Name.Text;
     request.Data.Properties.Description = txt_Desc.Text + "\r\n——分享自BiliBili UWP";
     request.Data.SetWebLink(new Uri("http://bangumi.bilibili.com/anime/" + banID));
 }
        private async void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
        {
            var vm = ((DashboardViewModel) DataContext);
            if ( vm.SelectedItem == null)
            {
                args.Request.FailWithDisplayText("You have not selected an item to share");
            }
            else
            {
                var deferral = args.Request.GetDeferral();
                var dataPackage = args.Request.Data;
                var propertySet = dataPackage.Properties;

                propertySet.Title = vm.SelectedItem.Name;
                propertySet.Description = vm.SelectedItem.ShortDescription;
                
                //ShareText(dataPackage, vm.SelectedItem.Name);

                //ShareUrl(dataPackage, "http://www.espn.com");

                await ShareFileAsync(vm, dataPackage, propertySet);

                deferral.Complete();
            }
        }
Beispiel #22
0
 private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     if (PolarProModel != null)
     {
         PolarProModel.GetShareContent(args.Request);
     }
 }
 void BlankPage_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     var request = args.Request;
     request.Data.Properties.Title = App.ViewModel.SelectedDocument.GetDisplayName();
     request.Data.Properties.Description = string.Format("Created {0}", App.ViewModel.SelectedDocument.GetCreatedDate().ToString("g"));
     request.Data.SetText(_GetCurrentDocumentText());
 }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            _dataTransferManager = DataTransferManager.GetForCurrentView();
            _dataTransferManager.DataRequested += OnDataRequested;

            _navigationHelper.OnNavigatedTo(e);

            if (InstagramModel != null)
            {
                await InstagramModel.LoadItemsAsync();
                InstagramModel.SelectItem(e.Parameter);

                InstagramModel.ViewType = ViewTypes.Detail;
            }
            DataContext = this;

            // Allow this page to rotate
            _currentOrientations = DisplayInformation.AutoRotationPreferences;
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait
                                                        | DisplayOrientations.Landscape
                                                        | DisplayOrientations.LandscapeFlipped
                                                        | DisplayOrientations.PortraitFlipped;

            // Handle orientation changes
            DisplayInformation.GetForCurrentView().OrientationChanged += this.OnOrientationChanged;
            this.TransitionStoryboardState();
        }
 private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
     args.Request.Data.SetText(
         $"{loader.GetString("SendMeFriendRequest/Text")} {_link} {Environment.NewLine} {loader.GetString("SentFromPlayStationApp/Text")}");
     args.Request.Data.Properties.Title = loader.GetString("InviteFriendsToPsn/Text");
 }
Beispiel #26
0
        private void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
        {
            DataRequest request = e.Request;
            request.Data.Properties.Title = "";

            request.Data.SetText("this app help you to know the best 10 programming languages of every year and learn them by many ways ( books or totrail ) and offer to you all the matraile" + "\n" + (new Uri("ms-windows-store:navigate?appid=" + CurrentApp.AppId)).ToString());
        }
 private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     if (YouTubeChannelModel != null)
     {
         YouTubeChannelModel.GetShareContent(args.Request);
     }
 }
Beispiel #28
0
 /// The methods provided in this section are simply used to allow
 /// NavigationHelper to respond to the page's navigation methods.
 /// 
 /// Page specific logic should be placed in event handlers for the  
 /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
 /// and <see cref="GridCS.Common.NavigationHelper.SaveState"/>.
 /// The navigation parameter is available in the LoadState method 
 /// in addition to page state preserved during an earlier session.
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     _dataTransferManager = DataTransferManager.GetForCurrentView();
     _dataTransferManager.DataRequested += OnDataRequested;
     _navigationHelper.OnNavigatedTo(e);
     await MainViewModel.LoadData(NetworkInterface.GetIsNetworkAvailable());
 }
        private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs e)
        {
            string dataPackageTitle = TitleInputBox.Text;

            // The title is required.
            if (!String.IsNullOrEmpty(dataPackageTitle))
            {
                string dataPackageText = TextToShare.Text;
                if (!String.IsNullOrEmpty(dataPackageText))
                {
                    DataPackage requestData = e.Request.Data;
                    requestData.Properties.Title = dataPackageTitle;

                    // The description is optional.
                    string dataPackageDescription = DescriptionInputBox.Text;
                    if (dataPackageDescription != null)
                    {
                        requestData.Properties.Description = dataPackageDescription;
                    }
                    requestData.SetText(dataPackageText);
                }
                else
                {
                    e.Request.FailWithDisplayText("Enter the text you would like to share and try again.");
                }
            }
            else
            {
                e.Request.FailWithDisplayText(MainPage.MissingTitleError);
            }
        }
Beispiel #30
0
        private async void App_DataRequested(Windows.ApplicationModel.DataTransfer.DataTransferManager sender, Windows.ApplicationModel.DataTransfer.DataRequestedEventArgs args)
        {
            if (_deckToShare != null)
            {
                args.Request.Data.Properties.Title       = "Sharing Dragon Front Deck";
                args.Request.Data.Properties.Description = _deckToShare.Name;

                DataRequestDeferral deferral = args.Request.GetDeferral();

                try
                {
                    if (string.IsNullOrEmpty(_deckToShare.FilePath))
                    {
                        _deckToShare = await SimpleIoc.Default.GetInstance <IDeckService>().SaveDeckAsync(_deckToShare);

                        if (_deckToShare == null)
                        {
                            return;
                        }
                    }

                    var file = await StorageFile.GetFileFromPathAsync(_deckToShare.FilePath);

                    var list = new List <StorageFile>();
                    list.Add(file);
                    args.Request.Data.SetStorageItems(list);
                }
                catch (Exception) { }
                finally
                {
                    deferral.Complete();
                }
            }
        }
        private async void ShareStorageItemsHandler(DataTransferManager sender,
            DataRequestedEventArgs e)
        {
            var request = e.Request;
            request.Data.Properties.Title = AppResourcesHelper.Get("Export_FileTitle");
            request.Data.Properties.Description = ApplicationResourcesHelper.Get("CATROBAT_URL");
            var deferral = request.GetDeferral();

            try
            {
                var rootFolder = ApplicationData.Current.LocalFolder;
                var fileToShare = await rootFolder.GetFileAsync(_pathToShareFile);
                var storageItems = new List<IStorageItem> { fileToShare };
                request.Data.SetStorageItems(storageItems);
            }
            catch
            {
                if (Debugger.IsAttached)
                    Debugger.Break();
            }
            finally
            {
                deferral.Complete();
            }
        }
 private void ShareLinkHandler(DataTransferManager sender, DataRequestedEventArgs e)
 {
     DataRequest request = e.Request;
     request.Data.Properties.Title = "Title";
     request.Data.Properties.Description = "Description";
     request.Data.SetWebLink(new Uri(""+ Windows.ApplicationModel.Store.CurrentApp.LinkUri));
 }
Beispiel #33
0
        void ShareSource_Loaded(object sender, RoutedEventArgs e)
        {
            this.pane = SettingsPane.GetForCurrentView();
            this.pane.CommandsRequested += OnSettingsCommandsRequested;

            this.currentDataTransferManager = DataTransferManager.GetForCurrentView();
            this.currentDataTransferManager.DataRequested += currentDataTransferManager_DataRequested;

            SystemClipboard.ContentChanged += SystemClipboard_ContentChanged;
        }
Beispiel #34
0
 /// <summary>
 /// Give Data for Windows Share
 /// </summary>
 private void EmbedControl_DataRequested(Windows.ApplicationModel.DataTransfer.DataTransferManager sender, Windows.ApplicationModel.DataTransfer.DataRequestedEventArgs args)
 {
     if (!string.IsNullOrEmpty(EmbedContent.Url))
     {
         args.Request.Data.SetText(EmbedContent.Url);
         args.Request.Data.Properties.Title = Windows.ApplicationModel.Package.Current.DisplayName;
     }
     else
     {
         args.Request.FailWithDisplayText("Nothing to share");
     }
 }
Beispiel #35
0
        private async void Share(object sender, RoutedEventArgs e)
        {
            await SetContent();

            DataTransferManager.ShowShareUI();

            //if (ApplicationView.Value != ApplicationViewState.Snapped)
            //{
            //}
            //else if (ApplicationView.TryUnsnap())
            //{
            //    await this.Dispatcher.RunIdleAsync(args => DataTransferManager.ShowShareUI());
            //}
        }
Beispiel #36
0
        private void DataRequested(DataTransfer.DataTransferManager sender, DataTransfer.DataRequestedEventArgs e)
        {
            if (_title != null)
            {
                e.Request.Data.Properties.Title = _title;
            }
            if (_text != null)
            {
                e.Request.Data.SetText(_text);
            }
            if (_url != null)
            {
                e.Request.Data.SetUri(new Uri(_url));
            }

            _dataTransferManager.DataRequested -= DataRequested;
        }
Beispiel #37
0
        private void currentDataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
        {
            this.ErrorText.Text = "";
            var deferral = args.Request.GetDeferral();

            try
            {
                values.CopyTo(args.Request.Data);
            }
            catch (Exception ex)
            {
                this.SetErrorMessage(ex.Message);
                args.Request.FailWithDisplayText(ex.Message);
                this.copied = false;
            }
            finally
            {
                deferral.Complete();
            }
        }
Beispiel #38
0
 public ShareHandlerStorage(DataTransferManager manager, Func <IAsyncOperation <DataPackage> > dataPackageProvider, AsyncAction action)
 {
     this.dataPackageProvider = dataPackageProvider;
     manager.DataRequested   += this.T_DataRequested;
     this.action = action;
 }
Beispiel #39
0
 /// <summary>
 /// Instantiates the <see cref="ShareModule"/>.
 /// </summary>
 internal ShareModule()
 {
     _dataTransferManager = DataTransfer.DataTransferManager.GetForCurrentView();
 }
Beispiel #40
0
        void MainPage_DataRequested(Windows.ApplicationModel.DataTransfer.DataTransferManager sender, Windows.ApplicationModel.DataTransfer.DataRequestedEventArgs args)
        {
            args.Request.Data.SetText("https://maps.google.com/maps?q=" + ShareLocation.Latitude.ToString() + "," + ShareLocation.Longitude.ToString());

            args.Request.Data.Properties.Title = ShareName;
        }