コード例 #1
0
        private async void DispatcherTimer_TickAsync(object sender, object e)
        {
            try
            {
                string filename = "data.csv";
                var    task     = App.DataBaseAccess.GetRegistersAsync();
                task.Wait();
                List <Registre> result = task.Result;

                Debug.WriteLine("----------Criando arquivo---------");
                string csv = CreateCSVFile.CreateFromRegistres(result);
                Debug.WriteLine(csv);

                Debug.WriteLine("----------Enviando arquivo: " + filename);
                using (var dbx = new DropboxClient("x"))
                {
                    var full = await dbx.Users.GetCurrentAccountAsync();

                    Debug.WriteLine("{0} - {1}", full.Name.DisplayName, full.Email);
                    await Upload(dbx, "/Lareso_Biodigestor_01", filename, csv);
                }
                //App.DataBaseAccess.RemoveRegisters(result);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Erro: " + ex.Message);
            }
        }
コード例 #2
0
        public async Task SyncRegistersAsync(List <Registre> registres)
        {
            try
            {
                Debug.WriteLine("----------Criando arquivo---------");
                string csv      = CreateCSVFile.CreateFromRegistres(registres);
                string filename = DateTime.Now.ToString("ddMMyyyyHHmm") + ".csv";
                Debug.WriteLine(csv);

                Debug.WriteLine("----------Enviando arquivo: " + filename);
                using (var dbx = new DropboxClient("dpugWbLLRQUAAAAAAAACL57r7ZkFLokva7oVxKBXhIcoKKYrBz1tcXXhFZhkHowp"))
                {
                    var full = await dbx.Users.GetCurrentAccountAsync();

                    // Debug.WriteLine("{0} - {1}", full.Name.DisplayName, full.Email);
                    await Upload(dbx, "/devices/device1/data", filename, "asfdasdfasdf");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }