Beispiel #1
0
 private void AddProduct_Load(object sender, EventArgs e)
 {
     Task.Run(() =>
     {
         Rest.GetCategoriesAsync().Wait();
         if (InvokeRequired)
         {
             Invoke((Action)(
                        () =>
             {
                 foreach (var s in Rest.categories)
                 {
                     CategoryListBox.Items.Add(s.name);
                 }
             }));
         }
         else
         {
             foreach (var s in Rest.categories)
             {
                 CategoryListBox.Items.Add(s.name);
             }
         }
     });
 }