mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Broke the surface editor
Added device properties to surface editor though!
This commit is contained in:
1 parent
6cf3344ce7
commit
9e15bd51e8
20 files changed
+444
-79
No files matched your search
@@ -1,4 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.UI.Screens.Dialogs;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.ViewModels.Dialogs;
|
||||
@@ -7,7 +10,7 @@ using Ninject;
|
||||
using Ninject.Parameters;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Services
|
||||
namespace Artemis.UI.Services.Dialog
|
||||
{
|
||||
public class DialogService : IDialogService
|
||||
{
|
||||
@@ -46,16 +49,44 @@ namespace Artemis.UI.Services
|
||||
return (bool) result;
|
||||
}
|
||||
|
||||
public async Task<object> ShowDialog<T>(IParameter[] parameters = null) where T : DialogViewModelBase
|
||||
public async Task<object> ShowDialog<T>() where T : DialogViewModelBase
|
||||
{
|
||||
var viewModel = parameters != null ? _kernel.Get<T>(parameters) : _kernel.Get<T>();
|
||||
return await ShowDialog(null, viewModel);
|
||||
return await ShowDialog("RootDialog", _kernel.Get<T>());
|
||||
}
|
||||
|
||||
public async Task<object> ShowDialogAt<T>(string identifier, IParameter[] parameters = null) where T : DialogViewModelBase
|
||||
public Task<object> ShowDialog<T>(Dictionary<string, object> parameters) where T : DialogViewModelBase
|
||||
{
|
||||
var viewModel = parameters != null ? _kernel.Get<T>(parameters) : _kernel.Get<T>();
|
||||
return await ShowDialog(identifier, viewModel);
|
||||
if (parameters == null)
|
||||
throw new ArgumentNullException(nameof(parameters));
|
||||
|
||||
var paramsArray = parameters.Select(kv => new ConstructorArgument(kv.Key, kv.Value)).Cast<IParameter>().ToArray();
|
||||
return ShowDialog<T>(paramsArray);
|
||||
}
|
||||
|
||||
public async Task<object> ShowDialog<T>(IParameter[] parameters) where T : DialogViewModelBase
|
||||
{
|
||||
if (parameters == null) throw new ArgumentNullException(nameof(parameters));
|
||||
return await ShowDialog("RootDialog", _kernel.Get<T>(parameters));
|
||||
}
|
||||
|
||||
public async Task<object> ShowDialogAt<T>(string identifier) where T : DialogViewModelBase
|
||||
{
|
||||
return await ShowDialog(identifier, _kernel.Get<T>());
|
||||
}
|
||||
|
||||
public async Task<object> ShowDialogAt<T>(string identifier, Dictionary<string, object> parameters) where T : DialogViewModelBase
|
||||
{
|
||||
if (parameters == null)
|
||||
throw new ArgumentNullException(nameof(parameters));
|
||||
|
||||
var paramsArray = parameters.Select(kv => new ConstructorArgument(kv.Key, kv.Value)).Cast<IParameter>().ToArray();
|
||||
return await ShowDialogAt<T>(identifier, paramsArray);
|
||||
}
|
||||
|
||||
public async Task<object> ShowDialogAt<T>(string identifier, IParameter[] parameters) where T : DialogViewModelBase
|
||||
{
|
||||
if (parameters == null) throw new ArgumentNullException(nameof(parameters));
|
||||
return await ShowDialog(identifier, _kernel.Get<T>(parameters));
|
||||
}
|
||||
|
||||
private async Task<object> ShowDialog(string identifier, DialogViewModelBase viewModel)
|
||||
|
||||
@@ -1,14 +1,97 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.UI.ViewModels.Dialogs;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Ninject.Parameters;
|
||||
|
||||
namespace Artemis.UI.Services.Interfaces
|
||||
{
|
||||
public interface IDialogService : IArtemisUIService
|
||||
{
|
||||
/// <summary>
|
||||
/// Shows a confirm dialog on the dialog host provided in <see cref="identifier" />.
|
||||
/// </summary>
|
||||
/// <param name="header">The title of the dialog</param>
|
||||
/// <param name="text">The body text of the dialog</param>
|
||||
/// <param name="confirmText">The text of the confirm button, defaults to "Confirm"</param>
|
||||
/// <param name="cancelText">The text of the cancel button, defaults to "Cancel"</param>
|
||||
/// <returns>A task that resolves to true if confirmed and false if cancelled</returns>
|
||||
Task<bool> ShowConfirmDialog(string header, string text, string confirmText = "Confirm", string cancelText = "Cancel");
|
||||
|
||||
/// <summary>
|
||||
/// Shows a confirm dialog on the dialog host provided in <see cref="identifier" />.
|
||||
/// </summary>
|
||||
/// <param name="identifier">
|
||||
/// The identifier of the <see cref="DialogHost" /> to use eg.
|
||||
/// <code><materialDesign:DialogHost Identifier="MyDialogHost"></code>
|
||||
/// </param>
|
||||
/// <param name="header">The title of the dialog</param>
|
||||
/// <param name="text">The body text of the dialog</param>
|
||||
/// <param name="confirmText">The text of the confirm button, defaults to "Confirm"</param>
|
||||
/// <param name="cancelText">The text of the cancel button, defaults to "Cancel"</param>
|
||||
/// <returns>A task that resolves to true if confirmed and false if cancelled</returns>
|
||||
Task<bool> ShowConfirmDialogAt(string identifier, string header, string text, string confirmText = "Confirm", string cancelText = "Cancel");
|
||||
Task<object> ShowDialog<T>(IParameter[] parameters = null) where T : DialogViewModelBase;
|
||||
Task<object> ShowDialogAt<T>(string identifier, IParameter[] parameters = null) where T : DialogViewModelBase;
|
||||
|
||||
/// <summary>
|
||||
/// Shows a dialog by initializing a view model implementing <see cref="DialogViewModelBase" />
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the view model</typeparam>
|
||||
/// <returns>A task resolving to the result of the dialog's <see cref="DialogSession" /></returns>
|
||||
Task<object> ShowDialog<T>() where T : DialogViewModelBase;
|
||||
|
||||
/// <summary>
|
||||
/// Shows a dialog by initializing a view model implementing <see cref="DialogViewModelBase" /> with arguments passed
|
||||
/// to the view models constructor
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the view model</typeparam>
|
||||
/// <param name="parameters">A dictionary of constructor arguments to pass to the view model</param>
|
||||
/// <returns>A task resolving to the result of the dialog's <see cref="DialogSession" /></returns>
|
||||
Task<object> ShowDialog<T>(Dictionary<string, object> parameters) where T : DialogViewModelBase;
|
||||
|
||||
/// <summary>
|
||||
/// Shows a dialog by initializing a view model implementing <see cref="DialogViewModelBase" /> using an array of
|
||||
/// Ninject <see cref="IParameter" />, requires you to reference Ninject
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the view model</typeparam>
|
||||
/// <param name="parameters">An array of Ninject <see cref="IParameter" /> to pass to the view model during activation</param>
|
||||
/// <returns>A task resolving to the result of the dialog's <see cref="DialogSession" /></returns>
|
||||
Task<object> ShowDialog<T>(IParameter[] parameters) where T : DialogViewModelBase;
|
||||
|
||||
/// <summary>
|
||||
/// Shows a dialog by initializing a view model implementing <see cref="DialogViewModelBase" />
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the view model</typeparam>
|
||||
/// <param name="identifier">
|
||||
/// The identifier of the <see cref="DialogHost" /> to use eg.
|
||||
/// <code><materialDesign:DialogHost Identifier="MyDialogHost"></code>
|
||||
/// </param>
|
||||
/// <returns>A task resolving to the result of the dialog's <see cref="DialogSession" /></returns>
|
||||
Task<object> ShowDialogAt<T>(string identifier) where T : DialogViewModelBase;
|
||||
|
||||
/// <summary>
|
||||
/// Shows a dialog by initializing a view model implementing <see cref="DialogViewModelBase" /> with arguments passed
|
||||
/// to the view models constructor
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the view model</typeparam>
|
||||
/// <param name="identifier">
|
||||
/// The identifier of the <see cref="DialogHost" /> to use eg.
|
||||
/// <code><materialDesign:DialogHost Identifier="MyDialogHost"></code>
|
||||
/// </param>
|
||||
/// <param name="parameters">A dictionary of constructor arguments to pass to the view model</param>
|
||||
/// <returns>A task resolving to the result of the dialog's <see cref="DialogSession" /></returns>
|
||||
Task<object> ShowDialogAt<T>(string identifier, Dictionary<string, object> parameters) where T : DialogViewModelBase;
|
||||
|
||||
/// <summary>
|
||||
/// Shows a dialog by initializing a view model implementing <see cref="DialogViewModelBase" /> using an array of
|
||||
/// Ninject <see cref="IParameter" />, requires you to reference Ninject
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the view model</typeparam>
|
||||
/// <param name="identifier">
|
||||
/// The identifier of the <see cref="DialogHost" /> to use eg.
|
||||
/// <code><materialDesign:DialogHost Identifier="MyDialogHost"></code>
|
||||
/// </param>
|
||||
/// <param name="parameters">An array of Ninject <see cref="IParameter" /> to pass to the view model during activation</param>
|
||||
/// <returns>A task resolving to the result of the dialog's <see cref="DialogSession" /></returns>
|
||||
Task<object> ShowDialogAt<T>(string identifier, IParameter[] parameters) where T : DialogViewModelBase;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user