private void PasteCode_Loaded(object sender, RoutedEventArgs e) { Gist.filename = "file." + Gist.language; if (string.IsNullOrEmpty(PasteCodeAsGistConfiguration.Current.GithubUsername)) { CheckAnonymous.Visibility = Visibility.Collapsed; Gist.isAnonymous = true; } DataContext = this; editor = new MarkdownEditorSimple(WebBrowserCode, Gist.code, "csharp"); editor.IsDirtyAction = () => { Gist.code = editor.GetMarkdown(); return(true); }; if (!string.IsNullOrEmpty(Gist.code)) { Dispatcher.InvokeAsync(() => { TextFilename.SelectAll(); TextFilename.Focus(); }, System.Windows.Threading.DispatcherPriority.ApplicationIdle); } }
public void PasteImage() { if (!ClipboardHelper.ContainsImage()) { ShowStatus("Clipboard doesn't contain an image.", 6000); SetStatusIcon(FontAwesomeIcon.Warning, Colors.Orange); return; } ImagePreview.Source = ClipboardHelper.GetImageSource(); BlobFileName = Addin.GetBlobFilename(); if (string.IsNullOrEmpty(BlobFileName)) { ShowStatus("No filename selected.", 6000); SetStatusIcon(FontAwesomeIcon.Warning, Colors.Orange); return; } PasteImageToAzureWindow_SizeChanged(this, null); IsBitmap = true; ImageFilename = null; // Get just the filename to highlight var justFile = Path.GetFileName(BlobFileName); var start = BlobFileName.Length - justFile.Length; TextFilename.Focus(); TextFilename.Select(start, justFile.Length - 4); ShowStatus("Image pasted from Clipboard.", 8000); }