| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OHV.Module.Interactivity.PopUp
- {
- public class MapViewModel : BindableBase, IDialogAware
- {
- private DelegateCommand<string> _closeDialogCommand;
- public DelegateCommand<string> CloseDialogCommand =>
- _closeDialogCommand ?? ( _closeDialogCommand = new DelegateCommand<string>( CloseDialog ) );
- private string _title = "MapView";
- public string Title
- {
- get { return this._title; }
- set
- {
- this.SetProperty( ref this._title , value );
- }
- }
- public event Action<IDialogResult> RequestClose;
- public MapViewModel( )
- {
- }
- public bool CanCloseDialog( )
- {
- return true;
- }
- public void OnDialogClosed( )
- {
- }
- public void OnDialogOpened( IDialogParameters parameters )
- {
- //throw new NotImplementedException();
- }
- protected virtual void CloseDialog(string parameter )
- {
- ButtonResult result = ButtonResult.None;
- if ( parameter?.ToLower() == "true" )
- result = ButtonResult.OK;
- else if ( parameter?.ToLower() == "false" )
- result = ButtonResult.Cancel;
- RaiseRequestClose( new DialogResult( result ) );
- }
- public virtual void RaiseRequestClose( IDialogResult dialogResult )
- {
- RequestClose?.Invoke( dialogResult );
- }
- }
- }
|