private void ApplyOwnTickerWindowCommand(string commandName) { var window = new TickerWindow(); window.Title = commandName; window.Initialise(commandName); window.Show(); }
/// <summary> /// Windowをリフレッシュする /// </summary> /// <param name="telop">テロップ</param> public void RefreshTelopOverlays( IReadOnlyList <Ticker> telops) { void refreshTelop( Ticker telop) { if (!this.telopWindowList.TryGetValue(telop.ID, out TickerWindow w)) { w = new TickerWindow() { Title = "OnePointTelop - " + telop.Title, DataSource = telop, Opacity = 0, Topmost = false, }; this.telopWindowList.TryAdd(telop.ID, w); if (Settings.Default.ClickThroughEnabled) { w.ToTransparentWindow(); } w.Show(); } if (telop.IsTemporaryDisplay || (Settings.Default.OverlayVisible && Settings.Default.TelopAlwaysVisible)) { w.Refresh(); if (w.ShowOverlay()) { w.StartProgressBar(true); } return; } // 実際のテロップの位置を取得しておく telop.Left = w.Left; telop.Top = w.Top; if (telop.MatchDateTime > DateTime.MinValue) { var start = telop.MatchDateTime.AddSeconds(telop.Delay); var end = telop.MatchDateTime.AddSeconds(telop.Delay + telop.DisplayTime); if (start <= DateTime.Now && DateTime.Now <= end) { w.Refresh(); w.ShowOverlay(); w.StartProgressBar(); } else { w.HideOverlay(); if (DateTime.Now > end) { telop.MatchDateTime = DateTime.MinValue; telop.MessageReplaced = string.Empty; } } if (telop.ForceHide) { w.HideOverlay(); telop.MatchDateTime = DateTime.MinValue; telop.MessageReplaced = string.Empty; } } else { w.HideOverlay(); telop.MessageReplaced = string.Empty; } } foreach (var telop in telops) { #if DEBUG var sw = Stopwatch.StartNew(); #endif refreshTelop(telop); #if DEBUG sw.Stop(); if (telop.IsTemporaryDisplay && sw.Elapsed.TotalMilliseconds >= 1.0) { Debug.WriteLine($"●refreshTelop {telop.Title} {sw.Elapsed.TotalMilliseconds:N0}ms"); } #endif } }