protected UpdaterManager(IMessageUIManager message, IFileManager file, AppUserData data, IAppInstanceData instanceData) { Message = message ?? throw new ArgumentNullException(nameof(message)); File = file ?? throw new ArgumentNullException(nameof(file)); Data = data ?? throw new ArgumentNullException(nameof(data)); InstanceData = instanceData ?? throw new ArgumentNullException(nameof(instanceData)); }
public GameBackups_Manager(IFileManager fileManager, IMessageUIManager messageUiManager, AppViewModel app, AppUserData data) { File = fileManager ?? throw new ArgumentNullException(nameof(fileManager)); Message = messageUiManager ?? throw new ArgumentNullException(nameof(messageUiManager)); App = app ?? throw new ArgumentNullException(nameof(app)); Data = data ?? throw new ArgumentNullException(nameof(data)); }
public static async Task DisplayExceptionMessageAsync(this IMessageUIManager messageUIManager, Exception exception, string message = null, string header = null, bool allowCancel = false) { var msg = String.Format(Resources.App_ExceptionMessage, message ?? Resources.App_ExceptionMessageDefaultMessage, exception?.Message); header ??= Resources.App_ExceptionMessageDefaultHeader; // Show the message await messageUIManager.DisplayMessageAsync(msg, header, MessageType.Error, allowCancel); }
/// <summary> /// Displays a successful message if set to do so /// </summary> /// <param name="messageUIManager">The UI manager</param> /// <param name="message">The message</param> /// <param name="header">The message header</param> /// <param name="origin">The caller member name (leave at default for compiler-time value)</param> /// <param name="filePath">The caller file path (leave at default for compiler-time value)</param> /// <param name="lineNumber">The caller line number (leave at default for compiler-time value)</param> public static async Task DisplaySuccessfulActionMessageAsync(this IMessageUIManager messageUIManager, string message, string header = null, [CallerMemberName] string origin = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) { // Make sure the setting to show success messages is on if (!RCPServices.Data.ShowActionComplete) { RL.Logger?.LogTraceSource($"A message of type {MessageType.Success} was not displayed with the content of: '{message}'", origin: origin, filePath: filePath, lineNumber: lineNumber); return; } // Show the message await messageUIManager.DisplayMessageAsync(message, header ?? Resources.ActionSucceeded, MessageType.Success, origin, filePath, lineNumber); }
public static async Task DisplaySuccessfulActionMessageAsync(this IMessageUIManager messageUIManager, string message, string header = null) { // Make sure the setting to show success messages is on if (!Services.Data.App_ShowActionComplete) { Logger.Trace("A message of type {0} was not displayed with the content of: '{1}'", MessageType.Success, message); return; } // Show the message await messageUIManager.DisplayMessageAsync(message, header ?? Resources.ActionSucceeded, MessageType.Success); }
public AppViewModel(IUpdaterManager updater, IMessageUIManager message, IFileManager file, AppUIManager ui, AppUserData data) { // Set properties Updater = updater ?? throw new ArgumentNullException(nameof(updater)); Message = message ?? throw new ArgumentNullException(nameof(message)); File = file ?? throw new ArgumentNullException(nameof(file)); UI = ui ?? throw new ArgumentNullException(nameof(ui)); Data = data ?? throw new ArgumentNullException(nameof(data)); // Flag that the startup has begun IsStartupRunning = true; // Check if the application is running as administrator try { IsRunningAsAdmin = WindowsHelpers.RunningAsAdmin; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); IsRunningAsAdmin = false; } AppTitle = IsRunningAsAdmin ? Resources.AppNameAdmin : Resources.AppName; LoadOperation = new Operation(() => IsLoading = true, () => IsLoading = false); // Create locks SaveUserDataAsyncLock = new AsyncLock(); MoveBackupsAsyncLock = new AsyncLock(); AdminWorkerAsyncLock = new AsyncLock(); OnRefreshRequiredAsyncLock = new AsyncLock(); // Create commands RestartAsAdminCommand = new AsyncRelayCommand(RestartAsAdminAsync); RequestRestartAsAdminCommand = new AsyncRelayCommand(RequestRestartAsAdminAsync); // Read the game manager configuration var gameConfig = Files.Games; // Set up the games manager GamesManager = JsonConvert.DeserializeObject <AppGamesManager>(gameConfig, new SimpleTypeConverter()) ?? throw new InvalidOperationException("Deserialized game manager is null"); }
/// <summary> /// Displays a message from an <see cref="Exception"/> /// </summary> /// <param name="messageUIManager">The UI manager</param> /// <param name="exception">The exception</param> /// <param name="message">The message</param> /// <param name="header">The message header</param> /// <param name="origin">The caller member name (leave at default for compiler-time value)</param> /// <param name="filePath">The caller file path (leave at default for compiler-time value)</param> /// <param name="lineNumber">The caller line number (leave at default for compiler-time value)</param> public static async Task DisplayExceptionMessageAsync(this IMessageUIManager messageUIManager, Exception exception, string message = null, string header = null, [CallerMemberName] string origin = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) { // Show the message await messageUIManager.DisplayMessageAsync(String.Format(Resources.App_ExceptionMessage, message ?? Resources.App_ExceptionMessageDefaultMessage, exception?.Message), header ?? Resources.App_ExceptionMessageDefaultHeader, MessageType.Error, origin, filePath, lineNumber); }
public RCPFileManager(IMessageUIManager message) { Message = message ?? throw new ArgumentNullException(nameof(message)); }
public RCPUpdaterManager(IMessageUIManager message, IFileManager file, AppUserData data, IAppInstanceData instanceData) : base(message, file, data, instanceData) { }
public static async Task <bool> DisplayMessageAsync(this IMessageUIManager messageUIManager, string message) => await messageUIManager.DisplayMessageAsync(message, null, MessageType.Generic, false);
public static async Task <bool> DisplayMessageAsync(this IMessageUIManager messageUIManager, string message, MessageType messageType, bool allowCancel) => await messageUIManager.DisplayMessageAsync(message, null, messageType, allowCancel);
public static async Task <bool> DisplayMessageAsync(this IMessageUIManager messageUIManager, string message, string header, MessageType messageType) => await messageUIManager.DisplayMessageAsync(message, header, messageType, false);