Files
YouTube-Manager/Manager.App/Components/Application/Dev/DevelopmentVideo.razor.cs
2025-11-02 21:22:56 +01:00

40 lines
1.2 KiB
C#

using Manager.App.Models.System;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using MudBlazor;
namespace Manager.App.Components.Application.Dev;
public partial class DevelopmentVideo : ComponentBase
{
private YouTubeClientItem? _selectedClient;
private string _videoId = "";
private async Task<IEnumerable<YouTubeClientItem>> SearchClientsAsync(string? search, CancellationToken cancellationToken)
{
var searchResults = await ClientService.GetClientsAsync(search, cancellationToken: cancellationToken);
return !searchResults.IsSuccess ? [] : searchResults.Value;
}
private async Task GetDataAsync(MouseEventArgs obj)
{
if (_selectedClient == null)
{
Snackbar.Add("No client selected!", Severity.Warning);
return;
}
if (string.IsNullOrWhiteSpace(_videoId))
{
Snackbar.Add("No video ID set!", Severity.Warning);
return;
}
if (_videoId.Length != 11)
{
Snackbar.Add("Video ID needs to have an length of 11 chars!", Severity.Warning);
}
NavigationManager.NavigateTo($"/video/{_videoId}?clientId={_selectedClient.Id}");
}
}