Created
October 7, 2018 08:36
-
-
Save Iyemon-018/793fbb7ca9006cca375a48e92ed4f495 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.Threading.Tasks; | |
using System.Windows.Documents; | |
using System.Windows.Input; | |
using MaterialDesign.Dialog.Example.Services; | |
using Prism.Commands; | |
using Prism.Mvvm; | |
namespace MaterialDesign.Dialog.Example.ViewModels | |
{ | |
public class ShellViewModel : BindableBase | |
{ | |
private readonly IDialogService _dialogService; | |
[Obsolete("実際には使用しないが、デフォルトコンストラクタがないとXAML デザイナー上でバインドしたときに警告出るので仕方なく追加しておく。")] | |
public ShellViewModel() | |
{ | |
} | |
public ShellViewModel(IDialogService dialogService) | |
{ | |
_dialogService = dialogService; | |
ShutdownCommand = new DelegateCommand(async () => | |
{ | |
bool result = await _dialogService.Question("終了します。よろしいですか?"); | |
if (result) | |
{ | |
App.Current.MainWindow.Close(); | |
} | |
}); | |
} | |
public ICommand ShutdownCommand { get; private set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment