private async void CryptoButton_Click(object sender, RoutedEventArgs e) { if (algorithm == null) { await new MessageDialog("You haven't selected an algorithm!").ShowAsync(); return; } clearTextBox.Document.GetText(Windows.UI.Text.TextGetOptions.None, out string clearText); if (clearText.Trim() == string.Empty) { await new MessageDialog("No clear text :( ").ShowAsync(); return; } view = new CryptoView(); algorithm.GenerateKey(); algorithm.GenerateIV(); try { model = new CryptoModel(algorithm, cipherMode); }catch (InCompatibleFormatException ex) { await new MessageDialog("Incompatable").ShowAsync(); return; } controller = new CryptoController(model, view); controller.ClearText = clearText; controller.UpdateView(CryptoController.Operation.Encryption, (result) => cryptedTextBox.Document.SetText(Windows.UI.Text.TextSetOptions.None, result)); }
public CryptoController(CryptoModel model, CryptoView view) { this.model = model; this.view = view; }