chore: use file-scoped namespace

This commit is contained in:
NaBian committed 2022-03-13 20:28:58 +08:00
1 parent 99d2fafb72
commit bbf1b7d4c6
748 files changed
+57929 -58678

No files matched your search

@@ -3,43 +3,42 @@ using System.Globalization;
using System.Text;
using System.Windows.Data;
namespace HandyControlDemo.Tools.Converter
namespace HandyControlDemo.Tools.Converter;
public class StringRepeatConverter : IValueConverter
{
public class StringRepeatConverter : IValueConverter
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
if (value is string strValue)
{
if (value is string strValue)
var builder = new StringBuilder();
int num;
if (parameter is string numStr)
{
var builder = new StringBuilder();
int num;
if (parameter is string numStr)
{
if (!int.TryParse(numStr, out num))
{
return strValue;
}
}
else if (parameter is int intValue)
{
num = intValue;
}
else
if (!int.TryParse(numStr, out num))
{
return strValue;
}
for (var i = 0; i < num; i++)
{
builder.Append(strValue);
}
return builder.ToString();
}
return string.Empty;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
else if (parameter is int intValue)
{
num = intValue;
}
else
{
return strValue;
}
for (var i = 0; i < num; i++)
{
builder.Append(strValue);
}
return builder.ToString();
}
return string.Empty;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}