public bool WriteResult(ZipBlock block) { var byteLengthByte = BitConverter.GetBytes(block.ActualLength); var shardNumberByte = BitConverter.GetBytes(block.Number); lock (writeSync) { try { destStream.Write(byteLengthByte, 0, 4); destStream.Write(shardNumberByte, 0, 4); destStream.Write(block.Data, 0, block.ActualLength); } catch (IOException ex) { isCanceled = true; Console.WriteLine($"{Thread.CurrentThread.Name}: Not enough free space to write result"); Cancel.Invoke(this, EventArgs.Empty); return(false); } } return(true); }
private void OnCancel(EventArgs e) { if (Cancel != null) { Cancel.Invoke(this, e); } // Cancel?.Invoke(this, e); }
protected async Task CancelAsync(bool isNewActivity = false) { if (Activity.ActivityId == 0 || isNewActivity) { if (isNewActivity) { await RefreshListAsync(); } await Cancel.Invoke(); } else { await IsEditingChanged.InvokeAsync(false); await RefreshListAsync(); } }
// Overridden so that an event is fired on close based on the confirmation state protected override void Close() { base.Close(); if (_confirmed) { if (Confirm != null) { Confirm.Invoke(this, EventArgs.Empty); } } else { if (Cancel != null) { Cancel.Invoke(this, EventArgs.Empty); } } }
private void textBox_PreviewKeyDown(object sender, KeyEventArgs e) { if ((e.Key == Key.B) && (YesBind != null)) { YesBind.Invoke(this, new EventArgs()); } else if ((e.Key == Key.Y) && (Yes != null)) { Yes.Invoke(this, new EventArgs()); } else if (((e.Key == Key.N) || (e.Key == Key.Enter) || (e.Key == Key.Space)) && (No != null)) { No.Invoke(this, new EventArgs()); } else if ((e.Key == Key.Escape) && (Cancel != null)) { Cancel.Invoke(this, new EventArgs()); } e.Handled = true; }
private void CancelBtn_Click(object sender, RoutedEventArgs e) { Cancel?.Invoke(this, EventArgs.Empty); }
protected void btnCancel_Click(object sender, EventArgs e) { Cancel?.Invoke(sender, e); }
public async Task ExecuteCancelCommand() { Cancel?.Invoke(null, new EventArgs()); }
void OnCancelClicked() { Cancel?.Invoke(); }
public void Download() { using (var Document = new ExcelDocument(XLSXPath)) { Document.ColumnRow = CRR; Document.ImageColumnWidth = ICWR; Downloading = ""; Progress = 0; int total_rows = Document.RowCount; int total_columns = Document.ColumnCount; List <int> column_indexes = new List <int>(); for (int i = 0; i < total_columns; i++) { if (Columns.Contains(Document[i, 0])) { column_indexes.Add(i); } } int total_images = total_rows * column_indexes.Count; int current_count = 0; for (int y = 1; y < total_rows; y++) { foreach (int x in column_indexes) { string url = Document[x, y]; if (url.Length > 0) { url = Prefix + url; Downloading = url; ProgressChanged?.Invoke(this, EventArgs.Empty); string image_path = Path.GetFullPath("image_buffer" + Path.GetExtension(url)); if (SaveImage(url, image_path)) { Document.AddImage(x, y, image_path); Document[x, y] = ""; } } current_count++; int progress = current_count * 100 / total_images; if (progress > Progress) { Progress = progress; ProgressChanged?.Invoke(this, EventArgs.Empty); } var event_args = new CancelEventArgs(); Cancel?.Invoke(this, event_args); if (event_args.Cancel) { Document.Save(); return; } } } Document.Save(); } }
private void Canceled() { Cancel?.Invoke(); }
internal void FireCancelEvent() => Cancel?.Invoke(this, EventArgs.Empty);
private void OnCancel(Int32 index, Int32 begin, Int32 length) { Cancel?.Invoke(this, index, begin, length); }
private void btn_Cancel_Click(object o, EventArgs e) { Cancel?.Invoke(); }
private void SpawnUnit_Cancel(object sender, EventArgs args) { Cancel?.Invoke(this, null); Destroy(); }
private void OnCancelButtonPointerUp() { Cancel?.Invoke(); }
protected void OnCancel(EventArgs e) { Cancel?.Invoke(this, e); }
private void CancelButton_Click(object sender, RoutedEventArgs e) { Cancel?.Invoke(this, e); }
/* ----------------------------------------------------------------- */ /// /// OnCancel /// /// <summary> /// Cancel イベントを発生させます。 /// </summary> /// /* ----------------------------------------------------------------- */ protected virtual void OnCancel(EventArgs e) => Cancel?.Invoke(this, e);
private void CacelButton_Click(object sender, EventArgs e) { Cancel?.Invoke(sender, e); }
/// <summary>Raises the <see cref="Cancel" /> event</summary> protected virtual void OnCancel(SvnCancelEventArgs e) { Cancel?.Invoke(this, e); }
/// <summary> /// Fires the Cancel event. /// </summary> /// <param name="sender">The source object.</param> /// <param name="e">The event data.</param> private void OnCancel(object?sender, RoutedEventArgs e) { Cancel?.Invoke(sender, e); AfterAdapterAction(); }
protected async Task CheckPasswordAsync() { if (string.IsNullOrWhiteSpace(MasterPasswordCell.TextField.Text)) { var alert = Dialogs.CreateAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired, _pinLock ? AppResources.PIN : AppResources.MasterPassword), AppResources.Ok); PresentViewController(alert, true, null); return; } var email = await _userService.GetEmailAsync(); var kdf = await _userService.GetKdfAsync(); var kdfIterations = await _userService.GetKdfIterationsAsync(); var inputtedValue = MasterPasswordCell.TextField.Text; if (_pinLock) { var failed = true; try { if (_pinSet.Item1) { var key = await _cryptoService.MakeKeyFromPinAsync(inputtedValue, email, kdf.GetValueOrDefault(KdfType.PBKDF2_SHA256), kdfIterations.GetValueOrDefault(5000), _vaultTimeoutService.PinProtectedKey); var encKey = await _cryptoService.GetEncKeyAsync(key); var protectedPin = await _storageService.GetAsync <string>(Bit.Core.Constants.ProtectedPin); var decPin = await _cryptoService.DecryptToUtf8Async(new EncString(protectedPin), encKey); failed = decPin != inputtedValue; if (!failed) { await SetKeyAndContinueAsync(key); } } else { var key2 = await _cryptoService.MakeKeyFromPinAsync(inputtedValue, email, kdf.GetValueOrDefault(KdfType.PBKDF2_SHA256), kdfIterations.GetValueOrDefault(5000)); failed = false; await SetKeyAndContinueAsync(key2); } } catch { failed = true; } if (failed) { _invalidPinAttempts++; if (_invalidPinAttempts >= 5) { Cancel?.Invoke(); return; } InvalidValue(); } } else { var key2 = await _cryptoService.MakeKeyAsync(inputtedValue, email, kdf, kdfIterations); var keyHash = await _cryptoService.HashPasswordAsync(inputtedValue, key2); var storedKeyHash = await _cryptoService.GetKeyHashAsync(); if (storedKeyHash == null) { var oldKey = await _secureStorageService.GetAsync <string>("oldKey"); if (key2.KeyB64 == oldKey) { await _secureStorageService.RemoveAsync("oldKey"); await _cryptoService.SetKeyHashAsync(keyHash); storedKeyHash = keyHash; } } if (storedKeyHash != null && keyHash != null && storedKeyHash == keyHash) { if (_pinSet.Item1) { var protectedPin = await _storageService.GetAsync <string>(Bit.Core.Constants.ProtectedPin); var encKey = await _cryptoService.GetEncKeyAsync(key2); var decPin = await _cryptoService.DecryptToUtf8Async(new EncString(protectedPin), encKey); var pinKey = await _cryptoService.MakePinKeyAysnc(decPin, email, kdf.GetValueOrDefault(KdfType.PBKDF2_SHA256), kdfIterations.GetValueOrDefault(5000)); _vaultTimeoutService.PinProtectedKey = await _cryptoService.EncryptAsync(key2.Key, pinKey); } await SetKeyAndContinueAsync(key2); // Re-enable biometrics if (_biometricLock & !_biometricIntegrityValid) { await _biometricService.SetupBiometricAsync(BiometricIntegrityKey); } } else { InvalidValue(); } } }
/// <summary> /// Button_Cancel_Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Cancel_Click(object sender, RoutedEventArgs e) { Cancel?.Invoke(null, null); }
/// <summary> /// Called when the user presses cancel. If eventArgs.Cancel is set to true, this /// will cancel the cancellation and prevent OnExit from being called. /// </summary> /// <param name="eventArgs"></param> protected virtual void OnCancel(CancelEventArgs eventArgs) { Cancel?.Invoke(eventArgs); }
private void CancelProgramItem(object sender, RoutedEventArgs e) { Cancel?.Invoke(this, new EventArgs()); }
private void BtnCancel_Click(object sender, EventArgs e) { Cancel?.Invoke(sender, e); }
private void CancelClick() { View.Hide(); Cancel?.Invoke(); }
private void OnCancel(EventArgs e) { Cancel?.Invoke(this, e); }
void OnCancelClicked (object sender, RoutedEventArgs e) { if (sender is Button button) { Cancel?.Invoke (this, EventArgs.Empty); } }