PsHandler.PokerTypes.WindowPokerTypeEdit.WindowPokerTypeEdit C# (CSharp) Method

WindowPokerTypeEdit() public method

public WindowPokerTypeEdit ( Window owner, PokerType pokerType = null ) : System
owner System.Windows.Window
pokerType PokerType
return System
        public WindowPokerTypeEdit(Window owner, PokerType pokerType = null)
        {
            InitializeComponent();
            Owner = owner;
            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            PokerType = pokerType ?? new PokerType();

            // Hook

            Closing += (sender, args) => { if (_windowWindowsInfo != null) { _windowWindowsInfo.Close(); } };

            TextBox_RegexWindowTitle.TextChanged += (sender, args) => UpdateIFilter();
            TextBox_RegexWindowClass.TextChanged += (sender, args) => UpdateIFilter();

            TextBox_LevelLength.TextChanged += (sender, args) =>
            {
                try
                {
                    TimeSpan.Parse(TextBox_LevelLength.Text);
                    TextBox_LevelLength.Background = Brushes.Honeydew;
                }
                catch
                {
                    TextBox_LevelLength.Background = Brushes.MistyRose;
                }
            };
            Loaded += (sender, args) =>
            {
                string text = TextBox_RegexWindowTitle.Text; TextBox_RegexWindowTitle.Text = text + "1"; TextBox_RegexWindowTitle.Text = text;
                text = TextBox_RegexWindowClass.Text; TextBox_RegexWindowClass.Text = text + "1"; TextBox_RegexWindowClass.Text = text;
            };

            // Seed

            TextBox_Name.Text = PokerType.Name;
            TextBox_LevelLength.Text = PokerType.LevelLength.ToString();
            TextBox_RegexWindowTitle.Text = PokerType.RegexWindowTitle == null ? "" : PokerType.RegexWindowTitle.ToString();
            TextBox_RegexWindowClass.Text = PokerType.RegexWindowClass == null ? "" : PokerType.RegexWindowClass.ToString();

            // ToolTips

            Label_RegexWindowTitle.ToolTip = "Regular Expression (Regex) for window's title. You can learn and test regex at: http://rubular.com/ or any other similar site.";
            ToolTipService.SetShowDuration(Label_RegexWindowTitle, 60000);

            Label_RegexWindowClass.ToolTip = "Regular Expression (Regex) for window's class name. You can learn and test regex at: http://rubular.com/ or any other similar site.";
            ToolTipService.SetShowDuration(Label_RegexWindowClass, 60000);
        }