private async void Test_Click(object sender, RoutedEventArgs e) { String Passwords = await CryptoInterface.GetPasswords(Key); Debug.WriteLine("<passwords>"); Debug.WriteLine(Passwords); Debug.WriteLine("</passwords>"); Passwords += "LINE1" + INTRASPLIT + "LINE2" + INTRASPLIT + "LINE3" + INTERSPLIT; Debug.WriteLine("ALTERED PASSWORDS"); Debug.WriteLine("<passwords>"); Debug.WriteLine(Passwords); Debug.WriteLine("</passwords>"); await CryptoInterface.StorePasswords(Passwords, Key); Debug.WriteLine("WROTE NEW PASSWORDS"); Passwords = ""; Debug.WriteLine("<clearedPasswords>"); Debug.WriteLine(Passwords); Debug.WriteLine("</clearedPasswords>"); Passwords = await CryptoInterface.GetPasswords(Key); Debug.WriteLine("READ NEW PASSWORDS"); Debug.WriteLine("<passwords>"); Debug.WriteLine(Passwords); Debug.WriteLine("</passwords>"); }
private async void StoreNewEntry(object sender, RoutedEventArgs e) { newEditOk.Click -= StoreNewEntry; newDelete.Click -= CancelNewEntry; String cumulatedData = await CryptoInterface.GetPasswords(Key); if (newUsername.Text.Equals("")) { newUsername.Text = "Kein Benutzername"; } if (newPassword.Text.Equals("")) { newPassword.Text = "Kein Passwort"; } if (newOverview.Text.Equals("")) { newOverview.Text = "Kein Name"; } cumulatedData = newOverview.Text + INTRASPLIT + newUsername.Text + INTRASPLIT + newPassword.Text + INTERSPLIT + cumulatedData; await CryptoInterface.StorePasswords(cumulatedData, Key); await Refresh(); }
private async Task Refresh() { Stack.Children.Clear(); Init(); String cumulatedData = await CryptoInterface.GetPasswords(Key); String[] entries = cumulatedData.Split(INTERSPLIT); index = entries.Length; border = new Border[index]; grid = new Grid[index]; left = new ColumnDefinition[index]; right = new ColumnDefinition[index]; leftPanel = new StackPanel[index]; overview = new TextBox[index]; username = new TextBox[index]; password = new TextBox[index]; rightPanel = new StackPanel[index]; delete = new AppBarButton[index]; editOk = new AppBarButton[index]; isEditing = new Boolean[index]; for (int i = 0; i < index; i++) { if (entries[i].Equals("")) { continue; } if (!entries[i].Contains(INTRASPLIT)) { entries[i] += INTRASPLIT + " "; } if (!(entries[i].Substring(INTRASPLIT.Length + entries[i].IndexOf(INTRASPLIT)).Contains(INTRASPLIT))) { entries[i] += INTRASPLIT + " "; } String[] X = entries[i].Split(INTRASPLIT); border[i] = new Border() { BorderThickness = new Thickness(2), BorderBrush = new SolidColorBrush(Colors.LightGray), CornerRadius = new CornerRadius(15), Padding = new Thickness(5), Margin = new Thickness(5) }; grid[i] = new Grid(); left[i] = new ColumnDefinition(); right[i] = new ColumnDefinition() { Width = GridLength.Auto }; leftPanel[i] = new StackPanel(); overview[i] = new TextBox() { IsHitTestVisible = false, IsReadOnly = true, FontSize = 20, //BorderThickness = new Thickness(0), Text = X[0] }; username[i] = new TextBox() { IsHitTestVisible = false, AcceptsReturn = true, TextWrapping = TextWrapping.Wrap, Text = X[1] }; password[i] = new TextBox() { IsHitTestVisible = true, AcceptsReturn = true, TextWrapping = TextWrapping.Wrap, Text = X[2] }; rightPanel[i] = new StackPanel(); delete[i] = new AppBarButton() { Icon = new SymbolIcon(Symbol.Delete), Content = "Erledigt" }; editOk[i] = new AppBarButton() { Icon = new SymbolIcon(Symbol.Edit), Content = "Bearbeiten" }; Stack.Children.Add(border[i]); border[i].Child = grid[i]; grid[i].ColumnDefinitions.Add(left[i]); grid[i].ColumnDefinitions.Add(right[i]); grid[i].Children.Add(leftPanel[i]); leftPanel[i].Children.Add(overview[i]); leftPanel[i].Children.Add(username[i]); leftPanel[i].Children.Add(password[i]); leftPanel[i].SetValue(Grid.ColumnProperty, 0); grid[i].Children.Add(rightPanel[i]); rightPanel[i].Children.Add(delete[i]); rightPanel[i].Children.Add(editOk[i]); rightPanel[i].SetValue(Grid.ColumnProperty, 1); delete[i].Click += Delete_Click; editOk[i].Click += EditOk_Click; } }