public ListViewItemPokerType(PokerType pokerType) { PokerType = pokerType; StackPanel sp = new StackPanel { Orientation = Orientation.Horizontal }; Image image = new Image { Source = new BitmapImage(new Uri(string.Format(@"pack://application:,,,/Images/Resources/Size16x16/tag_blue.png"), UriKind.Absolute)), Width = 16, Height = 16, Margin = new Thickness(0, 0, 0, 0) }; Label label = new Label { Content = PokerType.Name, Padding = new Thickness(0), Margin = new Thickness(5, 0, 0, 0) }; sp.Children.Add(image); sp.Children.Add(label); Content = sp; }
public void SeedDefaultValues() { if (!_pokerTypes.Any()) { Add(PokerType.GetDefaultValues()); } }
public void Remove(PokerType pokerType) { lock (_lock) { _pokerTypes.Remove(pokerType); } }
public void Add(PokerType pokerType) { lock (_lock) { if (!_pokerTypes.Any(o => o.Name.Equals(pokerType.Name))) { _pokerTypes.Add(pokerType); } _pokerTypes.Sort((o0, o1) => string.CompareOrdinal(o0.Name, o1.Name)); } }
public void FromXElement(XElement xElement, ref List <ExceptionPsHandler> exceptions, string exceptionHeader) { foreach (XElement xPokerType in xElement.Elements("PokerType")) { PokerType pokerType = PokerType.FromXElement(xPokerType, ref exceptions, exceptionHeader); if (pokerType != null) { Add(pokerType); } } }
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 static PokerType FromXElement(XElement xElement, ref List <ExceptionPsHandler> exceptions, string exceptionHeader) { var pokerType = new PokerType(); try { pokerType.Name = xElement.Element("Name") == null ? "" : xElement.Element("Name").Value; } catch (Exception e) { exceptions.Add(new ExceptionPsHandler(e, exceptionHeader + " PokerType.FromXElement() xElement:" + Environment.NewLine + xElement)); return(null); } try { pokerType.LevelLength = new TimeSpan(long.Parse(xElement.Element("LevelLength").Value)); } catch { } try { pokerType.RegexWindowTitle = new Regex(xElement.Element("RegexWindowTitle").Value); } catch { } try { pokerType.RegexWindowClass = new Regex(xElement.Element("RegexWindowClass").Value); } catch { } return(pokerType); }
public static PokerType FromXElement(XElement xElement, ref List<ExceptionPsHandler> exceptions, string exceptionHeader) { var pokerType = new PokerType(); try { pokerType.Name = xElement.Element("Name") == null ? "" : xElement.Element("Name").Value; } catch (Exception e) { exceptions.Add(new ExceptionPsHandler(e, exceptionHeader + " PokerType.FromXElement() xElement:" + Environment.NewLine + xElement)); return null; } try { pokerType.LevelLength = new TimeSpan(long.Parse(xElement.Element("LevelLength").Value)); } catch { } try { pokerType.RegexWindowTitle = new Regex(xElement.Element("RegexWindowTitle").Value); } catch { } try { pokerType.RegexWindowClass = new Regex(xElement.Element("RegexWindowClass").Value); } catch { } return pokerType; }
public void UpdateListView(PokerType pokerTypeToSelect = null) { var listView = ListView_PokerTypes; listView.Items.Clear(); foreach (var tableTile in App.PokerTypeManager.GetPokerTypesCopy()) { listView.Items.Add(new ListViewItemPokerType(tableTile)); } if (pokerTypeToSelect != null) { foreach (var item in listView.Items) { if (((ListViewItemPokerType)item).PokerType.Name.Equals(pokerTypeToSelect.Name)) { listView.SelectedItem = item; break; } } } GridView_Name.ResetColumnWidths(); }
private void GetContentTimer(string title, string className, Tournament tournament, decimal sb, decimal bb, out string value, out bool visibility) { if (!Config.HudTimerShowHandCount) { int pokerTypeErrors = -1; if (PokerType == null) { PokerType = App.PokerTypeManager.GetPokerType(title, className, out pokerTypeErrors); if (pokerTypeErrors != 0) { PokerType = null; } } if (PokerType != null) { DateTime dateTimeUtcNow = DateTime.UtcNow.AddSeconds(-Config.HudTimerDiff); DateTime dateTimeUtcNextLevel = tournament.GetFirstHandTimestampET(); while (dateTimeUtcNextLevel < dateTimeUtcNow) { dateTimeUtcNextLevel = dateTimeUtcNextLevel + PokerType.LevelLength; } TimeSpan timeSpan = dateTimeUtcNextLevel - dateTimeUtcNow; value = string.Format("{0:00}:{1:00}", timeSpan.Minutes, timeSpan.Seconds); } else { if (pokerTypeErrors == 1) { value = Config.HudTimerPokerTypeNotFound; } else if (pokerTypeErrors == 2) { value = Config.HudTimerMultiplePokerTypes; } else { value = string.Format("Unknown Error"); } } } else { value = string.Format("{0}", tournament.CountLevelHands(sb, bb) + 1); } visibility = true; }