mirror of
https://github.com/Tribufu/ServerManagers
synced 2026-08-08 12:11:05 +00:00
32 lines
967 B
C#
32 lines
967 B
C#
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace ServerManagerTool.Plugin.Discord
|
|
{
|
|
public static class BrowserBehavior
|
|
{
|
|
public static readonly DependencyProperty HtmlProperty = DependencyProperty.RegisterAttached("Html", typeof(string), typeof(BrowserBehavior), new FrameworkPropertyMetadata(OnHtmlChanged));
|
|
|
|
[AttachedPropertyBrowsableForType(typeof(WebBrowser))]
|
|
public static string GetHtml(WebBrowser d)
|
|
{
|
|
return (string)d.GetValue(HtmlProperty);
|
|
}
|
|
|
|
public static void SetHtml(WebBrowser d, string value)
|
|
{
|
|
d.SetValue(HtmlProperty, value);
|
|
}
|
|
|
|
static void OnHtmlChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
if (e.NewValue == null)
|
|
return;
|
|
|
|
if (d is WebBrowser wb)
|
|
{
|
|
wb.NavigateToString(e.NewValue as string);
|
|
}
|
|
}
|
|
}
|
|
}
|