I am using dropbox api in my winforms app for the picture upload . I want that when picture upload unsuccessful then it auto retry after 2 second to upload it . This method call after every 2 minutes and i want if upload is unsuccessful then it will retry to upload it.
       static string token = "ABC";
    async Task Uploaded()
      {
        using (var dbx = new DropboxClient(token))
        {
            bmp = new Bitmap(picboxcapture.Image);
           
            string folder = "/pic/" + Login.recuser + "";
            string filename = DateTime.Now.ToString() + " " + "  " + MyTodo_Project.rectsk + ".JPG";
            string URL = picboxcapture.Image.ToString();
            ImageConverter converter = new ImageConverter();
        
            byte[] bytes = (byte[])converter.ConvertTo(picboxcapture.Image, typeof(byte[]));
            var mem = new MemoryStream(bytes);
          
            var updated = dbx.Files.UploadAsync(folder + "/" + filename, 
            WriteMode.Overwrite.Instance, body: mem);
            updated.Wait();
            var tx = dbx.Sharing.CreateSharedLinkWithSettingsAsync(folder + "/" + filename);
            tx.Wait();
            URL = tx.Result.Url;
         
            
          
        }
    }
        private async void save_Load(object sender, EventArgs e)
         {
       
            await Uploaded();
         }
