using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Markup;

namespace AxCopilot.Views;

public class LargeTypeWindow : Window, IComponentConnector
{
	private readonly string _text;

	internal Border Overlay;

	internal TextBlock LargeText;

	private bool _contentLoaded;

	public LargeTypeWindow(string text)
	{
		_text = text;
		InitializeComponent();
	}

	private void Window_Loaded(object sender, RoutedEventArgs e)
	{
		LargeText.Text = _text;
		TextBlock largeText = LargeText;
		int length = _text.Length;
		if (1 == 0)
		{
		}
		int num = ((length <= 60) ? ((length <= 10) ? 120 : ((length > 30) ? 72 : 96)) : ((length > 120) ? 38 : 52));
		if (1 == 0)
		{
		}
		largeText.FontSize = num;
		Focus();
	}

	private void Window_KeyDown(object sender, KeyEventArgs e)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Invalid comparison between Unknown and I4
		if ((int)e.Key == 13)
		{
			Close();
		}
	}

	private void Window_MouseDown(object sender, MouseButtonEventArgs e)
	{
		Close();
	}

	private void Close_Click(object sender, RoutedEventArgs e)
	{
		Close();
	}

	[DebuggerNonUserCode]
	[GeneratedCode("PresentationBuildTasks", "10.0.5.0")]
	public void InitializeComponent()
	{
		if (!_contentLoaded)
		{
			_contentLoaded = true;
			Uri resourceLocator = new Uri("/AxCopilot;component/views/largetypewindow.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:
			((LargeTypeWindow)target).KeyDown += Window_KeyDown;
			((LargeTypeWindow)target).MouseDown += Window_MouseDown;
			((LargeTypeWindow)target).Loaded += Window_Loaded;
			break;
		case 2:
			Overlay = (Border)target;
			break;
		case 3:
			((Button)target).Click += Close_Click;
			break;
		case 4:
			LargeText = (TextBlock)target;
			break;
		default:
			_contentLoaded = true;
			break;
		}
	}
}
