本文整理汇总了C#中IMessageBoxService.Show方法的典型用法代码示例。如果您正苦于以下问题:C# IMessageBoxService.Show方法的具体用法?C# IMessageBoxService.Show怎么用?C# IMessageBoxService.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMessageBoxService
的用法示例。
在下文中一共展示了IMessageBoxService.Show方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenWebPage
public static void OpenWebPage(string url, IMessageBoxService messageBoxService) {
try {
Process.Start(url);
}
catch {
messageBoxService.Show(dnSpy_Resources.CouldNotStartBrowser);
}
}
示例2: MainWindowViewModel
public MainWindowViewModel(IBookingService bookingService, IMessageBoxService mboxService, IConfigService configService)
{
_context = SynchronizationContext.Current;//We will always execute this on UI dispatcher.
_bookingService = bookingService;
_mboxService = mboxService;
_configService = configService;
AddNewCommand = new ActionCommand(AddNewClicked);
_bookingService.GetBookingsAsync(DateTime.Now, HandleBookings,
e => _mboxService.Show("Error Getting Bookings. " + e, "Error", MessageBoxButton.OK, MessageBoxImage.Error));
}
示例3: MainViewModel
public MainViewModel(IMessageBoxService messageBoxService)
{
_messageBoxService = messageBoxService;
AddItemCommand = new RelayCommand(() =>
{
Items.Add(DateTime.Now.ToString());
EnableSelectionCommand.RaiseCanExecuteChanged();
});
EnableSelectionCommand = new RelayCommand(() =>
{
IsSelectionEnabled = true;
}, () => Items.Count > 0);
DeleteItemsCommand = new RelayCommand<System.Collections.IList>(items =>
{
var itemsToRemove = items
.Cast<string>()
.ToArray();
foreach (var itemToRemove in itemsToRemove)
{
Items.Remove(itemToRemove);
}
EnableSelectionCommand.RaiseCanExecuteChanged();
IsSelectionEnabled = false;
});
BackKeyPressCommand = new RelayCommand<CancelEventArgs>(e =>
{
if (IsSelectionEnabled)
{
IsSelectionEnabled = false;
e.Cancel = true;
}
});
AboutCommand = new RelayCommand(() =>
{
_messageBoxService.Show("Cimbalino Windows Phone Toolkit Bindable Application Bar Sample", "About");
});
Items = new ObservableCollection<string>();
}
示例4: CheckAndPromptForSagaUpdate
public static void CheckAndPromptForSagaUpdate(IComponent handlerComponent, IMessageBoxService messageBoxService, IDialogWindowFactory windowFactory)
{
if (handlerComponent.ProcessesMultipleMessages)
{
var sagaRecommendationMessage =
handlerComponent.IsSaga
? String.Format(Resources.Saga_UpdateQuery)
: String.Format(CultureInfo.CurrentCulture, Resources.Saga_ConvertQuery, handlerComponent.CodeIdentifier);
var result = messageBoxService.Show(sagaRecommendationMessage, Resources.Saga_QueryTitle, MessageBoxButton.YesNo);
if (result == MessageBoxResult.Yes)
{
new ShowComponentSagaStarterPicker { WindowFactory = windowFactory, CurrentElement = handlerComponent }.Execute();
}
}
}
示例5: MainViewModel
public MainViewModel(IMessageBoxService messageBoxService)
{
if (messageBoxService == null) throw new ArgumentNullException(nameof(messageBoxService));
_messageBoxService = messageBoxService;
_items = new OrderedListViewModel<ItemViewModel>(
//() => new ItemViewModel(),
() => null,
addedAction: item => Console.WriteLine($"Item '{item?.Text}' added"),
deleted: item => _messageBoxService.Show($"Delete '{item.Text}'", button:MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
new ItemViewModel() {Value = 1, Text = "One"},
new ItemViewModel() {Value = 2, Text = "Two"},
new ItemViewModel() {Value = 3, Text = "Three"},
new ItemViewModel() {Value = 4, Text = "Four"},
new ItemViewModel() {Value = 5, Text = "Five"}
};
}
示例6: MainViewModel
public MainViewModel(ILocationService locationService, IMessageBoxService messageBoxService)
{
_locationService = locationService;
_messageBoxService = messageBoxService;
_locationService.PositionChanged += LocationService_PositionChanged;
_locationService.StatusChanged += LocationService_StatusChanged;
GetCurrentLocationCommand = new RelayCommand(() =>
{
_locationService.GetPosition(LocationServiceAccuracy.High, TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(10), (location, ex) =>
{
if (ex != null)
{
_messageBoxService.Show(ex.ToString(), "Error");
}
else
{
CurrentLocation = location.ToString();
}
});
});
StartMonitoringLocationCommand = new RelayCommand(() =>
{
_locationService.Start(LocationServiceAccuracy.High);
Status = "Starting";
});
StopMonitoringLocationCommand = new RelayCommand(() =>
{
_locationService.Stop();
Status = "Stopped";
});
CurrentLocation = "(Unknown)";
Status = "Stopped";
}
示例7: MainViewModel
public MainViewModel(IMainModel mainModel, INavigationService navigationService, IMessageBoxService messageBoxService, IApplicationSettingsService applicationSettingsService, IShellTileService shellTileService)
{
_mainModel = mainModel;
_navigationService = navigationService;
_messageBoxService = messageBoxService;
_applicationSettingsService = applicationSettingsService;
_shellTileService = shellTileService;
NewAccountCommand = new RelayCommand(() =>
{
_navigationService.NavigateTo("/View/AuthorizationPage.xaml");
});
RemoveAccountCommand = new RelayCommand<AccountViewModel>(account =>
{
_mainModel.AvailableAccounts.Remove(account.Model);
_mainModel.Save();
RefreshAccountsList();
});
OpenAccountCommand = new RelayCommand<AccountViewModel>(account =>
{
_mainModel.CurrentAccount = account.Model;
_mainModel.ExecuteInitialLoad = true;
_navigationService.NavigateTo("/View/ExplorerPage.xaml");
});
ShowAboutCommand = new RelayCommand(() =>
{
_navigationService.NavigateTo("/View/AboutPage.xaml");
});
PageLoadedCommand = new RelayCommand(() =>
{
_mainModel.CurrentAccount = null;
if (!_applicationSettingsService.Get<bool>("AcceptedDisclaimer", false))
{
_applicationSettingsService.Set("AcceptedDisclaimer", true);
_applicationSettingsService.Save();
_messageBoxService.Show("You are advised to read the GDrive disclaimer before you continue.\n\nWould you like to read it now?\n\nYou can always find it later in the About page.", "Welcome to GDrive", new[] { "now", "later" }, buttonIndex =>
{
if (buttonIndex == 0)
{
_navigationService.NavigateTo("/View/AboutPage.xaml?disclaimer=true");
}
});
}
});
MessengerInstance.Register<AvailableAccountsChangedMessage>(this, message =>
{
RefreshAccountsList();
});
#if !WP8
DispatcherHelper.RunAsync(UpdateTiles);
#endif
}
示例8: ExplorerViewModel
public ExplorerViewModel(IMainModel mainModel, IGoogleDriveService googleDriveService, INavigationService navigationService, IMessageBoxService messageBoxService, ISystemTrayService systemTrayService, IPhotoChooserService photoChooserService)
{
_mainModel = mainModel;
_googleDriveService = googleDriveService;
_navigationService = navigationService;
_messageBoxService = messageBoxService;
_systemTrayService = systemTrayService;
_photoChooserService = photoChooserService;
Files = new ObservableCollection<GoogleFileViewModel>();
PictureFiles = new ObservableCollection<GoogleFileViewModel>();
OpenFileCommand = new RelayCommand<GoogleFileViewModel>(file =>
{
if (IsSelectionEnabled)
{
return;
}
OpenFile(file);
});
ChangeStaredStatusCommand = new RelayCommand<GoogleFileViewModel>(file =>
{
if (IsSelectionEnabled)
{
return;
}
ChangeStaredStatus(file);
});
AddFileCommand = new RelayCommand(UploadFile);
EnableSelectionCommand = new RelayCommand(() =>
{
if (IsBusy)
{
return;
}
IsSelectionEnabled = true;
});
RefreshFilesCommand = new RelayCommand(RefreshFiles);
DeleteFilesCommand = new RelayCommand<IList>(files =>
{
_messageBoxService.Show("You are about to delete the selected files. Do you wish to proceed?", "Delete files?", new[] { "delete", "cancel" }, button =>
{
if (button != 0)
return;
var filesArray = files
.Cast<GoogleFileViewModel>()
.ToArray();
IsSelectionEnabled = false;
DeleteFiles(filesArray);
});
});
CreateNewFolderCommand = new RelayCommand(CreateNewFolder);
RenameFileCommand = new RelayCommand<GoogleFileViewModel>(RenameFile);
DeleteFileCommand = new RelayCommand<GoogleFileViewModel>(file =>
{
_messageBoxService.Show(string.Format("You are about to delete '{0}'. Do you wish to proceed?", file.Title), "Delete file?", new[] { "delete", "cancel" }, button =>
{
if (button != 0)
return;
DeleteFile(file);
});
});
ShowAboutCommand = new RelayCommand(() =>
{
_navigationService.NavigateTo("/View/AboutPage.xaml");
});
PageLoadedCommand = new RelayCommand(ExecuteInitialLoad);
BackKeyPressCommand = new RelayCommand<CancelEventArgs>(e =>
{
GoogleDriveFile item;
if (PivotSelectedIndex == 1)
{
PivotSelectedIndex = 0;
e.Cancel = true;
}
else if (IsSelectionEnabled)
{
IsSelectionEnabled = false;
e.Cancel = true;
//.........这里部分代码省略.........