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(); }
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(); } }
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"); }
private async void btImport_Click(object sender, EventArgs e) { var fname = cbFiles.SelectedItem.ToString(); var logName = tbLogName.Text; if (string.IsNullOrWhiteSpace(logName)) { MessageBox.Show("Enter name of the log"); return; } var groupingField = cbGroupingField.SelectedItem?.ToString(); if (groupingField == null) { MessageBox.Show("Select grouping field"); return; } var groupingFieldType = cbGroupingFieldType.SelectedItem?.ToString(); if (groupingFieldType == null) { MessageBox.Show("Select grouping field type"); return; } var timeField = cbTimeField.SelectedItem?.ToString(); if (timeField == null) { MessageBox.Show("Select time field"); return; } var timeFieldType = cbTimeFieldType.SelectedItem?.ToString(); if (timeFieldType == null) { MessageBox.Show("Select time field type"); return; } if (tbDelimiter.Text.Length < 1) { MessageBox.Show("Enter delimiter character"); return; } var delimiter = tbDelimiter.Text[0]; var guid = Guid.NewGuid(); var importArgs = new ImportArgs() { JobID = guid, LogName = logName, FileName = fname, GroupingField = groupingField, GroupingFieldType = groupingFieldType, TimeField = timeField, TimeFieldType = timeFieldType, CsvDelimiter = delimiter }; await ApiBoundary.AddImportTask(importArgs); JobWaiterForm form = new JobWaiterForm(guid); form.ShowDialog(); Close(); //btJobsRefresh_Click(null, null); }