Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Iyemon-018/793fbb7ca9006cca375a48e92ed4f495 to your computer and use it in GitHub Desktop.
Save Iyemon-018/793fbb7ca9006cca375a48e92ed4f495 to your computer and use it in GitHub Desktop.
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