LunarPresentation/Dialogs/InputWindow.xaml.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace SHomeWorkshop.LunarPresentation.Dialogs
{
    /// <summary>
    /// Interaction logic for InputWindow.xaml
    /// </summary>
    public partial class InputWindow : Window
    {
        public InputWindow(Window parentWindow, string promptText, string defaultText,
            string windowTitle, char[] invalidatedChars = null, bool closeInputMethod = false)
        {
            InitializeComponent();
            this.Owner = parentWindow;

            PromptText = promptText;
            InputedText = defaultText;

            this.Title = windowTitle;
            this.invalidatedChars = invalidatedChars;

            inputTextBox.Focus();
            inputTextBox.SelectAll();

            if (closeInputMethod)
            {
                Globals.SwitchInputMethod(false);
            }
            else
            {
                Globals.SwitchInputMethod(true);
            }
        }

        public string PromptText
        {
            get { return promptTextBlock.Text; }
            set { promptTextBlock.Text = value; }
        }

        private void inputTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                buttonOk_Click(sender, e);
            }
            else if (e.Key == Key.Escape)
            {
                this.DialogResult = false;
                this.Close();
            }
            else if (e.Key == Key.F1)
            {
                if (this.invalidatedChars != null &&
                    this.invalidatedChars.Length > 0)
后面还有 75 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。