private void UpdateHighlight(SuppaChatto data) { if (_highlight.DataContext is not SuperChatVM vm) { throw new InvalidOperationException($"Highlight VM is supposed to be {nameof(SuperChatVM)}, man!"); } vm.Name = data.DollaDollaBill?.Name?.Trim() ?? "UNKNOWN"; vm.Message = data.DollaDollaBill?.Message?.Trim() ?? "UNKNOWN"; var symbol = data.DollaDollaBill?.Currency?.Symbol.Value ?? "?"; var amount = data.DollaDollaBill?.Amount?.ToString(CultureInfo.InvariantCulture) ?? "XXXX"; vm.Amount = $"{symbol}{amount}"; vm.DirectionOfValuta = data.ValutaDirection ?? DirectionOfValuta.None; Debug.WriteLine($"Feedback VM direction set to {vm.DirectionOfValuta}"); var scData = FetchSuperChatData(data.DollaDollaBill?.Currency, data.DollaDollaBill?.Amount); vm.HeaderBackground = new SolidColorBrush(scData.HeaderBackground); vm.TextBackground = scData.TextBackground.HasValue ? new SolidColorBrush(scData.TextBackground.Value) : null; if (data.BoundingBox != null) { _highlight.PlacementRectangle = data.BoundingBox.Value; } else { _highlight.Placement = PlacementMode.Mouse; } _highlight.IsOpen = true; }
private void UpdateDebugWindow(SuppaChatto x) { if (x.BoundingBox == null) { return; } _debug.Left = x.BoundingBox.Value.Left; _debug.Top = x.BoundingBox.Value.Top; _debug.Width = x.BoundingBox.Value.Width; _debug.Height = x.BoundingBox.Value.Height; _debug.Visibility = Visibility.Visible; }