Initial commit to new repository
This commit is contained in:
110
.decompiledproj/AxCopilot/Views/ColorPickResultWindow.cs
Normal file
110
.decompiledproj/AxCopilot/Views/ColorPickResultWindow.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace AxCopilot.Views;
|
||||
|
||||
public class ColorPickResultWindow : Window, IComponentConnector
|
||||
{
|
||||
private readonly DispatcherTimer _timer;
|
||||
|
||||
internal Ellipse ColorPreview;
|
||||
|
||||
internal TextBlock HexText;
|
||||
|
||||
internal TextBlock RgbText;
|
||||
|
||||
private bool _contentLoaded;
|
||||
|
||||
public ColorPickResultWindow(System.Drawing.Color color, double screenX, double screenY)
|
||||
{
|
||||
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_01af: Expected O, but got Unknown
|
||||
InitializeComponent();
|
||||
System.Windows.Media.Color color2 = System.Windows.Media.Color.FromRgb(color.R, color.G, color.B);
|
||||
ColorPreview.Fill = new SolidColorBrush(color2);
|
||||
HexText.Text = $"#{color.R:X2}{color.G:X2}{color.B:X2}";
|
||||
RgbText.Text = $"RGB({color.R}, {color.G}, {color.B})";
|
||||
try
|
||||
{
|
||||
Clipboard.SetText(HexText.Text);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
Rect workArea = SystemParameters.WorkArea;
|
||||
base.Left = Math.Min(screenX + 20.0, ((Rect)(ref workArea)).Right - 200.0);
|
||||
base.Top = Math.Min(screenY + 20.0, ((Rect)(ref workArea)).Bottom - 160.0);
|
||||
_timer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(5.0)
|
||||
};
|
||||
_timer.Tick += delegate
|
||||
{
|
||||
Close();
|
||||
};
|
||||
_timer.Start();
|
||||
base.MouseDown += delegate
|
||||
{
|
||||
Close();
|
||||
};
|
||||
base.Opacity = 0.0;
|
||||
base.Loaded += delegate
|
||||
{
|
||||
DoubleAnimation animation = new DoubleAnimation(0.0, 1.0, TimeSpan.FromMilliseconds(200.0));
|
||||
BeginAnimation(UIElement.OpacityProperty, animation);
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
_timer.Stop();
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
[GeneratedCode("PresentationBuildTasks", "10.0.5.0")]
|
||||
public void InitializeComponent()
|
||||
{
|
||||
if (!_contentLoaded)
|
||||
{
|
||||
_contentLoaded = true;
|
||||
Uri resourceLocator = new Uri("/AxCopilot;component/views/colorpickresultwindow.xaml", UriKind.Relative);
|
||||
Application.LoadComponent(this, resourceLocator);
|
||||
}
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
[GeneratedCode("PresentationBuildTasks", "10.0.5.0")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
void IComponentConnector.Connect(int connectionId, object target)
|
||||
{
|
||||
switch (connectionId)
|
||||
{
|
||||
case 1:
|
||||
ColorPreview = (Ellipse)target;
|
||||
break;
|
||||
case 2:
|
||||
HexText = (TextBlock)target;
|
||||
break;
|
||||
case 3:
|
||||
RgbText = (TextBlock)target;
|
||||
break;
|
||||
default:
|
||||
_contentLoaded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user