private void pageChangeCryptoKey_Commit(object sender, WizardPageConfirmEventArgs e)
{
string oldKey = _cryptoKey;
string newKey = textBoxCryptoKeyChange.Text;
try
{
using (var sync = CreateSync(oldKey))
sync.Sync();
using (var sync = CreateSync(newKey))
sync.Sync(SyncResetMode.Server);
}
#region Error handling
catch (WebException ex)
{
Log.Warn(ex);
Msg.Inform(this, ex.Message, MsgSeverity.Warn);
e.Cancel = true;
return;
}
catch (InvalidDataException ex)
{
Log.Warn(ex);
Msg.Inform(this, ex.Message, MsgSeverity.Warn);
e.Cancel = true;
return;
}
catch (OperationCanceledException)
{
e.Cancel = true;
return;
}
#endregion
_cryptoKey = newKey;
if (_troubleshooting)
if (!SaveConfig()) e.Cancel = true;
}
#endregion