示例#1
0
        public string GetUrlForShareProvider(ShareProvider provider)
        {
            string result = null;

            providerLinkMap.TryGetValue(provider, out result);

            return(result);
        }
示例#2
0
        private void OnShareProvidersRequested(DataTransferManager sender, ShareProvidersRequestedEventArgs args)
        {
            if (args.Data.Contains(StandardDataFormats.WebLink))
            {
                var icon     = RandomAccessStreamReference.CreateFromUri(new Uri(@"ms-appx:///Assets/Images/ShareProvider_CopyLink24x24.png"));
                var provider = new ShareProvider("Copy link", icon, (Color)App.Current.Resources["SystemAccentColor"], OnShareToClipboard);
                args.Providers.Add(provider);
            }

            Hide();
        }
示例#3
0
 private void OnShareProvidersRequested(DataTransferManager s, ShareProvidersRequestedEventArgs e)
 {
     // Take a deferral so that we can perform async operations. (This sample
     // doesn't perform any async operations in the ShareProvidersRequested
     // event handler, but we take the deferral anyway to demonstrate the pattern.)
     using (var deferral = e.GetDeferral())
     {
         // Create the custom share provider and add it.
         RandomAccessStreamReference icon = RandomAccessStreamReference.CreateFromUri(new Uri(@"ms-appx:///Assets/windows-sdk.png"));
         ShareProvider provider           = new ShareProvider("Contoso Chat", icon, Windows.UI.Colors.LightGray, OnShareToContosoChat);
         e.Providers.Add(provider);
     }
 }
        public async Task Refresh(int p = -1)
        {
            switch (SelectedIndex)
            {
            case 0:
                await ReplyProvider.Refresh(p);

                break;

            case 1:
                await LikeProvider.Refresh(p);

                break;

            case 2:
                await ShareProvider.Refresh(p);

                break;
            }
        }
示例#5
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            var mainPage = Window.Current.Content as MainPage;

            if (mainPage == null)
            {
                mainPage = new MainPage();
                IAccountProvider accountService = new LocalAcountProvider();
                accountService.Initialize();

                IShareProvider shareProvider = new ShareProvider();
                shareProvider.Register();

                IHistoryProvider historyProvider = new HistoryProvider();
                historyProvider.Initialize();

                SynchronizationContextProvider.Initialize();

                mainPage.ViewModel     = new MainViewModel(accountService, shareProvider, historyProvider);
                Window.Current.Content = mainPage;
            }
            Window.Current.Activate();
        }
        public async Task SetSelectedIndex(int value)
        {
            switch (value)
            {
            case -1: return;

            case 1:
                if (LikeProvider.Models.Count == 0)
                {
                    await LikeProvider.Refresh();
                }

                break;

            case 2:
                if (ShareProvider.Models.Count == 0)
                {
                    await ShareProvider.Refresh();
                }

                break;
            }
            SelectedIndex = value;
        }