PsHandler.PokerTypes.WindowPokerTypeEdit.Button_OK_Click C# (CSharp) 메소드

Button_OK_Click() 개인적인 메소드

private Button_OK_Click ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
리턴 void
        private void Button_OK_Click(object sender, RoutedEventArgs e)
        {
            if (TextBox_Name.Text.Length == 0)
            {
                WindowMessage.ShowDialog(string.Format("Invalid '{0}' input.", Label_Name.Content), "Error saving", WindowMessageButtons.OK, WindowMessageImage.Error, this);
                return;
            }
            if (App.PokerTypeManager.GetPokerTypesCopy().Any(o => o.Name.ToLowerInvariant().Equals(TextBox_Name.Text.ToLowerInvariant())))
            {
                WindowMessage.ShowDialog("Cannot save. Duplicate names.", "Error saving", WindowMessageButtons.OK, WindowMessageImage.Error, this);
                return;
            }
            try
            {
                PokerType.LevelLength = TimeSpan.Parse(TextBox_LevelLength.Text);
            }
            catch
            {
                WindowMessage.ShowDialog(string.Format("Invalid '{0}' input.", Label_LevelLength.Content), "Error saving", WindowMessageButtons.OK, WindowMessageImage.Error, this);
                return;
            }
            try
            {
                new Regex(TextBox_RegexWindowTitle.Text);
            }
            catch
            {
                WindowMessage.ShowDialog(string.Format("Invalid '{0}' input.", Label_RegexWindowTitle.Content), "Error saving", WindowMessageButtons.OK, WindowMessageImage.Error, this);
                return;
            }
            try
            {
                new Regex(TextBox_RegexWindowClass.Text);
            }
            catch
            {
                WindowMessage.ShowDialog(string.Format("Invalid '{0}' input.", Label_RegexWindowClass.Content), "Error saving", WindowMessageButtons.OK, WindowMessageImage.Error, this);
                return;
            }

            PokerType.Name = TextBox_Name.Text;
            //PokerType.LevelLength = TimeSpan.Parse(TextBox_LevelLength.Text);
            PokerType.RegexWindowTitle = new Regex(TextBox_RegexWindowTitle.Text);
            PokerType.RegexWindowClass = new Regex(TextBox_RegexWindowClass.Text);

            Saved = true;
            Close();
        }