123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- using PDF_Master.Helper;
- using PDF_Master.Model;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Regions;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- namespace PDF_Master.ViewModels.Dialog.ServiceDialog
- {
- public class NOInternetRegionViewModel : BindableBase, INavigationAware
- {
- private LoginDialogViewModel LoginDialogViewModel;
- private RegisterDialogViewModel RegisterDialogViewModel;
- private UserDialogViewModel UserDialogViewModel;
- public IDialogService dialogs;
- public bool IsNavigationTarget(NavigationContext navigationContext)
- {
- return true;
- }
- public void OnNavigatedFrom(NavigationContext navigationContext)
- {
- }
- public void OnNavigatedTo(NavigationContext navigationContext)
- {
- navigationContext.Parameters.TryGetValue<LoginDialogViewModel>("LoginDialogViewModel", out LoginDialogViewModel);
- navigationContext.Parameters.TryGetValue<RegisterDialogViewModel>("RegisterDialogViewModel", out RegisterDialogViewModel);
- navigationContext.Parameters.TryGetValue<UserDialogViewModel>("UserDialogViewModel", out UserDialogViewModel);
- }
- #region 文案
- private string _Text_nonet = "";
- public string Text_nonet
- {
- get { return _Text_nonet; }
- set
- {
- SetProperty(ref _Text_nonet, value);
- }
- }
- private string _Text_toconnect = "";
- public string Text_toconnect
- {
- get { return _Text_toconnect; }
- set
- {
- SetProperty(ref _Text_toconnect, value);
- }
- }
- private string _Text_retry = "";
- public string Text_retry
- {
- get { return _Text_retry; }
- set
- {
- SetProperty(ref _Text_retry, value);
- }
- }
- private void InitString()
- {
- Text_nonet = App.ServiceLoader.GetString("Text_nonet");
- Text_toconnect = App.ServiceLoader.GetString("Text_toconnect");
- Text_retry = App.ServiceLoader.GetString("Text_retry");
- }
- #endregion
- public DelegateCommand RetryCommand { get; set; }
- NOInternetRegionViewModel(IRegionManager regionManager, IDialogService dialogService)
- {
- InitString();
- dialogs = dialogService;
- RetryCommand = new DelegateCommand(Retry);
- }
- private void Retry()
- {
- if (ServiceHelper.IsConnectInternet()==true)
- {
- if (RegisterDialogViewModel != null)
- {
- RegisterDialogViewModel.RegionMan("RegisterRegion");
- }
- else if (LoginDialogViewModel != null)
- {
- LoginDialogViewModel.RegionMan("LoginRegion");
- }
- else
- {
- UserDialogViewModel.Region.Regions[UserDialogViewModel.UserRegionName].RemoveAll();
- }
-
- }
-
- }
- }
- }
|