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); }
public WindowTableTileEdit(Window owner, TableTile tableTile = null) { InitializeComponent(); Owner = owner; WindowStartupLocation = WindowStartupLocation.CenterOwner; TableTile = tableTile ?? new TableTile(); // Hook Grid_Main.MouseLeftButtonDown += (sender, args) => Grid_Main.Focus(); Closing += (sender, args) => { if (_windowWindowsInfo != null) { _windowWindowsInfo.Close(); } if (_windowGenerateLayout != null) { _windowGenerateLayout.Close(); } }; TextBox_RegexWindowTitle.TextChanged += (sender, args) => UpdateIFilter(); TextBox_RegexWindowClass.TextChanged += (sender, args) => UpdateIFilter(); TextBox_XYWidthHeight.TextChanged += (sender, args) => UCScreenPreview_Main_Update(); CheckBox_SortTournamentsByStartingTime.Checked += (sender, args) => UCScreenPreview_Main_Update(); CheckBox_SortTournamentsByStartingTime.Unchecked += (sender, args) => UCScreenPreview_Main_Update(); CheckBox_EnableAutoTile.Checked += (sender, args) => { RadioButton_ToTheTop.IsEnabled = true; RadioButton_ToTheClosest.IsEnabled = true; Label_DisabledToTheTop.Visibility = Visibility.Collapsed; Label_DisabledToTheClosest.Visibility = Visibility.Collapsed; }; CheckBox_EnableAutoTile.Unchecked += (sender, args) => { RadioButton_ToTheTop.IsEnabled = false; RadioButton_ToTheClosest.IsEnabled = false; Label_DisabledToTheTop.Visibility = Visibility.Visible; Label_DisabledToTheClosest.Visibility = Visibility.Visible; }; SizeChanged += (sender, args) => UCScreenPreview_Main_Update(); Loaded += (sender, args) => { string text = TextBox_XYWidthHeight.Text; TextBox_XYWidthHeight.Text = text + "1"; TextBox_XYWidthHeight.Text = text; 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 = TableTile.Name; TextBoxHotkey_Hotkey.KeyCombination = TableTile.KeyCombination; CheckBox_SortTournamentsByStartingTime.IsChecked = TableTile.SortByStartingHand; TextBox_RegexWindowTitle.Text = TableTile.RegexWindowTitle == null ? "" : TableTile.RegexWindowTitle.ToString(); TextBox_RegexWindowClass.Text = TableTile.RegexWindowClass == null ? "" : TableTile.RegexWindowClass.ToString(); StringBuilder sb = new StringBuilder(); foreach (var xywh in TableTile.XYWHs) { sb.Append(string.Format("{0} {1} {2} {3}{4}", xywh.X, xywh.Y, xywh.Width, xywh.Height, Environment.NewLine)); } TextBox_XYWidthHeight.Text = sb.ToString(); CheckBox_SortTournamentsByStartingTime.IsChecked = TableTile.SortByStartingHand; CheckBox_BringToFront.IsChecked = TableTile.BringToFront; CheckBox_EnableAutoTile.IsChecked = TableTile.AutoTile; switch (TableTile.AutoTileMethod) { case AutoTileMethod.ToTheTopSlot: RadioButton_ToTheTop.IsChecked = true; break; case AutoTileMethod.ToTheClosestSlot: RadioButton_ToTheClosest.IsChecked = true; break; } TextBox_TableCountEqualOrGreaterThan.Text = string.Format("{0}", TableTile.TableCountEqualOrGreaterThan); TextBox_TableCountEqualOrLessThan.Text = string.Format("{0}", TableTile.TableCountEqualOrLessThan); // ToolTips GroupBox_XYWidthHeight.ToolTip = "Create slots (one per line): X Y Width Height"; ToolTipService.SetShowDuration(GroupBox_XYWidthHeight, 60000); CheckBox_SortTournamentsByStartingTime.ToolTip = "Older tournaments will target upper slots (cash tables won't be affected)."; ToolTipService.SetShowDuration(CheckBox_SortTournamentsByStartingTime, 60000); 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); RadioButton_ToTheTop.ToolTip = new UCToolTipTableTilerAutoTileTop(); ToolTipService.SetShowDuration(RadioButton_ToTheTop, 60000); RadioButton_ToTheClosest.ToolTip = new UCToolTipTableTilerAutoTileClosest(); ToolTipService.SetShowDuration(RadioButton_ToTheClosest, 60000); Label_DisabledToTheTop.ToolTip = new UCToolTipTableTilerAutoTileTop(); ToolTipService.SetShowDuration(Label_DisabledToTheTop, 60000); Label_DisabledToTheClosest.ToolTip = new UCToolTipTableTilerAutoTileClosest(); ToolTipService.SetShowDuration(Label_DisabledToTheClosest, 60000); UCScreenPreview_Main_Update(); }