示例#1
0
		internal async Task<Connection> AskForConnectionAsync()
		{
			using (var closedEvent = new System.Threading.ManualResetEvent(false))
			{
				var dialog = new ConnectionDialog();
				dialog.Closed += (sender, e) =>
				{
					closedEvent.Set();
				};
				dialog.Show();

				await Task.Run(new Action(() => closedEvent.WaitOne()));

				if (dialog.Ok ?? false)
					return dialog.Connection;
				else
					return null;
			}
		}
示例#2
0
        internal async Task <Connection> AskForConnectionAsync()
        {
            using (var closedEvent = new System.Threading.ManualResetEvent(false))
            {
                var dialog = new ConnectionDialog();
                dialog.Closed += (sender, e) =>
                {
                    closedEvent.Set();
                };
                dialog.Show();

                await Task.Run(new Action(() => closedEvent.WaitOne()));

                if (dialog.Ok ?? false)
                {
                    return(dialog.Connection);
                }
                else
                {
                    return(null);
                }
            }
        }