Idk, dev work goin on
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using WinWARP.Core.Enums;
|
||||
using WinWARP.Core.Services.Interfaces;
|
||||
using WinWARP.Ui.Helpers;
|
||||
using WinWARP.Ui.Views.Dialogs;
|
||||
|
||||
namespace WinWARP.Ui.Services;
|
||||
|
||||
public class DialogService : IDialogService
|
||||
{
|
||||
private readonly XamlRootTracker _tracker;
|
||||
|
||||
public DialogService(XamlRootTracker tracker)
|
||||
{
|
||||
_tracker = tracker;
|
||||
}
|
||||
|
||||
public async Task<(CommonDialogResult Result, string Title, string URL, int UpdateInterval)> ShowAddSubscriptionAsync()
|
||||
{
|
||||
var dialog = App.Services.GetRequiredService<AddSubscriptionDialog>();
|
||||
//dialog.Title = "Add new subscription";
|
||||
//dialog.PrimaryButtonText = "Add";
|
||||
//dialog.CloseButtonText = "Cancel";
|
||||
dialog.XamlRoot = _tracker.XamlRoot;
|
||||
dialog.Style = Application.Current.Resources["DefaultContentDialogStyle"] as Style;
|
||||
|
||||
var result = await dialog.ShowAsync();
|
||||
|
||||
var mappedResult = result switch
|
||||
{
|
||||
ContentDialogResult.Primary => CommonDialogResult.Primary,
|
||||
ContentDialogResult.Secondary => CommonDialogResult.Secondary,
|
||||
ContentDialogResult.None => CommonDialogResult.Cancel,
|
||||
_ => CommonDialogResult.None
|
||||
};
|
||||
|
||||
return (mappedResult, dialog.ViewModel.CustomName, dialog.ViewModel.SubscriptionLink, dialog.ViewModel.UpdateInterval);
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,11 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using WinWARP.Core.Services.Interfaces;
|
||||
using WinWARP.Ui.Helpers;
|
||||
|
||||
namespace WinWARP.Ui.Services;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user