Beispiel #1
0
		public async Task<object> Execute( MetroWindow window, object args )
		{
			var pathDlg = new DatabasePathDialog();
			var vm = pathDlg.DataContext as DatabasePathViewModel;
			Debug.Assert( vm != null );

			TaskCompletionSource<MoveDatabaseResult> tcs = new TaskCompletionSource<MoveDatabaseResult>();

			vm.CloseRequested += async ( s, e ) =>
			{
				await window.HideMetroDialogAsync( pathDlg );
				tcs.TrySetResult( new MoveDatabaseResult( vm.Path, vm.OverwriteExisting ) );
			};

			await window.ShowMetroDialogAsync( pathDlg );

			return await tcs.Task;
		}
Beispiel #2
0
		public async Task<object> Execute( MetroWindow window, object args )
		{
			var settings = new MetroDialogSettings();

			var dlg = new InfoDialog();

			var ctrl = dlg.DataContext as IViewController;
			if( ctrl != null )
			{
				ctrl.CloseRequested += async ( s, e ) =>
				{
					await window.HideMetroDialogAsync( dlg, settings );
				};
			}

			await window.ShowMetroDialogAsync( dlg, settings );

			return null;
		}
 static ReactiveCommand<bool?> CreateCommand(BaseMetroDialog dialog, MetroWindow window,
     TaskCompletionSource<bool?> tcs) {
     var command = ReactiveCommand.CreateAsyncTask(async x => {
         await window.HideMetroDialogAsync(dialog);
         return (bool?) x;
     });
     SetupCommand(tcs, command);
     return command;
 }