private async void btMakeMap_Click(object sender, EventArgs e) { string[] selectedProfiles = checkedListBoxProfiles.CheckedItems.Cast <string>().ToArray(); if (selectedProfiles.Length == 0) { MessageBox.Show("Select at least one profile"); return; } string name = tbName.Text; var labels = _controller.State.Labels.Where(t => selectedProfiles.Contains(t.ProfileName)).ToArray(); if (labels.Length < 2) { MessageBox.Show("Selected profiles contain less than 2 labels, not enough labels"); return; } Job = new ProcessMapJob() { Labels = labels.Select(t => t._id).ToArray(), LogName = _controller.State.Info.Name, MapName = name, Id = Guid.NewGuid(), MapId = Guid.NewGuid() }; await ApiBoundary.AddProcessMapJob(Job); tabControl.SelectTab(1); jobWaiter.SetJobs(new Guid[] { Job.Id }); jobWaiter.Start(); jobWaiter.onAllJobsCompleted += JobWaiterOnOnAllJobsCompleted; //timerCheckStatus.Start(); }
private async void buttonCreate_Click(object sender, EventArgs e) { var selected = new List <string>(checkedListBoxValues.CheckedItems.Cast <string>()); if (selected.Count < 2) { MessageBox.Show("Select at least two values, each value will represent one node in process map"); return; } var mapName = tbMapName.Text; if (string.IsNullOrEmpty(mapName)) { MessageBox.Show("Enter map name"); return; } var profileName = $"_map_{mapName}_autogenerated"; var fieldName = selectedField; var labels = selected.Select(t => MakeLabel(fieldName, t, profileName)).ToList(); foreach (var logLabel in labels) { await _controller.AddLabel(logLabel); } Job = new ProcessMapJob() { Labels = labels.Select(t => t._id).ToArray(), LogName = _controller.State.Info.Name, MapName = mapName, Id = Guid.NewGuid(), MapId = Guid.NewGuid() }; await ApiBoundary.AddProcessMapJob(Job); JobWaiterForm form = new JobWaiterForm(Job.Id); var res = form.ShowDialog(); if (res == DialogResult.OK) { btOpenMap.Enabled = true; } else { Close(); } }