SetContent() public static method

public static SetContent ( [ content ) : void
content [
return void
        private async void UpdateClipboard()
        {
            Indicator.IsBusy = true;
            if (ProfileComboBox.IsLoaded && ProfileComboBox.SelectedValue != null && ProfileComboBox.SelectedValue as string != "Default")
            {
                if (ProfileComboBox.Items.Contains("Default"))
                {
                    UpdateProfileComboBox(false, ProfileComboBox.SelectedValue as string);
                }

                Clipboard.ClearHistory();

                using (LiteDatabase db = new LiteDatabase($"Filename={Path.Combine(documents, "Auto Paste Clipboard", "data.db")}; Connection=shared"))
                {
                    ILiteCollection <ClipboardProfile> collection = db.GetCollection <ClipboardProfile>("clipboard");

                    ClipboardProfile clipboardProfile = collection.FindOne(x => x.Profile == ProfileComboBox.SelectedValue as string);

                    foreach (string item in clipboardProfile.Clipboard)
                    {
                        DataPackage data = new DataPackage();
                        data.SetText(item);
                        Clipboard.SetContent(data);
                        await Task.Delay(450);
                    }

                    DelimiterComboBox.SelectedIndex = clipboardProfile.Delimeter;
                    DelayUpDownBox.Value            = clipboardProfile.Delay;
                    ProfileNameTextBox.Text         = ProfileComboBox.SelectedValue as string;
                }
            }
            UndoChangesBtn.IsEnabled = false;
            Indicator.IsBusy         = false;
        }
示例#2
0
        static Task PlatformSetTextAsync(string text)
        {
            var dataPackage = new DataPackage();

            dataPackage.SetText(text);
            WindowsClipboard.SetContent(dataPackage);
            return(Task.CompletedTask);
        }
示例#3
0
 public void Copy(DataPackage data, bool flush = true)
 {
     data.RequestedOperation = DataPackageOperation.Copy;
     Clip.SetContent(data);
     if (flush)
     {
         Clip.Flush();
     }
 }
示例#4
0
 static Func <string, CancellationToken, Task> CreateAsyncSet()
 {
     return((text, cancellation) =>
     {
         var dataPackage = new DataPackage();
         dataPackage.SetText(text);
         var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher;
         return dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => UapClipboard.SetContent(dataPackage))
         .AsTask(cancellation);
     });
 }