// ----------------------------------------------------------------------- // Button FilePicker // ----------------------------------------------------------------------- private async void FilePicker_PointerReleased(object sender, PointerRoutedEventArgs e) { // Begrüßung erstellen DialogEx dialogEx = new DialogEx(resource.GetString("002_Dateiauswahl"), resource.GetString("002_DateiauswahlInfo")); DialogExButtonsSet dxBtnSet = new DialogExButtonsSet(); DialogExButton btn1 = new DialogExButton(resource.GetString("001_Abbrechen")); dxBtnSet.AddButton(btn1); DialogExButton btn2 = new DialogExButton(resource.GetString("001_Hinzufügen")); dxBtnSet.AddButton(btn2); dialogEx.AddButtonSet(dxBtnSet); await dialogEx.ShowAsync(grMain); // Wenn Antwort hinzufügen if (dialogEx.GetAnswer() == resource.GetString("001_Hinzufügen")) { // One Drive in Start hinzufügen MainPage.setStartMenu += "filePicker;;;"; // Einstellungen speichern StorageFile storageFile = await folderSettings.CreateFileAsync("StartMenu.txt", CreationCollisionOption.OpenIfExists); await FileIO.WriteTextAsync(storageFile, MainPage.setStartMenu); // Zurück zur Startseite Frame.GoBack(); } }
// ----------------------------------------------------------------------- // Button Download Limit // ----------------------------------------------------------------------- private async void btnOB1_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { // Nachricht ausgeben DialogEx dQuery = new DialogEx(); dQuery.Title = resource.GetString("001_DownloadLimit"); DialogExButtonsSet btnSet = new DialogExButtonsSet(); DialogExButton btn_1 = new DialogExButton("1 MB"); btnSet.AddButton(btn_1); DialogExButton btn_2 = new DialogExButton("2 MB"); btnSet.AddButton(btn_2); DialogExButton btn_3 = new DialogExButton("3 MB"); btnSet.AddButton(btn_3); DialogExButton btn_4 = new DialogExButton("5 MB"); btnSet.AddButton(btn_4); DialogExButton btn_5 = new DialogExButton("10 MB"); btnSet.AddButton(btn_5); DialogExButton btn_6 = new DialogExButton("15 MB"); btnSet.AddButton(btn_6); DialogExButton btn_7 = new DialogExButton("20 MB"); btnSet.AddButton(btn_7); DialogExButton btn_8 = new DialogExButton(resource.GetString("001_Unendlich")); btnSet.AddButton(btn_8); dQuery.AddButtonSet(btnSet); await dQuery.ShowAsync(grMain); // Antwort auslesen string answer = dQuery.GetAnswer(); // Wenn Unendlich if (answer == resource.GetString("001_Unendlich")) { setOpenByDownloadingLimit = 0; } // Wenn Limit else { string[] sp = answer.Split(new char[] { ' ' }); setOpenByDownloadingLimit = Convert.ToInt32(sp[0] + "000000"); } // Einstellungen speichern saveSettings(); // UI Updaten updateUI(); }
// ----------------------------------------------------------------------- // Button Drag and Drop Aktion // ----------------------------------------------------------------------- private async void btnDD1_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { // Nachricht ausgeben DialogEx dQuery = new DialogEx(); dQuery.Title = resource.GetString("001_DDUmgang"); DialogExButtonsSet btnSet = new DialogExButtonsSet(); DialogExButton btn_1 = new DialogExButton(resource.GetString("001_Kopieren")); btnSet.AddButton(btn_1); DialogExButton btn_2 = new DialogExButton(resource.GetString("001_Verschieben")); btnSet.AddButton(btn_2); DialogExButton btn_3 = new DialogExButton(resource.GetString("001_Standard")); btnSet.AddButton(btn_3); DialogExButton btn_4 = new DialogExButton(resource.GetString("001_Fragen")); btnSet.AddButton(btn_4); dQuery.AddButtonSet(btnSet); await dQuery.ShowAsync(grMain); // Antwort auslesen string answer = dQuery.GetAnswer(); // Wenn Kopieren if (answer == resource.GetString("001_Kopieren")) { setDdCopyOrMove = "copy"; } // Wenn Verschieben else if (answer == resource.GetString("001_Verschieben")) { setDdCopyOrMove = "move"; } // Wenn Standard else if (answer == resource.GetString("001_Standard")) { setDdCopyOrMove = "standard"; } // Wenn Fragen else if (answer == resource.GetString("001_Fragen")) { setDdCopyOrMove = "ask"; } // Einstellungen speichern saveSettings(); // UI Updaten updateUI(); }
// Aktion private async void lbLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lbLanguage.SelectedIndex != LangID & SelectLang) { // Nachricht ausgeben // Kein Name eingegeben DialogEx dEx = new DialogEx(resource.GetString("002_SpracheÄndern")); DialogExButtonsSet dBSet = new DialogExButtonsSet(); DialogExButton dBtn = new DialogExButton(resource.GetString("001_Ja")); dBSet.AddButton(dBtn); DialogExButton dBtn2 = new DialogExButton(resource.GetString("001_Nein")); dBSet.AddButton(dBtn2); dEx.AddButtonSet(dBSet); await dEx.ShowAsync(grMain); // Wenn Ja if (dEx.GetAnswer() == resource.GetString("001_Ja")) { Language = LangCodes[lbLanguage.SelectedIndex]; // Neue Sprachdatei erstellen StorageFolder folderSettings = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Settings", CreationCollisionOption.OpenIfExists); var F_Language = await folderSettings.CreateFileAsync("Language.txt", CreationCollisionOption.OpenIfExists); await FileIO.WriteTextAsync(F_Language, Language); // Sprache festlegen try { var culture = new CultureInfo(Language); Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = culture.Name; CultureInfo.DefaultThreadCurrentCulture = culture; CultureInfo.DefaultThreadCurrentUICulture = culture; Application.Current.Exit(); } catch { } } // Wenn Nein else { // Listbox Auswahl zurücksetzen SelectLang = false; lbLanguage.SelectedIndex = LangID; SelectLang = true; } } }
// ----------------------------------------------------------------------- // Button Drag and Drop bestätigen // ----------------------------------------------------------------------- private async void btnDD2_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { // Nachricht ausgeben DialogEx dQuery = new DialogEx(); dQuery.Title = resource.GetString("001_DDUmgang"); DialogExButtonsSet btnSet = new DialogExButtonsSet(); DialogExButton btn_1 = new DialogExButton(resource.GetString("001_Immer")); btnSet.AddButton(btn_1); DialogExButton btn_2 = new DialogExButton(resource.GetString("001_Mehreren")); btnSet.AddButton(btn_2); DialogExButton btn_3 = new DialogExButton(resource.GetString("001_Nie")); btnSet.AddButton(btn_3); dQuery.AddButtonSet(btnSet); await dQuery.ShowAsync(grMain); // Antwort auslesen string answer = dQuery.GetAnswer(); // Wenn Immer if (answer == resource.GetString("001_Immer")) { setDdConfirmCopyOrMove = "always"; } // Wenn Mehrere else if (answer == resource.GetString("001_Mehreren")) { setDdConfirmCopyOrMove = "several"; } // Wenn Nie else if (answer == resource.GetString("001_Nie")) { setDdConfirmCopyOrMove = "never"; } // Einstellungen speichern saveSettings(); // UI Updaten updateUI(); }
// ----------------------------------------------------------------------- // Ordner Temporäre Dateien anzeigen // ----------------------------------------------------------------------- private async void btnT1_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { // Nachricht ausgeben DialogEx dQuery = new DialogEx(); dQuery.Title = resource.GetString("001_TemporäreDateienAnzeigen"); DialogExButtonsSet btnSet = new DialogExButtonsSet(); DialogExButton btn_1 = new DialogExButton(resource.GetString("001_Ja")); btnSet.AddButton(btn_1); DialogExButton btn_2 = new DialogExButton(resource.GetString("001_Nein")); btnSet.AddButton(btn_2); dQuery.AddButtonSet(btnSet); await dQuery.ShowAsync(grMain); // Antwort auslesen string answer = dQuery.GetAnswer(); // Wenn Kopieren if (answer == resource.GetString("001_Ja")) { setShowFolderTemp = true; } // Wenn Verschieben else if (answer == resource.GetString("001_Nein")) { setShowFolderTemp = false; setDeleteTempFiles = true; } // Einstellungen speichern saveSettings(); // UI Updaten updateUI(); }
// ----------------------------------------------------------------------- // Button Privater Bereich öffnen // ----------------------------------------------------------------------- private async void btnPD1_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { // Nachricht ausgeben DialogEx dQuery = new DialogEx(); dQuery.Title = resource.GetString("001_PasswortAbfrage"); DialogExButtonsSet btnSet = new DialogExButtonsSet(); DialogExButton btn_1 = new DialogExButton(resource.GetString("001_ÖffnenVomOrdner")); btnSet.AddButton(btn_1); DialogExButton btn_2 = new DialogExButton(resource.GetString("001_Einmal")); btnSet.AddButton(btn_2); dQuery.AddButtonSet(btnSet); await dQuery.ShowAsync(grMain); // Antwort auslesen string answer = dQuery.GetAnswer(); // Wenn Kopieren if (answer == resource.GetString("001_ÖffnenVomOrdner")) { setPrivate = "openFolder"; } // Wenn Verschieben else if (answer == resource.GetString("001_Einmal")) { setPrivate = "once"; } // Einstellungen speichern saveSettings(); // UI Updaten updateUI(); }
// ----------------------------------------------------------------------- // Button FTP // ----------------------------------------------------------------------- private async void Ftp_PointerReleased(object sender, PointerRoutedEventArgs e) { // Antwort string answer = ""; // Schleife bis Daten vorhanden while (answer != resource.GetString("001_Abbrechen")) { // Passwort Eingabe erstellen DialogEx dialogEx = new DialogEx(resource.GetString("001_Einstellungen")); DialogExTextBox tbServer = new DialogExTextBox(resource.GetString("001_Server"), "ftp://"); dialogEx.AddTextBox(tbServer); DialogExTextBox tbUser = new DialogExTextBox(resource.GetString("001_Benutzername")); dialogEx.AddTextBox(tbUser); DialogExPasswordBox pbPass = new DialogExPasswordBox(resource.GetString("001_Passwort")); dialogEx.AddPasswordBox(pbPass); DialogExCheckBox chSave = new DialogExCheckBox(resource.GetString("001_PasswortSpeichern"), false); dialogEx.AddCheckbox(chSave); DialogExButtonsSet btnSet = new DialogExButtonsSet(); btnSet.Margin = new Thickness(0, 6, 0, 24); DialogExButton btnAbort = new DialogExButton(resource.GetString("001_Abbrechen")); btnSet.AddButton(btnAbort); DialogExButton btnCheck = new DialogExButton(resource.GetString("001_Hinzufügen")); btnSet.AddButton(btnCheck); dialogEx.AddButtonSet(btnSet); await dialogEx.ShowAsync(grMain); // Antwort auslesen answer = dialogEx.GetAnswer(); // Wenn Antwort Hinzufügen if (answer == resource.GetString("001_Hinzufügen")) { // Server Daten zusammenstellen Uri serverUri = null; string serverUriStr = dialogEx.GetTextBoxTextByTitle(resource.GetString("001_Server").Trim()); if (Uri.TryCreate(serverUriStr, UriKind.Absolute, out serverUri)) { serverUrl = serverUri.ToString(); pathStack = new Stack <string>(); if (!string.IsNullOrEmpty(dialogEx.GetTextBoxTextByTitle(resource.GetString("001_Benutzername")).Trim()) && !string.IsNullOrEmpty(dialogEx.GetPasswordBoxTextByTitle(resource.GetString("001_Passwort")).Trim())) { credential = new NetworkCredential(); credential.UserName = dialogEx.GetTextBoxTextByTitle(resource.GetString("001_Benutzername")).Trim(); credential.Password = dialogEx.GetPasswordBoxTextByTitle(resource.GetString("001_Passwort")).Trim(); } else { credential = null; } // List the sub folders and file. ListDirectory(); } else { // NotifyUser(serverUriStr + " is not a valid FTP server"); } answer = resource.GetString("001_Abbrechen"); } } }
// ----------------------------------------------------------------------- // Button Dropbox // ----------------------------------------------------------------------- private async void Dropbox_PointerReleased(object sender, PointerRoutedEventArgs e) { // Antwort string answer = ""; string name = ""; // Schleife bis Daten vorhanden while (answer != resource.GetString("001_Abbrechen")) { // Passwort Eingabe erstellen DialogEx dEx = new DialogEx(resource.GetString("001_Einstellungen")); DialogExTextBox tbUser = new DialogExTextBox(resource.GetString("001_Name"), name); dEx.AddTextBox(tbUser); DialogExButtonsSet btnSet = new DialogExButtonsSet(); btnSet.Margin = new Thickness(0, 6, 0, 24); DialogExButton btnAbort = new DialogExButton(resource.GetString("001_Abbrechen")); btnSet.AddButton(btnAbort); DialogExButton btnCheck = new DialogExButton(resource.GetString("001_Hinzufügen")); btnSet.AddButton(btnCheck); dEx.AddButtonSet(btnSet); await dEx.ShowAsync(grMain); // Daten auslesen answer = dEx.GetAnswer(); name = dEx.GetTextBoxTextByTitle(resource.GetString("001_Name")); // Wenn Antwort Hinzufügen if (answer == resource.GetString("001_Hinzufügen")) { // Wenn kein Dropbox Name vorhanden if (dEx.GetTextBoxTextByIndex(0) == "") { // Nachricht ausgeben // Kein Name eingegeben dEx = new DialogEx(resource.GetString("001_KeinName")); DialogExButtonsSet dBSet = new DialogExButtonsSet(); DialogExButton dBtn = new DialogExButton(resource.GetString("001_Schließen")); dBSet.AddButton(dBtn); dEx.AddButtonSet(dBSet); await dEx.ShowAsync(grMain); } // Wenn ein Name eingegeben else { // Semikolon entfernen name = Regex.Replace(name, ";", ""); // Versuchen einen Ordner zu erstellen try { // Ordner erstellen StorageFolder sf = await folderTemp.CreateFolderAsync(name); await sf.DeleteAsync(); // Dropbox verbinden dropboxToken = ""; dropboxToken = await DropboxConnect(); // Wenn Token vorhanden if (dropboxToken != "") { // One Drive in Start hinzufügen MainPage.setStartMenu += "dropbox;" + name + ";" + dropboxToken + ";;;"; // Einstellungen speichern StorageFile storageFile = await folderSettings.CreateFileAsync("StartMenu.txt", CreationCollisionOption.OpenIfExists); await FileIO.WriteTextAsync(storageFile, MainPage.setStartMenu); // Zurück zur Startseite Frame.GoBack(); // Schleife beenden break; } // Bei Fehlern else { // Nachricht ausgeben // Verbindung nicht möglich dEx = new DialogEx(resource.GetString("001_VerbindungNicht")); DialogExButtonsSet dBSet = new DialogExButtonsSet(); DialogExButton dBtn = new DialogExButton(resource.GetString("001_Schließen")); dBSet.AddButton(dBtn); dEx.AddButtonSet(dBSet); await dEx.ShowAsync(grMain); } } // Wenn Name nicht verwendet werden kann catch { // Nachricht ausgeben // Kein Name eingegeben dEx = new DialogEx(resource.GetString("001_NameFalsch")); DialogExButtonsSet dBSet = new DialogExButtonsSet(); DialogExButton dBtn = new DialogExButton(resource.GetString("001_Schließen")); dBSet.AddButton(dBtn); dEx.AddButtonSet(dBSet); await dEx.ShowAsync(grMain); } } } } }
// ----------------------------------------------------------------------- // Button Password zurücksetzen // ----------------------------------------------------------------------- private async void btnPD2_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { // Versuchen Passwort zu laden try { StorageFile passFile = await folderSettings.GetFileAsync("Private.txt"); var passTemp = await FileIO.ReadTextAsync(passFile); string pass1 = passTemp.ToString(); // Passwort abfragen DialogEx dEx = new DialogEx(resource.GetString("001_PasswortZurück")); DialogExPasswordBox pb_1 = new DialogExPasswordBox(resource.GetString("001_Passwort")); dEx.AddPasswordBox(pb_1); DialogExButtonsSet dBSet = new DialogExButtonsSet(); DialogExButton dBtn_1 = new DialogExButton(resource.GetString("001_PasswortZurück")); dBSet.AddButton(dBtn_1); DialogExButton dBtn_2 = new DialogExButton(resource.GetString("001_Abbrechen")); dBSet.AddButton(dBtn_2); dEx.AddButtonSet(dBSet); await dEx.ShowAsync(grMain); // Antwort auslesen string answer = dEx.GetAnswer(); // Wenn Antwort Passwort Zurücksetzen if (answer == resource.GetString("001_PasswortZurück")) { // Passwort auslesen string pass0 = dEx.GetPasswordBoxTextByIndex(0); // Wenn Passwort vorhanden if (pass0.Length > 0) { // Wenn Passwört richtig if (pass0 == pass1 | pass0 == "I am stupid and lost my password") { // Passwort löschen await passFile.DeleteAsync(); } // Wenn Passwort falsch else { //Fehlermeldung ausgeben dEx = new DialogEx(resource.GetString("001_Fehler"), resource.GetString("001_ZugriffVerweigert")); dBSet = new DialogExButtonsSet(); dBtn_1 = new DialogExButton(resource.GetString("001_Schließen")); dBSet.AddButton(dBtn_1); dEx.AddButtonSet(dBSet); await dEx.ShowAsync(grMain); } } // Wenn kein Passwort vorhanden else { //Fehlermeldung ausgeben dEx = new DialogEx(resource.GetString("001_Fehler"), resource.GetString("001_KeinPasswort")); dBSet = new DialogExButtonsSet(); dBtn_1 = new DialogExButton(resource.GetString("001_Schließen")); dBSet.AddButton(dBtn_1); dEx.AddButtonSet(dBSet); await dEx.ShowAsync(grMain); } } } catch { } }