Ejemplo n.º 1
0
        private async Task DownloadTranslationFile(string langCode, int totalSegments)
        {
            this.DownloadingResources[langCode] = true;

            // Calculate file size for progress
            this.progressBarDownlodResources.Visible = true;
            this.progressBarDownlodResources.Value   = 0;
            this.progressBarDownlodResources.Maximum = TransifexConnector.GetTotalResouresSize(langCode, this.ProjectInfo.Resources, totalSegments);
            this.progressBarDownlodResources.Step    = 1024;

            // Progress reporter
            var progress = new Progress <int>();

            progress.ProgressChanged += (s, percent) =>
            {
                progressBarDownlodResources.PerformStep();
            };

            // Download file
            if (this.checkBoxLiveUpdate.Checked)
            {
                // from transifex website
                try
                {
                    await TransifexConnector.DownloadTranslationResources(langCode, this.ProjectInfo.Resources, progress);
                }
                catch
                {
                    var dialogResult = MessageBox.Show(
                        "Transifex website reject download request.\r\nLast available translation can't be download\r\nDo you want to download backup ?",
                        "Revert changes success",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Error);
                    if (dialogResult == System.Windows.Forms.DialogResult.Yes)
                    {
                    }
                }
            }
            else
            {
                // backuo available in dropbox
                await DropboxConnector.DownloadTranslationResources(langCode, this.ProjectInfo.Resources, progress);
            }

            this.DownloadingResources[langCode] = false;
        }
Ejemplo n.º 2
0
 private async void LoadBackupDate()
 {
     this.LastBackupDate = await DropboxConnector.GetBackupDate();
 }