Ejemplo n.º 1
0
 private async void startUpload()
 {
     try {
         string msg = null;
         if (string.IsNullOrWhiteSpace(this.localDirectory) || !Directory.Exists(localDirectory))
         {
             msg = "Der angegebene lokale Ordner ist ungültig.";
         }
         if (string.IsNullOrWhiteSpace(this.UserName))
         {
             msg = "Der angegebene Benutzername ist ungültig.";
         }
         if (string.IsNullOrWhiteSpace(this.Password))
         {
             msg = "Das angegeben Passwort ist ungültig";
         }
         if (msg != null)
         {
             MessageBox.Show(msg, "Ungültige Angaben", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             try {
                 Uploader uplidupli = new Uploader(UserName, Password);
                 uplidupli.LogEvent += Uplidupli_LogEvent;
                 await uplidupli.DoThisEvilStuff(LocalDirectory);
             }
             catch (Exception ex) {
                 do
                 {
                     Uplidupli_LogEvent(this, new KcaLibrary.Core.Types.Events.KcaLogEventArgs(ex.Message));
                     ex = ex.InnerException;
                 } while (ex.InnerException != null);
             }
         }
     }
     catch (Exception ex) {
         StringBuilder sb = new StringBuilder();
         do
         {
             sb.AppendLine(ex.Message);
             ex = ex.InnerException;
         } while (ex != null);
         MessageBox.Show(sb.ToString(), "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }