/// <summary> /// Adds or Edits subscription and closes subscription popup /// </summary> internal bool SaveSubscription() { if (!NewUrlText.StartsWith("iros://")) { StatusMessage = ResourceHelper.Get(StringKey.UrlMustBeInIrosFormat); return(false); } if (!SubscriptionList.Any(s => s.Url == NewUrlText)) { IsResolvingName = true; SubscriptionNameHintText = ResourceHelper.Get(StringKey.ResolvingCatalogName); ResolveCatalogNameFromUrl(NewUrlText, resolvedName => { NewNameText = resolvedName; App.Current.Dispatcher.Invoke(() => { SubscriptionList.Add(new SubscriptionSettingViewModel(NewUrlText, NewNameText)); CloseSubscriptionPopup(); IsResolvingName = false; ListDataChanged?.Invoke(); }); }); } else if (IsEditingSubscription) { SubscriptionSettingViewModel toEdit = SubscriptionList.FirstOrDefault(s => s.Url == NewUrlText); toEdit.Name = NewNameText; CloseSubscriptionPopup(); ListDataChanged?.Invoke(); } else { // if user is trying to add a url that already exists in list then just close popup CloseSubscriptionPopup(); return(true); } SubscriptionsChanged = true; return(true); }
internal void RemoveSelectedSubscription(SubscriptionSettingViewModel selected) { SubscriptionsChanged = true; SubscriptionList.Remove(selected); ListDataChanged?.Invoke(); }