using PDF_Master.Properties; using Prism.Commands; using Prism.Mvvm; using Prism.Regions; using Prism.Services.Dialogs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PDF_Master.ViewModels.Dialog.ServiceDialog { public class LoginoffDialogViewModel : BindableBase, IDialogAware { public IRegionManager Region; public string Title => ""; public event Action RequestClose; #region 文案 private string _TextPleaseLog; public string TextPleaseLog { get { return _TextPleaseLog; } set { _TextPleaseLog = value; } } private string _TextYouraccount; public string TextYouraccount { get { return _TextYouraccount; } set { _TextYouraccount = value; } } private string _TextChange; public string TextChange { get { return _TextChange; } set { _TextChange = value; } } private string _TextOK; public string TextOK { get { return _TextOK; } set { _TextOK = value; } } private string _TextCancel; public string TextCancel { get { return _TextCancel; } set { _TextCancel = value; } } private string _TextLogin; public string TextLogin { get { return _TextLogin; } set { _TextLogin = value; } } private string _LoginoffRegionName; public string LoginoffRegionName { get { return _LoginoffRegionName; } set { _LoginoffRegionName = value; } } #endregion private void InitString() { TextPleaseLog = App.ServiceLoader.GetString("TextPleaseLog"); TextYouraccount = App.ServiceLoader.GetString("TextYouraccount"); TextChange = App.ServiceLoader.GetString("TextChange"); TextOK = App.ServiceLoader.GetString("Text_ok"); TextCancel = App.ServiceLoader.GetString("Text_cancel"); TextLogin = App.ServiceLoader.GetString("Text_Login"); } public bool CanCloseDialog() { return true; } public void OnDialogClosed() { } public void OnDialogOpened(IDialogParameters parameters) { Settings.Default.UserDate.IsLoginoff = true; Settings.Default.Save(); } public DelegateCommand GoLoginCommand { get; set; } public DelegateCommand GoCodeCommand { get; set; } public LoginoffDialogViewModel(IRegionManager regionManager, IDialogService dialogService) { GoCodeCommand= new DelegateCommand(GoCode); GoLoginCommand = new DelegateCommand(GoLogin); LoginoffRegionName = Guid.NewGuid().ToString(); InitString(); } public void Close() { RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel)); } private void GoLogin() { Close(); App.mainWindowViewModel.OpenLogin(); } private void GoCode() { Close(); App.mainWindowViewModel.OpenLogin("Loginoff"); } } }