Files
2025-11-11 11:03:42 +01:00

88 lines
2.7 KiB
C#

using FasdDesktopUi.Basics.UserControls.AdaptableIcon;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace F4SDicons.User_Controls
{
public partial class CopyTextBox : UserControl
{
public CopyTextBox()
{
InitializeComponent();
}
#region Dependency Properties
public string TextContent
{
get { return (string)GetValue(TextContentProperty); }
set { SetValue(TextContentProperty, value); }
}
// Using a DependencyProperty as the backing store for TextContent. This enables animation, styling, binding, etc...
public static readonly DependencyProperty TextContentProperty =
DependencyProperty.Register("TextContent", typeof(string), typeof(CopyTextBox), new PropertyMetadata(""));
public string ToolTipText
{
get { return (string)GetValue(ToolTipTextProperty); }
set { SetValue(ToolTipTextProperty, value); }
}
// Using a DependencyProperty as the backing store for ToolTipText. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ToolTipTextProperty =
DependencyProperty.Register("ToolTipText", typeof(string), typeof(CopyTextBox), new PropertyMetadata(""));
#endregion
#region Klick Event
private void currentNameButton_Click(object sender, MouseButtonEventArgs e)
{
System.Windows.Clipboard.SetText(CopyBlock.Text);
if (!(sender is AdaptableIcon senderIcon) )
{
return;
}
Dispatcher.Invoke(async ()=>
{
var currentMaterialIcon = senderIcon.SelectedMaterialIcon;
senderIcon.SelectedMaterialIcon = null;
senderIcon.SelectedInternIcon = F4SD_AdaptableIcon.Enums.enumInternIcons.misc_check;
Color ColorGreen = (Color)ColorConverter.ConvertFromString("#75B159");
senderIcon.PrimaryIconColor = new SolidColorBrush(ColorGreen);
await Task.Delay(500);
senderIcon.SelectedInternIcon = null;
senderIcon.SelectedMaterialIcon = currentMaterialIcon;
senderIcon.ClearValue(AdaptableIcon.PrimaryIconColorProperty);
});
}
#endregion
}
}