示例#1
0
        private async void btCacheAll_Click(object sender, EventArgs e)
        {
            var labelsToCache = _state.Labels.Where(ProfileFilter).Where(t => !t.HasCache).ToList();

            if (labelsToCache.Count == 0)
            {
                MessageBox.Show("Nothing to cache");
                return;
            }
            List <Guid> guids = new List <Guid>();

            foreach (var label in labelsToCache)
            {
                var job = new CacheLabelJob()
                {
                    LabelId = label._id,
                    LogName = _controller.State.Info.Name
                };
                guids.Add(job.Id);
                await ApiBoundary.AddCacheLabelJob(job);
            }

            //MessageBox.Show($"Added {labelsToCache.Count} cache jobs, wait and do not click this button again");
            JobWaiterForm form = new JobWaiterForm(guids.ToArray());

            form.jobWaiter.onAllJobsCompleted += async delegate
            {
                await _controller.LoadLabels();

                RefreshDataInAdapter();
            };
            form.Show();
        }
示例#2
0
        private async void btCache_Click(object sender, EventArgs e)
        {
            var job = new CacheLabelJob()
            {
                LabelId = data._id,
                LogName = _controller.State.Info.Name
            };
            await ApiBoundary.AddCacheLabelJob(job);

            JobWaiterForm form = new JobWaiterForm(new Guid[] { job.Id });

            form.jobWaiter.onAllJobsCompleted += async delegate
            {
                await _controller.LoadLabels();

                RaiseOnDataDirty();
            };
            form.Show();

            //MessageBox.Show("Added job, you may continue to work, do not click this button again");
        }