change UI to UI.WinForms
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
using Pilz.UI.Telerik.Dialogs;
|
||||
|
||||
namespace Pilz.UI.WinForms.Telerik.Extensions;
|
||||
|
||||
public static class RadFlyoutBaseExtensions
|
||||
{
|
||||
public static bool IsValid(this RadFlyoutBase? @this)
|
||||
{
|
||||
return @this != null && @this.Result == DialogResult.OK;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
namespace Pilz.UI.WinForms.Telerik.Extensions;
|
||||
|
||||
public static class RadListDataItemCollectionExtensions
|
||||
{
|
||||
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this) where T : struct, Enum
|
||||
{
|
||||
return @this.AddEnumValues<T>(false);
|
||||
}
|
||||
|
||||
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this, bool clearCollection) where T : struct, Enum
|
||||
{
|
||||
return @this.AddEnumValues<T>(clearCollection, null, null);
|
||||
}
|
||||
|
||||
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this, bool clearCollection, Func<T, bool>? filter, Func<T, string?>? format) where T : struct, Enum
|
||||
{
|
||||
var values = Enum.GetValues(typeof(T));
|
||||
var items = new List<RadListDataItem>();
|
||||
|
||||
format ??= v => Enum.GetName(typeof(T), v);
|
||||
|
||||
if (clearCollection)
|
||||
@this.Clear();
|
||||
|
||||
foreach (T value in values)
|
||||
{
|
||||
if (filter is null || filter(value))
|
||||
items.Add(new(format(value), value));
|
||||
}
|
||||
|
||||
@this.AddRange(items);
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
||||
23
Pilz.UI.WinForms.Telerik/Extensions/RadSvgImageExtensions.cs
Normal file
23
Pilz.UI.WinForms.Telerik/Extensions/RadSvgImageExtensions.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.Svg;
|
||||
|
||||
namespace Pilz.UI.WinForms.Telerik.Extensions;
|
||||
|
||||
public static class RadSvgImageExtensions
|
||||
{
|
||||
public static Image ToImage(this RadSvgImage svg)
|
||||
{
|
||||
return svg.Document.Draw(svg.Width, svg.Height);
|
||||
}
|
||||
|
||||
public static void ApplyColor(this RadSvgImage svg, Color color)
|
||||
{
|
||||
svg.Document.Fill = new SvgColourServer(color);
|
||||
svg.Document.ApplyRecursive(e =>
|
||||
{
|
||||
e.Fill = new SvgColourServer(color);
|
||||
e.Stroke = new SvgColourServer(color);
|
||||
});
|
||||
svg.ClearCache();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user