예제 #1
0
        private void BtnGenerateEventsClick(object sender, EventArgs e)
        {
            int TargetTasksCount = (int)this.numEventsCount.Value;

            this.pgGenProgress.Step    = this.pgGenProgress.Minimum;
            this.pgGenProgress.Maximum = TargetTasksCount;

            this.worker.DoWork += (o, args) =>
            {
                IList <StoredContact> contacts =
                    this.clTargetContacts.dgObjects.Objects
                    .Cast <StoredContact>()
                    .ToList();

                IList <Storage.Task> templates =
                    this.clEventTemplates.dgObjects.Objects
                    .Cast <Storage.Task>()
                    .ToList();

                Generator gen = new Generator(
                    ref _service,
                    ref contacts,
                    ref templates,
                    TargetTasksCount,
                    () => this.worker.ReportProgress(1));
                gen.GenTasks();
            };
            this.worker.RunWorkerAsync();
        }
예제 #2
0
        private void BtnGenMailClick(object sender, EventArgs e)
        {
            int targetMailsCount = (int) this.numMailsCount.Value;

            this.pgGenProgress.Step = this.pgGenProgress.Minimum;
            this.pgGenProgress.Maximum = targetMailsCount;

            this.worker.DoWork += (o, args) =>
            {
                IList<StoredContact> contacts =
                    this.clTargetContacts.dgObjects.Objects
                        .Cast<StoredContact>()
                        .ToList();

                IList<Storage.Message> templates =
                    this.clMailTemplates.dgObjects.Objects
                        .Cast<Storage.Message>()
                        .ToList();

                Generator gen = new Generator(
                    ref _service, ref contacts, ref templates,
                    targetMailsCount,
                    () => this.worker.ReportProgress(1));
                gen.GenEmails();
            };
            this.worker.RunWorkerAsync();
        }