This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
/// <summary> | |
/// <see href="https://www.devleader.ca/2023/02/14/async-eventhandlers-a-simple-safety-net-to-the-rescue/">Async EventHandlers – A Simple Safety Net To The Rescue</see> | |
/// </summary> | |
public static class AsyncEventHandlers | |
{ | |
public static EventHandler<TArgs> TryAsync<TArgs>( | |
Func<object?, TArgs, Task> callback, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AttachableForStyleBehavior<TComponent, TBehavior> : Behavior<TComponent> | |
where TComponent : DependencyObject | |
where TBehavior : AttachableForStyleBehavior<TComponent, TBehavior>, new() | |
{ | |
public static readonly DependencyProperty IsEnabledForStyleProperty = | |
DependencyProperty.RegisterAttached( | |
"IsEnabledForStyle", | |
typeof(bool), | |
typeof(AttachableForStyleBehavior<TComponent, TBehavior>), | |
new FrameworkPropertyMetadata(false, OnIsEnabledForStyleChanged)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Windows; | |
using System.Windows.Controls; | |
/// <summary> | |
/// <see href="https://stackoverflow.com/a/26543731/4380178">Deferred loading of XAML</see> | |
/// </summary> | |
public class DeferredContent : ContentPresenter | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Media; | |
using System.Windows.Shapes; | |
/// <summary> | |
/// <see href="https://stackoverflow.com/a/72138376/4380178">How can I achieve a dashed or dotted border in WPF?</see> | |
/// </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from enum import Enum | |
from typing import Union, Optional | |
from openpyxl.cell.cell import Cell, MergedCell | |
from openpyxl.worksheet.cell_range import CellRange | |
from openpyxl.worksheet.worksheet import Worksheet | |
class Direction(Enum): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from enum import Enum | |
import win32com.client as win32 | |
class Overwrite(Enum): | |
ASK = 0 | |
ALWAYS = 1 | |
NEVER = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Windows.Threading; | |
/// <summary> | |
/// Debounce Dispatcher. | |
/// <para> | |
/// forked from: <seealso href="https://github.com/CommunityToolkit/WindowsCommunityToolkit/blob/main/Microsoft.Toolkit.Uwp/Extensions/DispatcherQueueTimerExtensions.cs">Microsoft.Toolkit.Uwp.Extensions.DispatcherQueueTimerExtensions</seealso>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// 表示一条包含基本要素的字幕。 | |
/// </summary> | |
public interface ISubtitle | |
{ | |
/// <summary> | |
/// 获取或设置字幕的开始时间。 | |
/// </summary> | |
public TimeSpan Begin { get; set; } |