Exemplo n.º 1
0
        public bool RemoveFavorite(string name, string path)
        {
            try
            {
                FileInfo fi = new FileInfo(ConfigPath);
                if (!fi.Exists)
                {
                    return(false);
                }

                XmlStream stream = new XmlStream("Favorites");
                stream.ReadStream(fi.FullName);
                FavoriteList favList = (FavoriteList)stream.Load("favlist", null, new FavoriteList());
                if (favList == null)
                {
                    return(false);
                }

                favList.Remove(name, path);

                stream = new XmlStream("Favorites");
                stream.Save("favlist", favList);

                stream.WriteStream(fi.FullName);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error - Remove Favorite");
            }
            return(false);
        }
Exemplo n.º 2
0
        public void RemoveFavorite(string volId)
        {
            var volume = FavoriteList.FirstOrDefault(vol => vol.VolumeId == volId);

            if (volume != null)
            {
                FavoriteList.Remove(volume);
            }
        }
Exemplo n.º 3
0
        public async Task <bool> RemoveUserFavriteAsync(string favId)
        {
            var vol = FavoriteList.FirstOrDefault(fav => fav.FavId == favId);

            if (String.IsNullOrEmpty(favId) || vol == null)
            {
                return(false);
            }
            try
            {
                await LightKindomHtmlClient.DeleteUserFavorite(favId);

                FavoriteList.Remove(vol);
                CachedClient.UpdateCachedUserFavoriteVolumes(FavoriteList);
                return(true);
            }
            catch (Exception exception)
            {
                Debug.WriteLine("Error : Failed to Remove User Favorite : " + exception.Message);
            }
            return(false);
        }
Exemplo n.º 4
0
        public async Task <bool> RemoveUserFavriteAsync(string[] favIds)
        {
            try
            {
                await LightKindomHtmlClient.DeleteUserFavorite(favIds);

                foreach (var favId in favIds)
                {
                    var f = FavoriteList.FirstOrDefault(fa => fa.FavId == favId);
                    if (f != null)
                    {
                        FavoriteList.Remove(f);
                    }
                }
                CachedClient.UpdateCachedUserFavoriteVolumes(FavoriteList);
                return(true);
            }
            catch (Exception exception)
            {
                Debug.WriteLine("Error : Failed to Remove User Favorite : " + exception.Message);
            }
            return(false);
        }
Exemplo n.º 5
0
        public async Task SyncFavoriteListAsync(bool forceRefresh = false)
        {
            try
            {
                var fav = await CachedClient.GetUserFavoriteVolumesAsync(!IsUserFavoriteValiad || forceRefresh);

                if (FavoriteList == null)
                {
                    FavoriteList = new ObservableCollection <FavourVolume>(fav);
                }
                else
                {
                    //FavoriteList.Clear();
                    var olds = FavoriteList.Except(fav, new FavItemEqualityComparer()).ToArray();
                    foreach (var item in olds)
                    {
                        FavoriteList.Remove(item);
                    }
                    var news = fav.Except(FavoriteList, new FavItemEqualityComparer()).ToArray();
                    foreach (var item in fav)
                    {
                        if (!FavoriteList.Any(f => f.VolumeId == item.VolumeId))
                        {
                            FavoriteList.Add(item);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Debug.WriteLine("Error : Failed to Sync User Favorite : " + exception.Message);
                if (FavoriteList == null)
                {
                    FavoriteList = new ObservableCollection <FavourVolume>();
                }
            }
        }
Exemplo n.º 6
0
 public void RemoveFromFavorite(Scene sc)
 {
     FavoriteList.Remove(sc);
     _favoriteIdList.Remove("sc_" + sc.Id);
     config.FavoriteList = _favoriteIdList;
 }
Exemplo n.º 7
0
 public void RemoveFromFavorite(Model.EqLogic eq)
 {
     FavoriteList.Remove(eq);
     _favoriteIdList.Remove("eq_" + eq.Id);
     config.FavoriteList = _favoriteIdList;
 }