Ejemplo n.º 1
0
        private void PasteImage_Loaded(object sender, RoutedEventArgs e)
        {
            var window = this.Owner as MainWindow;

            Editor   = window.Model.ActiveEditor;
            Document = window.Model.ActiveDocument;

            PasteCommand = new CommandBase((s, args) =>
            {
                MessageBox.Show("PasteCommand");
            });

            TextImage.Focus();
            if (Clipboard.ContainsImage())
            {
                Button_PasteImage(null, null);
            }
            else if (Clipboard.ContainsText())
            {
                string clip = Clipboard.GetText().ToLower();
                if ((clip.StartsWith("http://") || clip.StartsWith("https://")) &&
                    (clip.Contains(".png") || clip.Contains("jpg")))
                {
                    TextImage.Text = clip;
                    SetImagePreview(clip);
                }
            }
        }
Ejemplo n.º 2
0
 private void PasteImage_Loaded(object sender, RoutedEventArgs e)
 {
     TextImage.Focus();
     if (Clipboard.ContainsText())
     {
         string clip = Clipboard.GetText().ToLower();
         if ((clip.StartsWith("http://") || clip.StartsWith("https://")) &&
             (clip.Contains(".png") || clip.Contains("jpg")))
         {
             TextImage.Text = clip;
             SetImagePreview(clip);
         }
     }
 }
Ejemplo n.º 3
0
        private void PasteImage_Loaded(object sender, RoutedEventArgs e)
        {
            PasteCommand = new CommandBase((s, args) => { MessageBox.Show("PasteCommand"); });

            TextImage.Focus();
            if (string.IsNullOrEmpty(Image) && Clipboard.ContainsImage())
            {
                PasteImageFromClipboard();
            }
            else if (string.IsNullOrEmpty(Image) && Clipboard.ContainsText())
            {
                string clip = Clipboard.GetText().ToLower();
                if ((clip.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase) ||
                     clip.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase)) &&
                    (clip.Contains(".png", StringComparison.InvariantCultureIgnoreCase) ||
                     clip.Contains("jpg", StringComparison.InvariantCultureIgnoreCase)))
                {
                    TextImage.Text = clip;
                    SetImagePreview(clip);
                }
            }
        }