mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-17 00:14:59 +00:00
enhance: only show syntax-highlighting toggle if current revision content is a text file
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
f830b68f6a
commit
74f52fb266
3 changed files with 49 additions and 1 deletions
27
src/Converters/ObjectConverters.cs
Normal file
27
src/Converters/ObjectConverters.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
|
||||
namespace SourceGit.Converters
|
||||
{
|
||||
public static class ObjectConverters
|
||||
{
|
||||
public class IsTypeOfConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null || parameter == null)
|
||||
return false;
|
||||
|
||||
return value.GetType().IsAssignableTo((Type)parameter);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly IsTypeOfConverter IsTypeOf = new IsTypeOfConverter();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue