Пример #1
0
        private void bChangeDateTime_Click(object sender, EventArgs e)
        {
            string errors;
            var countChangedFiles = new ChangeDataClass()
                .ChangeCreatingDateTimeForFiles(m_Files, int.Parse(tb_Minutes.Text), out errors);

            MessageBox.Show(String.Format(Resources.CountFilesWasProcessed,
                countChangedFiles, String.IsNullOrEmpty(errors) ? Resources.WithoutErrors : errors),
                Resources.Result, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Пример #2
0
        private void bChangeGeoData_Click(object sender, EventArgs e)
        {
            string errors;
            TaskFactory uiFactory = new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext());
            progressBar1.Maximum = m_Files.Count();
            this.Enabled = false;
            Task.Factory.StartNew(() =>
            {
                var countChangedFiles = new ChangeDataClass().ChangeGeoDataForFiles
                    (m_Files, tb_pathToGpxFile.Text, int.Parse(tb_timeZone.Text),
                        () =>uiFactory.StartNew(()=>progressBar1.PerformStep()),
                   out errors);

                uiFactory.StartNew(() =>
                {
                    this.Enabled = true;
                    MessageBox.Show(String.Format(Resources.CountFilesWasProcessed,
                        countChangedFiles, String.IsNullOrEmpty(errors) ? Resources.WithoutErrors :
                         "\r\n" +Resources.Error+ errors),
                        Resources.Result, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    progressBar1.Value =1;
                });
            });
        }