Пример #1
0
        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}");
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
 public bool Contains(ICanvasObject item) => children.Contains(item);