Ejemplo n.º 1
0
        private async void btAdd_Click(object sender, EventArgs e)
        {
            var f = new RuleEditorForm();

            if (f.ShowDialog() == DialogResult.OK)
            {
                //check if there exist such item
                //if (_state.Rules.ContainsKey(f.Result.Name))
                //{
                //    MessageBox.Show("Item with such name already exist, info is lost");
                //}
                //else
                //{
                await _controller.AddLabel(f.Result);

                FillTheList();
                //_state.Labels.Add(f.Result);
                //checkedListBoxRules.Items.Add(f.Result.Name, true);
                //}
            }
        }
        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();
            }
        }
Ejemplo n.º 3
0
        private async void addButton_Click(object sender, EventArgs e)
        {
            if (_selectedProfile == PROFILES_ALL_NAME)
            {
                MessageBox.Show("Select profile first");
                return;
            }
            var(res, form) = LabelEditorForm.GoCreate(_selectedProfile);
            if (res == DialogResult.OK)
            {
                await _controller.AddLabel(form.Result);

                RefreshDataInAdapter();
                //adapter.UpdateData(_state.Labels);
            }
        }
Ejemplo n.º 4
0
        private async void cloneButton_Click(object sender, EventArgs e)
        {
            var dialog = new TextFieldDialog("Cloned item profile", "Profile", data.ProfileName);
            var res    = dialog.ShowDialog();

            if (res != DialogResult.OK)
            {
                return;
            }
            var clonedItem = JsonConvert.DeserializeObject <LogLabel>(JsonConvert.SerializeObject(data));

            clonedItem._id         = Guid.NewGuid().ToString();
            clonedItem.ProfileName = dialog.Result;
            if (clonedItem.ProfileName == data.ProfileName)
            {
                clonedItem.Name += "_cloned";
            }
            await _controller.AddLabel(clonedItem);

            RaiseOnDataDirty();
        }
Ejemplo n.º 5
0
        private async void btGenerate_Click(object sender, EventArgs e)
        {
            EnableProgress(true);
            var profileName = tbProfileName.Text;

            if (string.IsNullOrWhiteSpace(profileName))
            {
                MessageBox.Show("Wrong profile name");
                return;
            }
            var grouped = GroupingValues.Where(t => t.Include).GroupBy(t => t.GroupIndex);

            foreach (var gr in grouped)
            {
                var label = MakeLabel(gr.ToArray(), profileName);
                await _controller.AddLabel(label);
            }

            MessageBox.Show("OK");
            EnableProgress(false);
            Close();
        }