//Add new database private void Button_Click(object sender, RoutedEventArgs e) { AddDatabase wd = new AddDatabase { WindowStartupLocation = WindowStartupLocation.CenterScreen }; wd.Show(); }
private async void AddDatabaseToSoftwareBtn_Click(object sender, EventArgs e) { var form = new AddDatabase(); if (form.ShowDialog() == DialogResult.OK) { await Binding(); SoftwareGridView.Refresh(); dataGridView1.Refresh(); } }
static async Task ProcessMessagesAsync(Message message, CancellationToken token) { // Process the message and write to log file.Write($"Received message: SequenceNumber:{message.SystemProperties.SequenceNumber} Body:{Encoding.UTF8.GetString(message.Body)}"); // Complete the message so that it is not received again. // This can be done only if the queueClient is created in ReceiveMode.PeekLock mode (which is default). await queueClient.CompleteAsync(message.SystemProperties.LockToken); //Deserialize Object to class Ticket ticket = JsonConvert.DeserializeObject <Ticket>(Encoding.UTF8.GetString(message.Body)); //Add to Database AddDatabase objectToDatabase = new AddDatabase(); // Write to log file.Write($"{objectToDatabase.Add(ticket)}{Environment.NewLine}"); // Note: Use the cancellationToken passed as necessary to determine if the queueClient has already been closed. // If queueClient has already been Closed, you may chose to not call CompleteAsync() or AbandonAsync() etc. calls // to avoid unnecessary exceptions. }