Esempio n. 1
0
        private void tsmiImportClipboard_Click(object sender, EventArgs e)
        {
            string json = ClipboardHelpers.GetText(true);

            if (!string.IsNullOrEmpty(json))
            {
                OnImportRequested(json);
                OnImportCompleted();
            }
        }
Esempio n. 2
0
        private bool CheckClipboardContents()
        {
            pbClipboard.Visible = txtClipboard.Visible = lbClipboard.Visible = false;

            if (Clipboard.ContainsImage())
            {
                using (Image img = ClipboardHelpers.GetImage())
                {
                    if (img != null)
                    {
                        ClipboardContentType = EClipboardContentType.Image;
                        ClipboardContent     = img.Clone();
                        pbClipboard.LoadImage(img);
                        pbClipboard.Visible = true;
                        lblQuestion.Text    = string.Format(Resources.ClipboardContentViewer_ClipboardContentViewer_Load_Clipboard_content__Image__Size___0_x_1__, img.Width, img.Height);
                        return(true);
                    }
                }
            }
            else if (Clipboard.ContainsText())
            {
                string text = ClipboardHelpers.GetText();

                if (!string.IsNullOrEmpty(text))
                {
                    ClipboardContentType = EClipboardContentType.Text;
                    ClipboardContent     = text;
                    txtClipboard.Text    = text;
                    txtClipboard.Visible = true;
                    lblQuestion.Text     = string.Format(Resources.ClipboardContentViewer_ClipboardContentViewer_Load_Clipboard_content__Text__Length___0__, text.Length);
                    return(true);
                }
            }
            else if (Clipboard.ContainsFileDropList())
            {
                string[] files = ClipboardHelpers.GetFileDropList();

                if (files != null && files.Length > 0)
                {
                    ClipboardContentType = EClipboardContentType.Files;
                    ClipboardContent     = files;
                    lbClipboard.Items.AddRange(files);
                    lbClipboard.Visible = true;
                    lblQuestion.Text    = string.Format(Resources.ClipboardContentViewer_ClipboardContentViewer_Load_Clipboard_content__File__Count___0__, files.Length);
                    return(true);
                }
            }

            lblQuestion.Text = Resources.ClipboardContentViewer_ClipboardContentViewer_Load_Clipboard_is_empty_or_contains_unknown_data_;
            return(false);
        }
Esempio n. 3
0
        public bool CheckClipboard()
        {
            string text = ClipboardHelpers.GetText(true);

            if (!string.IsNullOrEmpty(text))
            {
                text = text.Trim();

                if (ColorHelpers.ParseColor(text, out Color clipboardColor))
                {
                    colorPicker.ChangeColor(clipboardColor);
                    btnClipboardStatus.Text     = "Clipboard: " + text;
                    btnClipboardStatus.Location = new Point(btnClipboardColorPicker.Left + (btnClipboardColorPicker.Width / 2) - (btnClipboardStatus.Width / 2),
                                                            btnClipboardColorPicker.Top - btnClipboardStatus.Height - 5);
                    clipboardStatusHider.Show();
                    return(true);
                }
            }

            return(false);
        }
        private void tsmiImportClipboard_Click(object sender, EventArgs e)
        {
            string json = ClipboardHelpers.GetText(true);

            ImportJson(json);
        }