コード例 #1
0
ファイル: Clipboard.cs プロジェクト: ysdy44/Color-Scheme-UWP
        public static async Task <uint> CopyBitmapAsync(byte[] byteList)
        {
            IBuffer             buffer       = byteList.AsBuffer();
            IRandomAccessStream randomStream = new InMemoryRandomAccessStream();

            DataWriter dataWriter = new DataWriter(randomStream);

            dataWriter.WriteBuffer(buffer, 0, buffer.Length);
            uint length = await dataWriter.StoreAsync();

            Clipboard2.CopyBitmap(RandomAccessStreamReference.CreateFromStream(randomStream));
            return(length);
        }
コード例 #2
0
        public ColorDialog()
        {
            this.InitializeComponent();
            this.ConstructStrings();
            this.CopyButton.Tapped  += (s, e) => Clipboard2.CopyText(this.TextBox.Text);
            this.PasteButton.Tapped += async(s, e) =>
            {
                string text = await Clipboard2.PasteTextAsync();

                if (string.IsNullOrEmpty(text))
                {
                    return;
                }
                this.TextBox.Text = text.ToUpper();
            };
        }