Example #1
0
 void InitData()
 {
     _ProgressDialog = new CustomProgressDialog(this);
     _ProgressDialog.SetMessage("Daten werden geladen");
     _ProgressDialog.SetCancelable(false);
     _ProgressDialog.Show();
     MainActivity.RunOnNewThread(delegate {
         var client  = new WebClient();
         string data = "";
         try
         {
             client.Credentials = new NetworkCredential("jonjon0815", "Toaster1144");
             data = client.DownloadString("https://umwelt.wasweisich.com/get/");
             //Toast.MakeText(this, data, ToastLength.Short).Show();
         }
         catch (Exception ex)
         {
             RunOnUiThread(delegate {
                 var dialog = new AlertDialog.Builder(this);
                 dialog.SetTitle("Fehler");
                 dialog.SetMessage("Die Daten konnten nicht vom Server geladen werden" + System.Environment.NewLine + "[" + ex.Message + "]");
                 dialog.SetIcon(Resources.GetDrawable(Resource.Drawable.Error));
                 dialog.SetPositiveButton("Wiederholen", delegate { InitData(); });
                 dialog.SetNegativeButton("Abbrechen", delegate { this.OnBackPressed(); });
                 dialog.Show();
             });
             return;
         }
         var a = data.Split(new[] { "<br/>" }, StringSplitOptions.None);
         RunOnUiThread(delegate {
             foreach (var b in a)
             {
                 if (b.Contains("<"))
                 {
                     continue;
                 }
                 if (b == "" || b.Contains(System.Environment.NewLine))
                 {
                     continue;
                 }
                 var c = b.Replace('.', ',').Split('|');
                 try
                 {
                     //System.Diagnostics.Debug.Print("---[\"" + (double.Parse(c[0])).ToString() + "\"]---");
                     //Toast.MakeText(this, c[0] + "|" + c[1] + "|" + c[2] + "|", ToastLength.Short).Show();
                     var KommStr = "";
                     if (c[4] != "")
                     {
                         KommStr = System.Environment.NewLine + c[4];
                     }
                     AddMarker(int.Parse(c[2]), double.Parse(c[1]), double.Parse(c[0]), c[3] + KommStr);
                 }
                 catch { }
             }
             _ProgressDialog.Cancel();
         });
     });
 }
Example #2
0
 public AsynkProgressDialog(CustomProgressDialog _dialog) : base()
 {
     dialog = _dialog;
 }