mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
none<FilesDisplayModeToIcon>: code style
This commit is contained in:
parent
d26446c1b0
commit
c78710c7e3
2 changed files with 26 additions and 20 deletions
26
src/Converters/FilesDisplayModeToIcon.cs
Normal file
26
src/Converters/FilesDisplayModeToIcon.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SourceGit.Converters {
|
||||
|
||||
public class FilesDisplayModeToIcon : IValueConverter {
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
|
||||
var mode = (Git.Preference.FilesDisplayMode)value;
|
||||
switch (mode) {
|
||||
case Git.Preference.FilesDisplayMode.Grid:
|
||||
return App.Current.FindResource("Icon.Grid") as Geometry;
|
||||
case Git.Preference.FilesDisplayMode.List:
|
||||
return App.Current.FindResource("Icon.List") as Geometry;
|
||||
default:
|
||||
return App.Current.FindResource("Icon.Tree") as Geometry;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,29 +2,9 @@ using System;
|
|||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SourceGit.Converters {
|
||||
|
||||
public class FilesDisplayModeToIcon : IValueConverter {
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
|
||||
var mode = (Git.Preference.FilesDisplayMode)value;
|
||||
switch (mode) {
|
||||
case Git.Preference.FilesDisplayMode.Grid:
|
||||
return App.Current.FindResource("Icon.Grid") as Geometry;
|
||||
case Git.Preference.FilesDisplayMode.List:
|
||||
return App.Current.FindResource("Icon.List") as Geometry;
|
||||
default:
|
||||
return App.Current.FindResource("Icon.Tree") as Geometry;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class FilesDisplayModeToList : IValueConverter {
|
||||
|
||||
public bool TreatGridAsList { get; set; } = true;
|
||||
|
|
Loading…
Reference in a new issue