private void fileTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { if (this.fileTree.Visibility != Visibility.Visible) { return; } var selection = this.fileTree.SelectedValue as Change; if (selection != null) { if (this.chkBlame.IsChecked == true) { ShowBlame(selection.Name); } else { txtFileName.Text = selection.Name; var dispatcher = Dispatcher.CurrentDispatcher; Action act = () => { try { var file = _tracker.GetUnmodifiedFileByRelativePath(selection.Name, commitId2); ShowFileFromString(file); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }; dispatcher.BeginInvoke(act, DispatcherPriority.ApplicationIdle); } ShowCommitsForFile(selection.Name); } }