Phase B (T1-5/T1-6/T2-2/T2-8/T2-12): download manager flyout w/ speed+pause/resume/cancel, bookmark bar, tab sleeping, tab search (open+closed), context menu w/ 'download video from this link' (79 tests GREEN)
This commit is contained in:
parent
af19dba8f4
commit
0caa1111e7
9 changed files with 763 additions and 3 deletions
|
|
@ -0,0 +1,39 @@
|
|||
using System.Windows.Data;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
|
||||
namespace VideoDownloader.App.Browser.Features;
|
||||
|
||||
/// <summary>CoreWebView2DownloadOperation → IDownloadOperation 어댑터.</summary>
|
||||
public sealed class DownloadOperationAdapter : IDownloadOperation
|
||||
{
|
||||
private readonly CoreWebView2DownloadOperation _op;
|
||||
public DownloadOperationAdapter(CoreWebView2DownloadOperation op) => _op = op;
|
||||
|
||||
public string Uri => _op.Uri ?? "";
|
||||
public string FileName => Path.GetFileName(_op.ResultFilePath ?? "");
|
||||
public long BytesReceived => (long)_op.BytesReceived;
|
||||
public long TotalBytesToReceive => (long)(_op.TotalBytesToReceive ?? 0);
|
||||
public string State => _op.State.ToString();
|
||||
|
||||
public void Pause() => _op.Pause();
|
||||
public void Resume() => _op.Resume();
|
||||
public void Cancel() => _op.Cancel();
|
||||
|
||||
public event Action? Changed
|
||||
{
|
||||
add { _op.BytesReceivedChanged += (_, _) => value?.Invoke(); _op.StateChanged += (_, _) => value?.Invoke(); }
|
||||
remove { }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>탭 검색 결과의 IsClosed → "닫힘" 라벨 변환.</summary>
|
||||
public sealed class BoolToClosedConverter : IValueConverter
|
||||
{
|
||||
public static readonly BoolToClosedConverter Instance = new();
|
||||
|
||||
public object Convert(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture)
|
||||
=> value is true ? "닫힘 · 클릭해서 복원" : "";
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture)
|
||||
=> throw new NotSupportedException();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue