public async Task RemoveProfileAsync(Profile profile) { if (!_profiles.Contains(profile)) { throw new ArgumentException("Unknown profile."); } if (_profiles.Count == 0) { throw new InvalidOperationException("Can't delete the last profile."); } if (profile == await ActiveProfile.LastAsync()) { _activeProfile.OnNext(_profiles.Except(new[] { profile }).First()); } _profiles.Remove(profile); profile.Changed -= ProfileOnChanged; var httpClient = _httpClientFactory.CreateClient(EndPoints.BackEnd); using var response = await httpClient.DeleteAsync($"profile/{profile.Id}"); }
public void RegisterWidget(IWidgetPropertyData wdgVM) { if (_widgtes.Contains(wdgVM)) { return; } INotifyPropertyChanged vm = wdgVM as INotifyPropertyChanged; vm.PropertyChanged += WdgPropertyChangedHandler; //_widgtes.Add(wdgVM); try { _widgtes.Add(wdgVM); } catch (System.Exception ex) { Debug.WriteLine(ex.Message); } }
public bool Contains(ICanvasObject item) => children.Contains(item);