示例#1
0
        private void AddLabelCommandOnExecute(object o)
        {
            var newLabel = new CustomLabelVM(new CustomLabel())
            {
                Name = "New Label"
            };

            CustomLabels.Add(newLabel);
            _labelHost.AddCustomTextLabel(newLabel);

            _added.Add(newLabel);
        }
示例#2
0
        private void AddLabelCommandOnExecute(object o)
        {
            BeginEdit();

            var newLabel = new CustomLabelVM(new CustomLabel(), _dialogService)
            {
                Name = "New Label"
            };

            CustomLabels.Add(newLabel);
            _labelService.AddCustomTextLabel(newLabel);

            _added.Add(newLabel);
        }
示例#3
0
        private async Task RemoveLabelCommandOnExecute(CustomLabelVM labelVm)
        {
            if (!await DialogService.ShowConfirmationDialogAsync("Delete Label", $"Are you sure you want to delete the label '{labelVm.Name}'?"))
            {
                return;
            }

            CustomLabels.Remove(labelVm);
            _labelHost.RemoveCustomTextLabel(labelVm);

            // Only add to removed if not a new label
            if (!_added.Remove(labelVm))
            {
                _removed.Add(labelVm);
            }
        }
示例#4
0
        private void RemoveLabelCommandOnExecute(CustomLabelVM labelVm)
        {
            BeginEdit();

            if (!_dialogService.ShowConfirmationDialog("Delete Label", $"Are you sure you want to delete the label '{labelVm.Name}'?"))
            {
                return;
            }

            CustomLabels.Remove(labelVm);
            _labelService.RemoveCustomTextLabel(labelVm);

            // Only add to removed if not a new label
            if (!_added.Remove(labelVm))
            {
                _removed.Add(labelVm);
            }
        }
 /// <inheritdoc/>
 public void RemoveCustomTextLabel(CustomLabelVM label)
 {
     _labels.Remove(label);
     CustomLabelRemoved?.Invoke(this, label);
 }
 /// <inheritdoc/>
 public void AddCustomTextLabel(CustomLabelVM label)
 {
     _labels.Add(label);
     CustomLabelAdded?.Invoke(this, label);
 }