System.Windows.Clipboard.SetText C# (CSharp) Method

SetText() public static method

For Windows XAML Phone Applications use a separate app to push items to the Clipboard
public static SetText ( string text ) : void
text string
return void
        public static void SetText(string text)
        {
            global::Windows.System.LauncherOptions options = new global::Windows.System.LauncherOptions();
            options.PreferredApplicationDisplayName = "Clipboarder";
            options.PreferredApplicationPackageFamilyName = "InTheHandLtd.Clipboarder";
            options.DisplayApplicationPicker = false;
            global::Windows.System.Launcher.LaunchUriAsync(new Uri(string.Format("clipboard:Set?Text={0}", Uri.EscapeDataString(text))), options);
        }
    }

Usage Example

Ejemplo n.º 1
0
        //Upload byte[] to imgur and give user a response
        private async Task UploadImageToImgur(byte[] cimg, string WindowName)
        {
            string link = await UploadImgur(cimg, WindowName);

            if (link.StartsWith("http://"))
            {
                Clipboard.SetText(link);
                PlayBlop();

                //Catch internal toast exceptions & process start exception
                try {
                    if (FileIO.OpenAfterUpload)
                    {
                        Process.Start(link);
                    }

                    await SuccessToast.ShowAsync(Properties.strings.linkclipboard,
                                                 TimeSpan.FromSeconds(5));
                } catch { }
            }
            else
            {
                //Catch internal toast exceptions
                try {
                    await ErrorToast.ShowAsync(string.Format(Properties.strings.uploadingError, link),
                                               TimeSpan.FromSeconds(5));
                } catch { }
            }
        }
All Usage Examples Of System.Windows.Clipboard::SetText
Clipboard