Exemple #1
0
        public static ClipbordDataObject GenerateFromClipboard()
        {
            var result = new ClipbordDataObject();

            if (Clipboard.ContainsAudio())
            {
                result.Data   = Clipboard.GetAudioStream();
                result.Format = DataFormats.WaveAudio;
            }
            else if (Clipboard.ContainsImage())
            {
                result.Data   = Clipboard.GetImage();
                result.Format = DataFormats.Bitmap;
            }
            else if (Clipboard.ContainsFileDropList())
            {
                result.Data   = Clipboard.GetFileDropList();
                result.Format = DataFormats.FileDrop;
            }
            else if (Clipboard.ContainsText())
            {
                if (Clipboard.ContainsText(TextDataFormat.Text))
                {
                    result.Data   = Clipboard.GetText(TextDataFormat.Text);
                    result.Format = DataFormats.Text;
                }
                else if (Clipboard.ContainsText(TextDataFormat.UnicodeText))
                {
                    result.Data   = Clipboard.GetText(TextDataFormat.UnicodeText);
                    result.Format = DataFormats.UnicodeText;
                }
                else if (Clipboard.ContainsText(TextDataFormat.Rtf))
                {
                    result.Data   = Clipboard.GetText(TextDataFormat.Rtf);
                    result.Format = DataFormats.Rtf;
                }
                else if (Clipboard.ContainsText(TextDataFormat.Html))
                {
                    result.Data   = Clipboard.GetText(TextDataFormat.Html);
                    result.Format = DataFormats.Html;
                }
                else
                {
                    result.Data   = Clipboard.GetText();
                    result.Format = DataFormats.Text;
                }
            }

            if (result.Data == null)
            {
                return(null);
            }
            result.Type = result.Data.GetType();
            return(result);
        }
Exemple #2
0
 private void LoadSlotDataIntoSystemClipboard()
 {
     SlotData = ClipboardController.GetDataObjectForKey(SlotKey);
     ClipboardController.LoadDataIntoSystemClipboard(SlotData);
 }
Exemple #3
0
 private void SaveOriginalClipbordData()
 {
     OriginalClipboardData = ClipboardController.SystemClipboardContent;
 }