Permalink
Browse files

show exception message to status bar

  • Loading branch information...
yysun committed Nov 12, 2011
1 parent 9f24894 commit fdb62edd50a681c5e018f6196b838668ff641b1f
Showing with 42 additions and 12 deletions.
  1. +12 −0 HistoryView.xaml.cs
  2. +30 −12 PendingChangesView.xaml.cs
View
@@ -57,6 +57,7 @@ internal void Refresh(GitFileStatusTracker tracker)
}
catch (Exception ex)
{
+ ShowStatusMessage(ex.Message);
Log.WriteLine("History View Refresh: {0}", ex.ToString());
}
@@ -77,6 +78,7 @@ private void button1_Click(object sender, RoutedEventArgs e)
}
catch(Exception ex)
{
+ ShowStatusMessage(ex.Message);
MessageBox.Show(ex.Message, "Error");
}
}
@@ -124,6 +126,7 @@ private void CloseCommitDetails_Executed(object sender, ExecutedRoutedEventArgs
}
catch (Exception ex)
{
+ ShowStatusMessage(ex.Message);
Log.WriteLine("History Tool Window - CloseCommitDetails_Executed: {0}", ex.ToString());
}
}
@@ -137,6 +140,7 @@ private void OpenCommitDetails_Executed(object sender, ExecutedRoutedEventArgs e
}
catch (Exception ex)
{
+ ShowStatusMessage(ex.Message);
Log.WriteLine("History Tool Window - OpenCommitDetails_Executed: {0}", ex.ToString());
}
}
@@ -155,6 +159,7 @@ private void SelectCommit_Executed(object sender, ExecutedRoutedEventArgs e)
}
catch (Exception ex)
{
+ ShowStatusMessage(ex.Message);
Log.WriteLine("History Tool Window - SelectCommit_Executed: {0}", ex.ToString());
}
}
@@ -174,6 +179,7 @@ private void btnCompare_Click(object sender, RoutedEventArgs e)
}
catch (Exception ex)
{
+ ShowStatusMessage(ex.Message);
Log.WriteLine("History Tool Window - btnCompare_Click: {0}", ex.ToString());
}
}
@@ -191,6 +197,12 @@ private void btnCommitCount_Click(object sender, RoutedEventArgs e)
//selectedCommits.Clear();
//SetSelectedCommitCount();
}
+
+ private void ShowStatusMessage(string msg)
+ {
+ var dte = BasicSccProvider.GetServiceEx<EnvDTE.DTE>();
+ dte.StatusBar.Text = msg;
+ }
}
public static class HistoryViewCommands
View
@@ -95,7 +95,10 @@ private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs
}
}
}
- catch { }
+ catch (Exception ex)
+ {
+ ShowStatusMessage(ex.Message);
+ }
};
@@ -134,7 +137,10 @@ private void GetSelectedFileName(Action<string> action)
{
action(fileName);
}
- catch { }
+ catch (Exception ex)
+ {
+ ShowStatusMessage(ex.Message);
+ }
}
private void GetSelectedFileFullName(Action<string> action, bool fileMustExists = true)
@@ -148,7 +154,10 @@ private void GetSelectedFileFullName(Action<string> action, bool fileMustExists
{
action(fileName);
}
- catch { }
+ catch (Exception ex)
+ {
+ ShowStatusMessage(ex.Message);
+ }
}
#endregion
@@ -174,6 +183,7 @@ internal void Refresh(GitFileStatusTracker tracker)
var dispatcher = Dispatcher.CurrentDispatcher;
Action act = () =>
{
+
service.NoRefresh = true;
Stopwatch stopwatch = new Stopwatch();
@@ -182,25 +192,32 @@ internal void Refresh(GitFileStatusTracker tracker)
var selectedFile = GetSelectedFileName();
this.dataGrid1.BeginInit();
- this.dataGrid1.ItemsSource = tracker.ChangedFiles;
+ try
+ {
+ this.dataGrid1.ItemsSource = tracker.ChangedFiles;
+
+ ICollectionView view = CollectionViewSource.GetDefaultView(this.dataGrid1.ItemsSource);
+ if (view != null)
+ {
+ view.SortDescriptions.Clear();
+ view.SortDescriptions.Add(new SortDescription(sortMemberPath, sortDirection));
+ view.Refresh();
+ }
- ICollectionView view = CollectionViewSource.GetDefaultView(this.dataGrid1.ItemsSource);
- if (view != null)
+ this.dataGrid1.SelectedValue = selectedFile;
+ }
+ catch (Exception ex)
{
- view.SortDescriptions.Clear();
- view.SortDescriptions.Add(new SortDescription(sortMemberPath, sortDirection));
- view.Refresh();
+ ShowStatusMessage(ex.Message);
}
-
this.dataGrid1.EndInit();
- this.dataGrid1.SelectedValue = selectedFile;
-
stopwatch.Stop();
Debug.WriteLine("**** PendingChangesView Refresh: " + stopwatch.ElapsedMilliseconds);
service.NoRefresh = false;
service.lastTimeRefresh = DateTime.Now; //important!!
+
};
dispatcher.BeginInvoke(act, DispatcherPriority.ApplicationIdle);
@@ -456,6 +473,7 @@ private void DiffEditor_MouseDoubleClick(object sender, MouseButtonEventArgs e)
}
catch (Exception ex)
{
+ ShowStatusMessage(ex.Message);
Log.WriteLine("Pending Changes View - DiffEditor_MouseDoubleClick: {0}", ex.ToString());
}
GetSelectedFileFullName((fileName) =>

0 comments on commit fdb62ed

Please sign in to comment.