none<FilesDisplayModeToIcon>: code style

This commit is contained in:
leo 2020-11-29 22:39:44 +08:00
parent d26446c1b0
commit c78710c7e3
2 changed files with 26 additions and 20 deletions

View 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();
}
}
}

View file

@ -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;