private void btnChangeUUID_Click(object sender, RoutedEventArgs e) { CheckUserInputs(); uuid = txtUUID.Text; if (uuid.Trim() == "") { MessageBox.Show("UUID is required"); return; } if (authKey.Trim() != "") { pubnub.AuthenticationKey = authKey; } ChangeUUIDDialog changeUUIDPopup = new ChangeUUIDDialog(); changeUUIDPopup.txtChangeUUID.Text = uuid; changeUUIDPopup.Show(); changeUUIDPopup.Closed += (obj, args) => { if (changeUUIDPopup.DialogResult == true && changeUUIDPopup.txtChangeUUID.Text.Trim().Length > 0) { Console.WriteLine("Running ChangeUUID()"); string newUUID = changeUUIDPopup.txtChangeUUID.Text; pubnub.ChangeUUID(newUUID); txtUUID.Text = uuid = newUUID; } }; }