public static void ShowWarning(this IMessageBoxService service, string message, string title = "Warning") { if (service == null) { throw new ArgumentNullException(nameof(service)); } service.ShowWarning(null, message, title); }
private void EditCustomerMessageSink(CustomerModel editableCustomer) { if (!IsNewWorkSpaceItemAllowed <AddEditCustomerViewModel>()) { messageBoxService.ShowWarning( "There is already an Add/Edit View open\r\n\r\n" + "This application only allows 1 active Add/Edit view\r\n" + "to be opened at 1 time"); return; } AddEditCustomerViewModel addEditCustomerViewModel = new AddEditCustomerViewModel(); addEditCustomerViewModel.IsCloseable = true; addEditCustomerViewModel.CurrentCustomer = editableCustomer; addEditCustomerViewModel.CurrentViewMode = ViewMode.EditMode; Workspaces.Add(addEditCustomerViewModel); this.SetActiveWorkspace(addEditCustomerViewModel); }
private async void ExecuteDownloadPresets(object param) { if (FoundPresetRelease is null) { return; } BusyContent = _localizationHelper.GetLocalization("UpdatePreferencesBusyDownloadPresets"); IsBusy = true; if (!_commons.CanWriteInFolder()) { //already asked for admin rights? if (Environment.GetCommandLineArgs().Any(x => x.Trim().Equals(Constants.Argument_Ask_For_Admin, StringComparison.OrdinalIgnoreCase))) { _messageBoxService.ShowWarning($"You have no write access to the folder.{Environment.NewLine}The update can not be installed.", _localizationHelper.GetLocalization("Error")); IsBusy = false; return; } _messageBoxService.ShowMessage(_localizationHelper.GetLocalization("UpdateRequiresAdminRightsMessage"), _localizationHelper.GetLocalization("AdminRightsRequired")); _appSettings.Save(); _commons.RestartApplication(true, Constants.Argument_Ask_For_Admin, App.ExecutablePath); } //Context is required here, do not use ConfigureAwait(false) var newLocation = await _updateHelper.DownloadReleaseAsync(FoundPresetRelease); logger.Debug($"downloaded new preset ({FoundPresetRelease.Version}): {newLocation}"); IsBusy = false; _appSettings.Save(); _commons.RestartApplication(false, null, App.ExecutablePath); Environment.Exit(-1); }
public bool IsNavigationAllowedForRegion(string regionName) { bool result = true; if (!regionCapacityLimits.ContainsKey(regionName)) { //key not found so no limit return(true); } int existingViews = regionManager.Regions[regionName].Views.Count(); result = existingViews + 1 < regionCapacityLimits[regionName]; if (!result) { messageBoxService.ShowWarning("You have exceeded the amount of allowable tabs open please close a tab"); } return(result); }
private static void AfficherWarningMessageBox(string msg) { MessageService.ShowWarning(msg); }