private void btnSend_Click(object sender, RoutedEventArgs e) { if (btnSend.IsEnabled) { btnSend.IsEnabled = false; SendCommandEnvelope env = new SendCommandEnvelope(); env.Command = cmdAttrib.CreateObject(); if (env.Command != null) { env.Name = _sys.Config.CurrentServer.Name; env.ConnectionSettings = _sys.Config.CurrentServer.ConnectionSettings; env.Queue = cbQueue.SelectedItem as string; var thread = new BackgroundWorker(); thread.DoWork += DoSendCommand; thread.RunWorkerCompleted += DoSendCommandCompleted; thread.RunWorkerAsync(env); } else { btnSend.IsEnabled = true; } } }
void DoSendCommand(object sender, DoWorkEventArgs e) { SendCommandEnvelope env = e.Argument as SendCommandEnvelope; _sys.SendCommand(env.ConnectionSettings, env.Queue, env.Command); e.Result = env; }
void DoSendCommand(object sender, DoWorkEventArgs e) { //if( !_isBusStarted ) { // _sys.SetupServiceBus(_asmPath); // _isBusStarted = true; //} SendCommandEnvelope env = e.Argument as SendCommandEnvelope; _sys.SendCommand(env.Server, env.Queue, env.Command); e.Result = env; }
void DoSendCommandCompleted(object sender, RunWorkerCompletedEventArgs e) { btnSend.IsEnabled = true; if (e.Error != null) { throw e.Error; } try { SendCommandEnvelope env = e.Result as SendCommandEnvelope; //var queue = cbQueue.SelectedItem as string; savedCommands.CommandSent(env.Command, _sys.Manager.ServiceBusName, _sys.Config.CurrentServer.CommandContentType, env.ConnectionSettings, env.Queue); Close(); } catch (Exception ex) { throw ex; } }
private void btnSend_Click(object sender, RoutedEventArgs e) { if( btnSend.IsEnabled ) { btnSend.IsEnabled = false; SendCommandEnvelope env = new SendCommandEnvelope(); env.Command = cmdAttrib.CreateObject(); if( env.Command != null ) { env.Server = cbServer.SelectedValue as string; env.Queue = cbQueue.SelectedItem as string; var thread = new BackgroundWorker(); thread.DoWork += DoSendCommand; thread.RunWorkerCompleted += DoSendCommandCompleted; thread.RunWorkerAsync(env); } else btnSend.IsEnabled = true; } }