twitch vod downloading done
ffmpeg essentials fix Project reorganized git lfs ffmpeg removed ffmpeg added
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||
<RootNamespace>VDownload.Services.UI.WebView</RootNamespace>
|
||||
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
|
||||
<UseWinUI>true</UseWinUI>
|
||||
<UseRidGraph>true</UseRidGraph>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="WebViewWindow.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.240211001" />
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="WebViewWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Services.UI.WebView
|
||||
{
|
||||
public interface IWebViewService
|
||||
{
|
||||
Task<string> Show(Uri url, Predicate<string> closePredicate, string name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class WebViewService : IWebViewService
|
||||
{
|
||||
#region METHODS
|
||||
|
||||
public async Task<string> Show(Uri url, Predicate<string> closePredicate, string name)
|
||||
{
|
||||
WebViewWindow window = new WebViewWindow(name);
|
||||
return await window.Show(url, closePredicate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Window
|
||||
x:Class="VDownload.Services.UI.WebView.WebViewWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:VDownload.Services.UI.WebView"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Closed="Window_Closed">
|
||||
<WebView2 x:Name="WebView" NavigationCompleted="WebView_NavigationCompleted"/>
|
||||
</Window>
|
||||
@@ -0,0 +1,89 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
|
||||
namespace VDownload.Services.UI.WebView
|
||||
{
|
||||
public sealed partial class WebViewWindow : Window
|
||||
{
|
||||
#region FIEDLS
|
||||
|
||||
private readonly Predicate<string> _defaultClosePredicate = args => false;
|
||||
|
||||
private bool _isOpened;
|
||||
private Predicate<string> _closePredicate;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
public WebViewWindow(string name)
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Title = name;
|
||||
|
||||
_isOpened = false;
|
||||
_closePredicate = _defaultClosePredicate;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
internal async Task<string> Show(Uri url, Predicate<string> closePredicate)
|
||||
{
|
||||
this.WebView.Source = url;
|
||||
_closePredicate = closePredicate;
|
||||
|
||||
this.Activate();
|
||||
_isOpened = true;
|
||||
while (_isOpened)
|
||||
{
|
||||
await Task.Delay(10);
|
||||
}
|
||||
|
||||
_closePredicate = _defaultClosePredicate;
|
||||
|
||||
return this.WebView.Source.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region EVENT HANDLER
|
||||
|
||||
|
||||
private void WebView_NavigationCompleted(WebView2 sender, CoreWebView2NavigationCompletedEventArgs args)
|
||||
{
|
||||
if (_closePredicate.Invoke(this.WebView.Source.ToString()))
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Closed(object sender, WindowEventArgs args)
|
||||
{
|
||||
_isOpened = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user