コード例 #1
0
        private void btShare_Click(object sender, RoutedEventArgs e)
        {
            //if (showinfo.Visibility == Visibility.Visible) showinfo.Visibility = Visibility.Collapsed;

            DataTransferManager.ShowShareUI();
        }
コード例 #2
0
 void share(string format)
 {
     this.format = format;
     DataTransferManager.ShowShareUI();
 }
コード例 #3
0
 private void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #4
0
 /// <summary>
 /// Programmatically initiates the user interface for sharing content with another app.
 /// </summary>
 public void ShowShareUI()
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #5
0
 protected void ShowUIButton_Click(object sender, RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #6
0
 public void Share(string message, string title = "", ShareType shareType = ShareType.Sms)
 {
     _message = message;
     _title   = title;
     DataTransferManager.ShowShareUI();
 }
コード例 #7
0
 internal void ShareCurrentAsync()
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #8
0
 private void MenuFlyoutItem_Click_Share(object sender, RoutedEventArgs e)
 {
     item_ = (e.OriginalSource as FrameworkElement)?.DataContext as Items;
     DataTransferManager.ShowShareUI();
 }
コード例 #9
0
 public void SharePost()
 {
     GoogleAnalytics.EasyTracker.GetTracker().SendSocial("WhatsApp", "share", "");
     DataTransferManager.ShowShareUI();
 }
コード例 #10
0
 private void btnShare_Click(object sender, RoutedEventArgs e)
 {
     // share on facebook  title + description + duration
     DataTransferManager.GetForCurrentView().DataRequested += OnShareDataRequested;
     DataTransferManager.ShowShareUI();
 }
コード例 #11
0
        /// <summary>
        /// Executed when the Share Button is tapped from the Application bar. The app prepares content form the app to be shared using default installed apps on the phone.
        /// </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">RoutedEventArgs e is a parameter called e that contains the event data, see the RoutedEventArgs MSDN page for more information.</param>
        private void ShareButton_Click(object sender, RoutedEventArgs e)
        {
            var datacontext = (e.OriginalSource as FrameworkElement).DataContext;

            DataTransferManager.ShowShareUI();
        }
コード例 #12
0
 public void Share(string content)
 {
     _content = content;
     RegisterForShare();
     DataTransferManager.ShowShareUI();
 }
コード例 #13
0
ファイル: MainPage.xaml.cs プロジェクト: MrMYHuang/taq
 private void shareBtn_Click(Object sender, TappedRoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
     MySplitView.IsPaneOpen = false;
 }
コード例 #14
0
 public override void ShowShareUI()
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #15
0
ファイル: MainPage.xaml.cs プロジェクト: liuwd8/uwp
 private async void MenuFlyoutItem_Click_2(object sender, RoutedEventArgs e)
 {
     one.selectedItem = (sender as FrameworkElement).DataContext as Model.Class1;
     DataTransferManager.ShowShareUI();
 }
コード例 #16
0
ファイル: collection.xaml.cs プロジェクト: wuzimin/Bicycle
 private void share_button(object sender, RoutedEventArgs e)   // 分享
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #17
0
 private void shareButton_Tapped(object sender, TappedRoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #18
0
 void PlatformShare(DataPayload data)
 {
     this.data = data;
     DataTransferManager.ShowShareUI();
 }
コード例 #19
0
        public async Task ShareItemAsync(ReceivedShareItem item)
        {
            //PrepareData
            if (item == null)
            {
                return;
            }
            var defaultUri      = await App.CurrentAppUri;
            var sqt             = item?.Square30x30Logo?.GetRandowmAccessStreamAsync();
            var Square30x30Logo = sqt == null ? null : await sqt;
            var rbt             = item?.Thumbnail?.GetRandowmAccessStreamAsync();
            var Thumbnail       = rbt == null ? null : await rbt;;
            var fsitm           = item.AvialableShareItems.OfType <FilesShareItem>().FirstOrDefault();
            var files           = await GetStorageItemsAsync(fsitm);


            var dm = DataTransferManager.GetForCurrentView();

            TaskCompletionSource <object> dataTrasferedCompletion
                = new TaskCompletionSource <object>();


            using (Observable.FromEventPattern <TypedEventHandler <DataTransferManager, DataRequestedEventArgs>, DataRequestedEventArgs>
                       (eh => dm.DataRequested += eh,
                       eh => dm.DataRequested -= eh)
                   //.ObserveOnDispatcher()
                   .Subscribe(
                       e =>
            {
                var def = e.EventArgs.Request.GetDeferral();
                try
                {
                    //dataTrasferedCompletion.TrySetResult(null);
                    var r = e.EventArgs.Request;
                    var package = r.Data;
                    package.Properties.ContentSourceApplicationLink = item.ContentSourceApplicationLink ?? defaultUri;
                    package.Properties.ContentSourceWebLink = item.ContentSourceWebLink ?? defaultUri;
                    package.Properties.Description = item.Description;
                    package.Properties.PackageFamilyName = item.PackageFamilyName;
                    if (Square30x30Logo != null)
                    {
                        package.Properties.Square30x30Logo = RandomAccessStreamReference.CreateFromStream(Square30x30Logo);
                        package.Properties.LogoBackgroundColor = item.LogoBackgroundColor;
                    }
                    if (Thumbnail != null)
                    {
                        package.Properties.Thumbnail = RandomAccessStreamReference.CreateFromStream(Thumbnail);
                    }

                    //package.SetText(item.Text?? "Reshared by " + Windows.ApplicationModel.Package.Current.DisplayName);

                    package.Properties.Title = item.Title;
                    var order = item.AvialableShareItems.OrderBy(x => x is TextShareItem);
                    //make sure text share item execute last
                    foreach (var subShareItem in order)
                    {
                        FillPackage(files, package, subShareItem);
                    }
                }
                catch (Exception ex)
                {
                    e.EventArgs.Request.FailWithDisplayText(ex.Message);
                }
                finally
                {
                    def.Complete();
                }
            }
                       ))
            {
                DataTransferManager.ShowShareUI();
                await Task.WhenAny(Task.Delay(500), dataTrasferedCompletion.Task);
            }
        }
コード例 #20
0
ファイル: MainPage.xaml.cs プロジェクト: liuyh73/UWP_Develop
 private void MenuFlyoutShare_Click(object sender, RoutedEventArgs e)
 {
     ViewModel1.SelectedItem = (sender as MenuFlyoutItem).DataContext as ListItem;
     DataTransferManager.ShowShareUI();
 }
コード例 #21
0
 private void MenuFlyoutItem_Click_Share(object sender, RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #22
0
 static void ButtonClick(object sender, RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #23
0
        /// <summary>
        /// Share item via Share menu
        /// </summary>
        /// <param name="obj">Shared item</param>
        public async void ShareItemAsync(T item)
        {
            DataTransferManager daTranManaItem = DataTransferManager.GetForCurrentView();

            daTranManaItem.DataRequested += DaTranManaItem_DataRequested;

            string itemTypeName = item.GetType().Name;

            if (item == null)
            {
                return;
            }

            CurrentItem = item;

            // To-Do solve
            //var typeOfItemList = System.Enum.GetValues(typeof(ItemTypeEnum)).Cast<ItemTypeEnum>().ToList();

            var clone = (T)item.Clone();

            if (item.Secured)
            {
                clone.Name        = Crypting.Encrypt(item.Name);
                clone.Description = Crypting.Encrypt(item.Description);
            }

            var sharedData = new ItemStorage <T>
            {
                // To-Do solve
                //TypeOfItem = typeOfItemList[typeOfItemList.IndexOf(typeOfItemList.FirstOrDefault(x => x.ToString() == itemTypeName))],
                TypeOfItem = itemTypeName,
                Items      = new List <T>()
                {
                    clone
                }
            };

            try
            {
                XmlSerializer Serializ = new XmlSerializer(typeof(ItemStorage <T>));

                using (Stream XmlStream = ApplicationData.Current.LocalFolder.OpenStreamForWriteAsync(ShareFileItem, CreationCollisionOption.ReplaceExisting).GetAwaiter().GetResult())
                {
                    Serializ.Serialize(XmlStream, sharedData);
                }
            }
            catch (Exception e)
            {
                LogService.AddLogMessage(e.Message);
                throw new Base.Exceptions.Exception("Unhandled exception", e);
            }

            var shareFile = await ApplicationData.Current.LocalFolder.GetFileAsync(ShareFileItem);

            shareFileList = new List <StorageFile>
            {
                shareFile
            };

            DataTransferManager.ShowShareUI();
        }
 public void CompartilharTransacao()
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #25
0
 //点击分享按钮
 private void Share_Click(object sender, RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #26
0
 private void OnShareSong(object sender, RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #27
0
 private void share_button_Click(object sender, RoutedEventArgs e)
 {
     //分享得分
     DataTransferManager.ShowShareUI();
 }
コード例 #28
0
 private void sharePalette(object sender, RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
コード例 #29
0
        public virtual void ShareItem(RoutedEventArgs e)
        {
            DataTransferManager manager = DataTransferManager.GetForCurrentView();

            manager.DataRequested += new TypedEventHandler <DataTransferManager, DataRequestedEventArgs>(Manager_DataRequested);
            DataTransferManager.ShowShareUI(new ShareUIOptions
            {
                Theme = Enum.IsDefined(typeof(ShareUITheme), ThemeHelper.RootTheme.ToString()) ? (ShareUITheme)ThemeHelper.RootTheme : ShareUITheme.Default
            });

            async void Manager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
            {
                DataRequestDeferral dataRequestDeferral = args.Request.GetDeferral();
                List <IStorageItem> items       = new List <IStorageItem>();
                DataRequest         dataRequest = args.Request;

                /*dataRequest.Data.Properties.Title = "Data Shared From Files";
                 * dataRequest.Data.Properties.Description = "The items you selected will be shared";*/

                foreach (ListedItem item in SlimContentPage.SelectedItems)
                {
                    if (item.IsShortcutItem)
                    {
                        if (item.IsLinkItem)
                        {
                            dataRequest.Data.Properties.Title       = string.Format("ShareDialogTitle".GetLocalized(), items.First().Name);
                            dataRequest.Data.Properties.Description = "ShareDialogSingleItemDescription".GetLocalized();
                            dataRequest.Data.SetWebLink(new Uri(((ShortcutItem)item).TargetPath));
                            dataRequestDeferral.Complete();
                            return;
                        }
                    }
                    else if (item.PrimaryItemAttribute == StorageItemTypes.Folder)
                    {
                        if (await StorageItemHelpers.ToStorageItem <StorageFolder>(item.ItemPath, associatedInstance) is StorageFolder folder)
                        {
                            items.Add(folder);
                        }
                    }
                    else
                    {
                        if (await StorageItemHelpers.ToStorageItem <StorageFile>(item.ItemPath, associatedInstance) is StorageFile file)
                        {
                            items.Add(file);
                        }
                    }
                }

                if (items.Count == 1)
                {
                    dataRequest.Data.Properties.Title       = string.Format("ShareDialogTitle".GetLocalized(), items.First().Name);
                    dataRequest.Data.Properties.Description = "ShareDialogSingleItemDescription".GetLocalized();
                }
                else if (items.Count == 0)
                {
                    dataRequest.FailWithDisplayText("ShareDialogFailMessage".GetLocalized());
                    dataRequestDeferral.Complete();
                    return;
                }
                else
                {
                    dataRequest.Data.Properties.Title = string.Format("ShareDialogTitleMultipleItems".GetLocalized(), items.Count,
                                                                      "ItemsCount.Text".GetLocalized());
                    dataRequest.Data.Properties.Description = "ShareDialogMultipleItemsDescription".GetLocalized();
                }

                dataRequest.Data.SetStorageItems(items);
                dataRequestDeferral.Complete();

                // TODO: Unhook the event somewhere
            }
        }
コード例 #30
0
 private void Share_Click(object sender, RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
     Appbar.IsOpen = true;
 }