private void AddLabelCommandOnExecute(object o) { var newLabel = new CustomLabelVM(new CustomLabel()) { Name = "New Label" }; CustomLabels.Add(newLabel); _labelHost.AddCustomTextLabel(newLabel); _added.Add(newLabel); }
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); }
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); } }
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); }