예제 #1
0
        // -----------------------------------------------------------------------



        // 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");
                }
            }
        }