public static DataTransferManager getTransferManager()
    {
        if(dataTransferManager == null)
        {
            dataTransferManager = new DataTransferManager();
        }

        return dataTransferManager;
    }
 public TransactionCreationViewModel()
 {
     DataTransferManager.GetForCurrentView().DataRequested += EditarTransacaoViewModel_DataRequested;
 }
Example #3
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            DataTransferManager.GetForCurrentView().DataRequested += FilmDetails_DataRequested;

            this.AllowSearch(false);

            PlayToManager.GetForCurrentView().SourceRequested += PlayToManagerOnSourceRequested;

            bool bError = false;

            try
            {
                SpinAndWait(true);

                this.piPoster.Source = new BitmapImage(SelectedFilm.PosterUrl);

                this.bcTitle.ViewTitle = String.Format("{0} at Cineworld {1}", SelectedFilm.TitleWithClassification, SelectedCinema.Name);

                if (!Config.ShowCleanBackground)
                {
                    if (SelectedFilm.BackdropUrl != null)
                    {
                        this.LayoutRoot.Background = new ImageBrush()
                        {
                            ImageSource = new BitmapImage(SelectedFilm.BackdropUrl),
                            Opacity     = 0.2,
                            Stretch     = Stretch.UniformToFill
                        };
                    }
                    else
                    {
                        string uri = (SelectedFilm.PosterImage.AbsoluteUri);
                        if (uri.Contains("w500"))
                        {
                            uri = uri.Replace("w500", "original");
                            this.LayoutRoot.Background = new ImageBrush()
                            {
                                ImageSource = new BitmapImage(new Uri(uri)),
                                Opacity     = 0.2,
                                Stretch     = Stretch.UniformToFill
                            };
                        }
                    }
                }

                this.DataContext = this;

                if (ShowCinemaDetails)
                {
                    await this.LoadCinemaDetails();

                    this.spCinemaButtons.Visibility = Windows.UI.Xaml.Visibility.Visible;
                }

                if (ShowFilmDetails)
                {
                    await this.LoadFilmDetails();

                    this.spFilmButtons.Visibility = Windows.UI.Xaml.Visibility.Visible;
                }

                PerformanceData perfData = new PerformanceData(SelectedFilm.Performances);
                this.cvsShowByDate.Source = perfData.GroupsByDate;

                semanticZoomShowByDate.ViewChangeStarted -= semanticZoom_ViewChangeStarted;
                semanticZoomShowByDate.ViewChangeStarted += semanticZoom_ViewChangeStarted;

                (semanticZoomShowByDate.ZoomedOutView as ListViewBase).ItemsSource = perfData.PerformanceHeaders;
            }
            catch
            {
                bError = true;
            }

            if (bError)
            {
                await new MessageDialog("Error downloading showtime data").ShowAsync();
            }

            SpinAndWait(false);
        }
Example #4
0
 private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     ViewModel.ShareContent(args.Request);
 }
Example #5
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     dataTransferManager = DataTransferManager.GetForCurrentView();
     dataTransferManager.DataRequested += new TypedEventHandler <DataTransferManager, DataRequestedEventArgs>(DataRequested);
 }
Example #6
0
 public ShareImageResultsMessage(ImageResult image, DataTransferManager sender, SettableDataRequestedEventArgs args)
     : base(sender, args)
 {
     Image = image;
 }
Example #7
0
 public static DeploymentManager InitDeploymentManager(ActorSystem actorSystem, string connectionString, DataTransferManager manager, RepositoryApi api)
 => InitDeploymentManager(actorSystem, new MongoClient(connectionString), manager, api);
Example #8
0
 protected override void OnNavigatedFrom(NavigationEventArgs e)
 {
     navigationHelper.OnNavigatedFrom(e);
     // Deregister the DataRequested event handler
     DataTransferManager.GetForCurrentView().DataRequested -= OnDataRequested;
 }
Example #9
0
 // 分享记录
 private void shareRecord(object sender, RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
Example #10
0
        public SharingService()
        {
            var dataTransferManager = DataTransferManager.GetForCurrentView();

            dataTransferManager.DataRequested += DataTransferManager_DataRequested;
        }
Example #11
0
 public geekParkNewsPage()
 {
     this.InitializeComponent();
     PergeekParkNewsWebView.Navigate(new Uri(cnBeta.per_news_url));
     DataTransferManager.GetForCurrentView().DataRequested += ShareRequested;
 }
 void PlatformShare(DataPayload data)
 {
     this.data = data;
     DataTransferManager.ShowShareUI();
 }
 void PlatformStart()
 {
     transferManager = DataTransferManager.GetForCurrentView();
     transferManager.DataRequested           += OnDataRequested;
     transferManager.ShareProvidersRequested += OnShareProvidersRequested;
 }
 public MovieWebPage()
 {
     this.InitializeComponent();
     var shareManager = DataTransferManager.GetForCurrentView();
 }
Example #15
0
 public static List <ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(BaseLayoutCommandsViewModel commandsViewModel, List <ListedItem> selectedItems, SelectedItemsPropertiesViewModel selectedItemsPropertiesViewModel)
 {
     return(new List <ContextMenuFlyoutItemViewModel>()
     {
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutRestore/Text".GetLocalized(),
             Glyph = "\uE8E5",
             Command = commandsViewModel.RestoreItemCommand,
             ShowInRecycleBin = true,
             ShowItem = selectedItems.All(x => x.IsRecycleBinItem)
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutOpenItem/Text".GetLocalized(),
             Glyph = "\uE8E5",
             Command = commandsViewModel.OpenItemCommand,
             IsPrimary = true,
             ShowItem = selectedItems.Count <= 10,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutCreateFolderWithSelection/Text".GetLocalized(),
             Glyph = "\uE1DA",
             Command = commandsViewModel.CreateFolderWithSelection,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutOpenItemWith/Text".GetLocalized(),
             Glyph = "\uE17D",
             Command = commandsViewModel.OpenItemWithApplicationPickerCommand,
             ShowItem = selectedItems.All(i => i.PrimaryItemAttribute == Windows.Storage.StorageItemTypes.File && !i.IsShortcutItem),
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutOpenFileLocation/Text".GetLocalized(),
             Glyph = "\uE8DA",
             Command = commandsViewModel.OpenFileLocationCommand,
             ShowItem = selectedItems.All(i => i.IsShortcutItem),
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutOpenInNewPane/Text".GetLocalized(),
             Glyph = "\uF57C",
             Command = commandsViewModel.OpenDirectoryInNewPaneCommand,
             ShowItem = App.AppSettings.IsDualPaneEnabled && selectedItems.All(i => i.PrimaryItemAttribute == Windows.Storage.StorageItemTypes.Folder),
             SingleItemOnly = true,
             IsPrimary = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutOpenInNewTab/Text".GetLocalized(),
             Glyph = "\uEC6C",
             Command = commandsViewModel.OpenDirectoryInNewTabCommand,
             ShowItem = selectedItems.Count < 5 && selectedItems.All(i => i.PrimaryItemAttribute == Windows.Storage.StorageItemTypes.Folder),
             IsPrimary = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutOpenInNewWindow/Text".GetLocalized(),
             Glyph = "\uE737",
             Command = commandsViewModel.OpenInNewWindowItemCommand,
             ShowItem = selectedItems.Count < 5 && selectedItems.All(i => i.PrimaryItemAttribute == Windows.Storage.StorageItemTypes.Folder),
             IsPrimary = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutSetAs/Text".GetLocalized(),
             ShowItem = selectedItemsPropertiesViewModel.IsSelectedItemImage,
             Items = new List <ContextMenuFlyoutItemViewModel>()
             {
                 new ContextMenuFlyoutItemViewModel()
                 {
                     Text = "BaseLayoutItemContextFlyoutSetAsDesktopBackground/Text".GetLocalized(),
                     Glyph = "\uE91B",
                     Command = commandsViewModel.SetAsDesktopBackgroundItemCommand,
                 },
                 new ContextMenuFlyoutItemViewModel()
                 {
                     Text = "BaseLayoutItemContextFlyoutSetAsLockscreenBackground/Text".GetLocalized(),
                     Glyph = "\uF114",
                     GlyphFontFamilyName = "CustomGlyph",
                     Command = commandsViewModel.SetAsLockscreenBackgroundItemCommand,
                 },
             }
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutContextFlyoutRunAsAdmin/Text".GetLocalized(),
             Glyph = "\uE7EF",
             Command = commandsViewModel.RunAsAdminCommand,
             ShowItem = new string[] { ".bat", ".exe", "cmd" }.Contains(selectedItems.FirstOrDefault().FileExtension)
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutContextFlyoutRunAsAnotherUser/Text".GetLocalized(),
             Glyph = "\uE7EE",
             Command = commandsViewModel.RunAsAnotherUserCommand,
             ShowItem = new string[] { ".bat", ".exe", "cmd" }.Contains(selectedItems.FirstOrDefault().FileExtension)
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "ContextMenuMoreItemsLabel".GetLocalized(),
             Glyph = "\xE712",
             ID = "ItemOverflow"
         },
         new ContextMenuFlyoutItemViewModel()
         {
             ItemType = ItemType.Separator,
             ShowInRecycleBin = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutCut/Text".GetLocalized(),
             Glyph = "\uE8C6",
             Command = commandsViewModel.CutItemCommand,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutCopy/Text".GetLocalized(),
             Glyph = "\uE8C8",
             Command = commandsViewModel.CopyItemCommand,
             ShowInRecycleBin = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutCopyLocation/Text".GetLocalized(),
             Glyph = "\uE167",
             Command = commandsViewModel.CopyPathOfSelectedItemCommand,
             SingleItemOnly = true,
             IsPrimary = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutContextFlyoutPaste/Text".GetLocalized(),
             Glyph = "\uE16D",
             Command = commandsViewModel.PasteItemsFromClipboardCommand,
             ShowItem = selectedItems.All(x => x.PrimaryItemAttribute == StorageItemTypes.Folder),
             SingleItemOnly = true,
             IsEnabled = App.InteractionViewModel.IsPasteEnabled,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutShortcut/Text".GetLocalized(),
             Glyph = "\uF10A",
             GlyphFontFamilyName = "CustomGlyph",
             Command = commandsViewModel.CreateShortcutCommand,
             ShowItem = !selectedItems.FirstOrDefault().IsShortcutItem,
             SingleItemOnly = true,
             IsPrimary = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutDelete/Text".GetLocalized(),
             Glyph = "\uE74D",
             Command = commandsViewModel.DeleteItemCommand,
             KeyboardAccelerator = new KeyboardAccelerator()
             {
                 Key = Windows.System.VirtualKey.Delete
             },
             ShowInRecycleBin = true,
             IsPrimary = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutRename/Text".GetLocalized(),
             Glyph = "\uE8AC",
             Command = commandsViewModel.RenameItemCommand,
             KeyboardAccelerator = new KeyboardAccelerator()
             {
                 Key = Windows.System.VirtualKey.F2
             },
             SingleItemOnly = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutShare/Text".GetLocalized(),
             Glyph = "\uE72D",
             Command = commandsViewModel.ShareItemCommand,
             ShowItem = DataTransferManager.IsSupported() && !selectedItems.Any(i => i.IsHiddenItem),
             IsPrimary = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutPinToSidebar/Text".GetLocalized(),
             Glyph = "\uE840",
             Command = commandsViewModel.SidebarPinItemCommand,
             ShowItem = selectedItems.All(x => x.PrimaryItemAttribute == StorageItemTypes.Folder && !x.IsPinned),
             IsPrimary = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutContextFlyoutUnpinDirectoryFromSidebar/Text".GetLocalized(),
             Glyph = "\uE77A",
             Command = commandsViewModel.SidebarUnpinItemCommand,
             ShowItem = selectedItems.All(x => x.PrimaryItemAttribute == StorageItemTypes.Folder && x.IsPinned),
             IsPrimary = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "PinItemToStart/Text".GetLocalized(),
             Glyph = "\uE840",
             Command = commandsViewModel.PinItemToStartCommand,
             ShowOnShift = true,
             ShowItem = selectedItems.All(x => x.PrimaryItemAttribute == StorageItemTypes.Folder && !x.IsItemPinnedToStart),
             SingleItemOnly = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "UnpinItemFromStart/Text".GetLocalized(),
             Glyph = "\uE77A",
             Command = commandsViewModel.UnpinItemFromStartCommand,
             ShowOnShift = true,
             ShowItem = selectedItems.All(x => x.PrimaryItemAttribute == StorageItemTypes.Folder && x.IsItemPinnedToStart),
             SingleItemOnly = true,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutProperties/Text".GetLocalized(),
             Glyph = "\uE946",
             Command = commandsViewModel.ShowPropertiesCommand,
         },
         new ContextMenuFlyoutItemViewModel()
         {
             Text = "BaseLayoutItemContextFlyoutQuickLook/Text".GetLocalized(),
             BitmapIcon = new BitmapImage(new Uri("ms-appx:///Assets/QuickLook/quicklook_icon_black.png")),
             Command = commandsViewModel.QuickLookCommand,
             ShowItem = App.InteractionViewModel.IsQuickLookEnabled,
             SingleItemOnly = true,
         },
     });
 }
Example #16
0
        /// 此部分中提供的方法只是用于使
        /// NavigationHelper 可响应页面的导航方法。
        ///
        /// 应将页面特有的逻辑放入用于
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// 和 <see cref="GridCS.Common.NavigationHelper.SaveState"/> 的事件处理程序中。
        /// 除了在会话期间保留的页面状态之外
        /// LoadState 方法中还提供导航参数。


        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            navigationHelper.OnNavigatedTo(e);
            // Register for DataRequested events
            DataTransferManager.GetForCurrentView().DataRequested += OnDataRequested;
        }
Example #17
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            //如果页面可以回退,则显示回退按钮
            if (rootFrame.CanGoBack)
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    AppViewBackButtonVisibility.Visible;
                SystemNavigationManager.GetForCurrentView().BackRequested += goBackToLastPage;
            }
            else
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    AppViewBackButtonVisibility.Collapsed;
            }

            currentRecord = ((Model.Record)e.Parameter);
            if (currentRecord.favoriteNum == "-1")
            {
                isEdit = true;
                currentRecord.favoriteNum = "0";
            }
            //await (new MessageDialog(currentRecord.audio)).ShowAsync();

            //同步顶栏信息
            avatarInTopBar.ImageSource = currentRecord.userAvatar;
            publisher.Text             = currentRecord.nickname;

            //同步宽屏标题、文字信息
            title1.Text   = currentRecord.title;
            content1.Text = currentRecord.content;
            //同步窄屏标题、文字信息
            title2.Text   = currentRecord.title;
            content2.Text = currentRecord.content;

            //判断是否显示图片、音频、视频
            if (currentRecord.image != "")
            {
                image1.Visibility = Visibility.Visible; //宽屏
                image2.Visibility = Visibility.Visible; //窄屏

                BitmapImage newSource  = null;
                string      _newSource = Helper.NetworkHelper.SERVER + currentRecord.image;
                newSource     = new BitmapImage(new Uri(_newSource));
                image1.Source = image2.Source = newSource;
            }
            if (currentRecord.audio != "")
            {
                //宽屏
                player1.Visibility = Visibility.Visible;

                //窄屏
                player2.Visibility = Visibility.Visible;
                string newSource = Helper.NetworkHelper.SERVER + currentRecord.audio;
                player1.Source = MediaSource.CreateFromUri(new Uri(newSource, UriKind.Absolute));
                player2.Source = MediaSource.CreateFromUri(new Uri(newSource, UriKind.Absolute));
            }
            if (currentRecord.video != "")
            {
                //宽屏
                player1.Visibility = Visibility.Visible;

                //窄屏
                player2.Visibility = Visibility.Visible;

                string newSource = Helper.NetworkHelper.SERVER + currentRecord.video;
                player1.Source = MediaSource.CreateFromUri(new Uri(newSource, UriKind.Absolute));
                player2.Source = MediaSource.CreateFromUri(new Uri(newSource, UriKind.Absolute));
            }
            //同步点赞数
            favoriteNum.Text = currentRecord.favoriteNum;
            //解析点赞头像组
            JObject res = await Helper.NetworkHelper.recordDetail(currentRecord.id);

            if (res["result"].ToString() == Helper.NetworkHelper.SUCCESS)
            {
                JObject records    = JObject.Parse(res["record"].ToString());
                JArray  favoriters = JArray.Parse(records["favoriter"].ToString());

                gridView.IsItemClickEnabled = false;
                gridView.Name   = "gridView";
                gridView.Margin = new Thickness(30, 0, 0, 0);
                for (int i = 0; i < favoriters.Count; ++i)
                {
                    string     _newFavoriter = Helper.NetworkHelper.SERVER + favoriters[i].ToString();
                    Ellipse    ellipse       = new Ellipse();
                    ImageBrush newFavoriter  = new ImageBrush();
                    newFavoriter.ImageSource = new BitmapImage(new Uri(_newFavoriter));
                    ellipse.Fill             = newFavoriter;
                    ellipse.Height           = ellipse.Width = 60;
                    gridView.Items.Add(ellipse);
                }
                // Add the grid view to a parent container in the visual tree.
                likeList.Children.Add(gridView);
                //获取更详细的发布时间
                publishTime.Text = records["date"].ToString();
            }

            dataTransferManager = DataTransferManager.GetForCurrentView();
            dataTransferManager.DataRequested += dataRequested;
        }
Example #18
0
 public static DeploymentManager CreateInstance(IActorRefFactory factory, string connectionString, DataTransferManager manager, RepositoryApi api)
 => new DeploymentManager(factory.ActorOf(Props.Create(() => new DeploymentServerImpl(new MongoClient(connectionString), manager, api)), DeploymentApi.DeploymentPath));
Example #19
0
 protected override void OnNavigatedFrom(NavigationEventArgs e)
 {
     DataTransferManager.GetForCurrentView().DataRequested -= OnShareDataRequested;
 }
Example #20
0
        public static DeploymentManager InitDeploymentManager(ActorSystem actorSystem, IMongoClient client, DataTransferManager manager, RepositoryApi api)
        {
            var repo = ClusterSingletonManager.Props(Props.Create(() => new DeploymentServerImpl(client, manager, api)),
                                                     ClusterSingletonManagerSettings.Create(actorSystem).WithRole("UpdateSystem"));

            return(new DeploymentManager(actorSystem.ActorOf(repo, DeploymentApi.DeploymentPath)));
        }
 void datatransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
 {
     args.Request.Data.Properties.Title       = "Think";
     args.Request.Data.Properties.Description = App.loader.GetString("ShareAppMessageDescription");
     args.Request.Data.SetText(App.loader.GetString("ShareAppMessageContent"));
 }
Example #22
0
 static void ButtonClick(object sender, RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
 public static Task <TransferMessages.TransferCompled> Send <TSender, TCommand>(this TSender sender, TCommand command, TimeSpan timeout,
                                                                                DataTransferManager manager, Action <string> messages, Func <Stream?> getdata)
     where TSender : ISender
     where TCommand : FileTransferCommand <TSender, TCommand>
 => Send(sender, command, timeout, manager, messages, () =>
 {
     var str = getdata();
     return(str == null ? null : new StreamData(str));
 });
Example #24
0
 private void Button_Click_2(object sender, Windows.UI.Xaml.RoutedEventArgs e) => DataTransferManager.ShowShareUI();
        public static async Task <TransferMessages.TransferCompled> Send <TSender, TCommand>(this TSender sender,
                                                                                             TCommand command, TimeSpan timeout, DataTransferManager manager, Action <string> messages, Func <ITransferData?> getdata)
            where TSender : ISender
            where TCommand : FileTransferCommand <TSender, TCommand>
        {
            command.Manager = manager;
            var id = await SendingHelper.Send <FileTransactionId, TCommand>(sender, command, messages, timeout, false);

            var tranfer = await command.Manager.AskAwaitOperation(new AwaitRequest(timeout, id.Id));

            return(await tranfer.TryStart(getdata));
        }
Example #26
0
 private void BtnShare_Click(object sender, RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
Example #27
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(), item.ItemName);
                            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
            }
        }
 public void CompartilharTransacao()
 {
     DataTransferManager.ShowShareUI();
 }
        private void RegisterForShare()
        {
            DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();

            dataTransferManager.DataRequested += new TypedEventHandler <DataTransferManager, DataRequestedEventArgs>(this.ShareLinkHandler);
        }
Example #30
0
 private void OnShareSong(object sender, RoutedEventArgs e)
 {
     DataTransferManager.ShowShareUI();
 }
Example #31
0
 private void MenuFlyoutShare_Click(object sender, RoutedEventArgs e)
 {
     ViewModel1.SelectedItem = (sender as MenuFlyoutItem).DataContext as ListItem;
     DataTransferManager.ShowShareUI();
 }