@@ -38,8 +38,8 @@ public class OpenProblemInEditorEventArgs : EventArgs
3838
3939 private static int iconSize = 20 ;
4040
41- private GridViewColumnHeader listViewSortCol = null ;
42- private SortAdorner listViewSortAdorner = null ;
41+ private GridViewColumnHeader listViewSortCol = null ;
42+ private SortAdorner listViewSortAdorner = null ;
4343
4444 public MainToolWindowUI ( )
4545 {
@@ -127,54 +127,54 @@ public static TParent FindVisualParent<TParent, TLimit>(DependencyObject obj) wh
127127 return obj as TParent ;
128128 }
129129
130- private void problemColumnHeader_Click ( object sender , RoutedEventArgs e )
131- {
132- GridViewColumnHeader column = ( sender as GridViewColumnHeader ) ;
133- string sortBy = column . Tag . ToString ( ) ;
134-
135- ClearSorting ( ) ;
136-
137- ListSortDirection newDir = ListSortDirection . Ascending ;
138- if ( listViewSortCol == column && listViewSortAdorner . Direction == newDir )
139- {
140- newDir = ListSortDirection . Descending ;
141- }
142-
143- listViewSortCol = column ;
144- listViewSortAdorner = new SortAdorner ( listViewSortCol , newDir ) ;
145- AdornerLayer . GetAdornerLayer ( listViewSortCol ) . Add ( listViewSortAdorner ) ;
146-
147- if ( sortBy == "Severity" )
148- {
149- listView . Items . SortDescriptions . Add ( new SortDescription ( sortBy , newDir ) ) ;
150- listView . Items . SortDescriptions . Add ( new SortDescription ( "FileName" , ListSortDirection . Ascending ) ) ;
151- listView . Items . SortDescriptions . Add ( new SortDescription ( "Line" , ListSortDirection . Ascending ) ) ;
152- }
153- else if ( sortBy == "FileName" )
154- {
155- listView . Items . SortDescriptions . Add ( new SortDescription ( sortBy , newDir ) ) ;
156- listView . Items . SortDescriptions . Add ( new SortDescription ( "Line" , ListSortDirection . Ascending ) ) ;
157- }
158- else if ( sortBy == "Message" )
159- {
160- listView . Items . SortDescriptions . Add ( new SortDescription ( sortBy , newDir ) ) ;
161- listView . Items . SortDescriptions . Add ( new SortDescription ( "FileName" , ListSortDirection . Ascending ) ) ;
162- listView . Items . SortDescriptions . Add ( new SortDescription ( "Line" , ListSortDirection . Ascending ) ) ;
163- }
164- else
165- {
166- listView . Items . SortDescriptions . Add ( new SortDescription ( sortBy , newDir ) ) ;
167- }
168- }
169-
170- public void ClearSorting ( )
171- {
172- if ( listViewSortCol != null )
173- {
174- AdornerLayer . GetAdornerLayer ( listViewSortCol ) . Remove ( listViewSortAdorner ) ;
175- listView . Items . SortDescriptions . Clear ( ) ;
176- }
177- }
130+ private void problemColumnHeader_Click ( object sender , RoutedEventArgs e )
131+ {
132+ GridViewColumnHeader column = ( sender as GridViewColumnHeader ) ;
133+ string sortBy = column . Tag . ToString ( ) ;
134+
135+ ClearSorting ( ) ;
136+
137+ ListSortDirection newDir = ListSortDirection . Ascending ;
138+ if ( listViewSortCol == column && listViewSortAdorner . Direction == newDir )
139+ {
140+ newDir = ListSortDirection . Descending ;
141+ }
142+
143+ listViewSortCol = column ;
144+ listViewSortAdorner = new SortAdorner ( listViewSortCol , newDir ) ;
145+ AdornerLayer . GetAdornerLayer ( listViewSortCol ) . Add ( listViewSortAdorner ) ;
146+
147+ if ( sortBy == "Severity" )
148+ {
149+ listView . Items . SortDescriptions . Add ( new SortDescription ( sortBy , newDir ) ) ;
150+ listView . Items . SortDescriptions . Add ( new SortDescription ( "FileName" , ListSortDirection . Ascending ) ) ;
151+ listView . Items . SortDescriptions . Add ( new SortDescription ( "Line" , ListSortDirection . Ascending ) ) ;
152+ }
153+ else if ( sortBy == "FileName" )
154+ {
155+ listView . Items . SortDescriptions . Add ( new SortDescription ( sortBy , newDir ) ) ;
156+ listView . Items . SortDescriptions . Add ( new SortDescription ( "Line" , ListSortDirection . Ascending ) ) ;
157+ }
158+ else if ( sortBy == "Message" )
159+ {
160+ listView . Items . SortDescriptions . Add ( new SortDescription ( sortBy , newDir ) ) ;
161+ listView . Items . SortDescriptions . Add ( new SortDescription ( "FileName" , ListSortDirection . Ascending ) ) ;
162+ listView . Items . SortDescriptions . Add ( new SortDescription ( "Line" , ListSortDirection . Ascending ) ) ;
163+ }
164+ else
165+ {
166+ listView . Items . SortDescriptions . Add ( new SortDescription ( sortBy , newDir ) ) ;
167+ }
168+ }
169+
170+ public void ClearSorting ( )
171+ {
172+ if ( listViewSortCol != null )
173+ {
174+ AdornerLayer . GetAdornerLayer ( listViewSortCol ) . Remove ( listViewSortAdorner ) ;
175+ listView . Items . SortDescriptions . Clear ( ) ;
176+ }
177+ }
178178
179179 public class ProblemsListItem
180180 {
@@ -199,10 +199,10 @@ public int Line
199199 get { return _problem . Line ; }
200200 }
201201
202- public Problem . SeverityLevel Severity
203- {
204- get { return _problem . Severity ; }
205- }
202+ public Problem . SeverityLevel Severity
203+ {
204+ get { return _problem . Severity ; }
205+ }
206206
207207 public ImageSource Icon
208208 {
@@ -259,15 +259,15 @@ public Problem Problem
259259
260260 Problem _problem ;
261261 }
262- private void ListView_SelectionChanged ( )
263- {
264- }
265- private void ListView_SelectionChanged_1 ( object sender , SelectionChangedEventArgs e )
266- {
267- }
268- private void ListView_SelectionChanged_2 ( object sender , SelectionChangedEventArgs e )
269- {
270- }
262+ private void ListView_SelectionChanged ( )
263+ {
264+ }
265+ private void ListView_SelectionChanged_1 ( object sender , SelectionChangedEventArgs e )
266+ {
267+ }
268+ private void ListView_SelectionChanged_2 ( object sender , SelectionChangedEventArgs e )
269+ {
270+ }
271271 }
272272
273273 public class DeleteObjectInvoker
@@ -276,39 +276,39 @@ public class DeleteObjectInvoker
276276 public static extern bool DeleteObject ( IntPtr hObject ) ;
277277 }
278278
279- public class SortAdorner : Adorner
280- {
281- private static Geometry ascGeometry = Geometry . Parse ( "M 0 4 L 3.5 0 L 7 4 Z" ) ;
282- private static Geometry descGeometry = Geometry . Parse ( "M 0 0 L 3.5 4 L 7 0 Z" ) ;
283-
284- public ListSortDirection Direction { get ; private set ; }
285-
286- public SortAdorner ( UIElement element , ListSortDirection dir )
287- : base ( element )
288- {
289- this . Direction = dir ;
290- }
291-
292- protected override void OnRender ( DrawingContext drawingContext )
293- {
294- base . OnRender ( drawingContext ) ;
295-
296- if ( AdornedElement . RenderSize . Width < 20 )
297- {
298- return ;
299- }
300-
301- TranslateTransform transform = new TranslateTransform ( AdornedElement . RenderSize . Width - 15 , ( AdornedElement . RenderSize . Height - 5 ) / 2 ) ;
302- drawingContext . PushTransform ( transform ) ;
303-
304- Geometry geometry = ascGeometry ;
305- if ( this . Direction == ListSortDirection . Descending )
306- {
307- geometry = descGeometry ;
308- }
309- drawingContext . DrawGeometry ( System . Windows . Media . Brushes . Black , null , geometry ) ;
310-
311- drawingContext . Pop ( ) ;
312- }
313- }
279+ public class SortAdorner : Adorner
280+ {
281+ private static Geometry ascGeometry = Geometry . Parse ( "M 0 4 L 3.5 0 L 7 4 Z" ) ;
282+ private static Geometry descGeometry = Geometry . Parse ( "M 0 0 L 3.5 4 L 7 0 Z" ) ;
283+
284+ public ListSortDirection Direction { get ; private set ; }
285+
286+ public SortAdorner ( UIElement element , ListSortDirection dir )
287+ : base ( element )
288+ {
289+ this . Direction = dir ;
290+ }
291+
292+ protected override void OnRender ( DrawingContext drawingContext )
293+ {
294+ base . OnRender ( drawingContext ) ;
295+
296+ if ( AdornedElement . RenderSize . Width < 20 )
297+ {
298+ return ;
299+ }
300+
301+ TranslateTransform transform = new TranslateTransform ( AdornedElement . RenderSize . Width - 15 , ( AdornedElement . RenderSize . Height - 5 ) / 2 ) ;
302+ drawingContext . PushTransform ( transform ) ;
303+
304+ Geometry geometry = ascGeometry ;
305+ if ( this . Direction == ListSortDirection . Descending )
306+ {
307+ geometry = descGeometry ;
308+ }
309+ drawingContext . DrawGeometry ( System . Windows . Media . Brushes . Black , null , geometry ) ;
310+
311+ drawingContext . Pop ( ) ;
312+ }
313+ }
314314}
0 commit comments