private void Activate_Click(object sender, RoutedEventArgs e) { int status; status = LexActivator.SetProductKey(keyTb.Text.Trim()); if (status == LexActivator.LA_OK) { } else { MessageBox.Show("Incorrect key."); return; } status = LexActivator.ActivateProduct(); if (status == LexActivator.LA_OK) { MainWindow.legit = true; Close(); } else if (status == LexActivator.LA_EXPIRED) { MessageBox.Show("Incorrect key."); } else { MessageBox.Show("Incorrect key."); } }