Пример #1
0
 public void AddFavoriteMovie(Movie movie)
 {
     Favorites.Add(new CustomerFavorite()
     {
         MovieId = movie.Id, CustomerId = CustomerId, Movie = movie, Customer = this
     });
 }
Пример #2
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Favorites.Clear();

                List <Favorite> favoriteIds = await App.Database.GetItemsAsync();

                var items = await DataStore.GetItemsAsync(true);

                var favorites = items.Join(favoriteIds, x => x.Id, y => y.Id, (x, y) => x);

                foreach (var favorite in favorites)
                {
                    Favorites.Add(favorite);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Пример #3
0
 public void AddFavoriteArtwork(Artwork artwork)
 {
     Favorites.Add(new CustomerFavorite()
     {
         ArtworkId = artwork.Id, CustomerId = CustomerId, Artwork = artwork, Customer = this
     });
 }
Пример #4
0
 public void AddFavoriteTuin(Tuin tuin)
 {
     Favorites.Add(new GebruikerFavorite()
     {
         TuinId = tuin.Id, GebruikerId = GebruikerId, Tuin = tuin, Gebruiker = this
     });
 }
Пример #5
0
 public void addFavoritePost(Post post)
 {
     Favorites.Add(new CustomerFavorite()
     {
         PostId = post.Id, CustomerId = CustomerId, Post = post, Customer = this
     });
 }
Пример #6
0
 public void AddFavoriteRecipe(Recipe recipe)
 {
     Favorites.Add(new CustomerFavorite()
     {
         RecipeId = recipe.Id, CustomerId = CustomerId, Recipe = recipe, Customer = this
     });
 }
Пример #7
0
 public void AddFavoriteBeer(Beer beer)
 {
     Favorites.Add(new CustomerFavorite()
     {
         BeerId = beer.Id, CustomerId = CustomerId, Beer = beer, Customer = this
     });
 }
Пример #8
0
        public void AddFavorite(FileSystemElement fse)
        {
            var favLink = new FavoriteNavigationLink(Symbol.OutlineStar, fse.Name, fse.Path, FavNavLinkUpCmd, FavNavLinkDownCmd, FavNavLinkRemoveCmd);

            NavigationItems.Insert(Favorites.Count, favLink);
            Favorites.Add(favLink);
        }
Пример #9
0
 public void AddFavorite(Favorite favorite, Action callback)
 {
     if (!Favorites.Any(fav => fav.SearchText.Equals(favorite.SearchText)))
     {
         Favorites.Add(favorite);
         callback();
         Save();
     }
 }
Пример #10
0
 private void Button_Click_6(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(ActiveUrl) && !Favorites.Contains(ActiveUrl))
     {
         Favorites.Add(ActiveUrl);
         IsFavoriteVisibility    = System.Windows.Visibility.Visible;
         IsNotFavoriteVisibility = System.Windows.Visibility.Collapsed;
     }
 }
Пример #11
0
        void appDataModel_Favorites_Changed(object sender, EventArgs.FavoritesChangedEventArgs e)
        {
            if (LocationTracker.LocationKnown == true)
            {
                e.newFavorites.Sort(new FavoriteDistanceComparer(locationTracker.CurrentLocation));
            }

            UIAction(() => Favorites.Clear());
            e.newFavorites.ForEach(favorite => UIAction(() => Favorites.Add(favorite)));
        }
Пример #12
0
 public void AddFavorite(Server server)
 {
     if (Favorites.Any(f => f.Matches(server)))
     {
         return;
     }
     Favorites.Add(new FavoriteServer(server));
     App.Events.Publish(new FavoritesUpdated(server));
     Save();
 }
Пример #13
0
 public void AddFavorite(MissionBase mission)
 {
     lock (Favorites) {
         if (Favorites.Any(f => f.Matches(mission)))
         {
             return;
         }
         Favorites.Add(new FavoriteMission(mission));
     }
     SaveSettings();
 }
Пример #14
0
        public async Task FavoriteEntry(Entry entry, HttpClient client)
        {
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Token);

            var response = await client.PostAsync($"api/entries/{entry.Id}/favorite", null);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                Favorites.Add(entry);
                entry.LikeCount++;
            }
        }
Пример #15
0
        public void AddFavorite(Game game)
        {
            lock (Favorites) {
                if (Favorites.Any(f => f.Matches(game)))
                {
                    return;
                }
                Favorites.Add(new FavoriteGame(game));
            }

            SaveSettings();
        }
Пример #16
0
        public void LoadDesignData()
        {
            string json = "[{\"author_avatar\":\"http://ww3.sinaimg.cn/large/005O2O52jw1f4slh5cvn6j305k05kaa4.jpg\",\"author_id\":null,\"author_name\":\"努力的doge\",\"author_summary\":null,\"body\":null,\"channels\":null,\"comment_count\":\"79\",\"commented\":\"false\",\"display_date\":null,\"display_type\":\"1\",\"document_id\":\"27919\",\"favorited\":\"true\",\"ga_prefix\":null,\"guide\":null,\"guide_image\":null,\"head\":null,\"hit_count\":\"40962\",\"hit_count_string\":\"4.1万\",\"publish_time\":null,\"published_at\":null,\"recommenders\":null,\"image\":null,\"section_name\":\"暴走天天看\",\"section_image\":\"http://ww4.sinaimg.cn/bmiddle/da4a9471gw1emu9mir52ij203c03c3yj.jpg\",\"key_words\":null,\"section_color\":\"FF9999\",\"section_id\":\"6\",\"share_url\":\"http://baozouribao.com/documents/27919\",\"original_tag\":null,\"tag_text\":null,\"thumbnail\":\"http://ww3.sinaimg.cn/large/005PPXEMjw1f4slh1e3s7j305k05kaaa.jpg\",\"timestamp\":null,\"title\":\"今天,doge要讲述一个悲伤的故事。。。\",\"url\":\"http://dailyapi.ibaozou.com/api/v31/documents/27919\",\"video_file_url\":null,\"video_image_url\":null,\"vote_count\":\"239\",\"voted\":\"false\"},{\"author_avatar\":\"http://ww4.sinaimg.cn/large/005O38k7jw1f0navob9dnj305k05k0sv.jpg\",\"author_id\":\"683368\",\"author_name\":\"吴彦祖的女人\",\"author_summary\":null,\"body\":null,\"channels\":null,\"comment_count\":\"80\",\"commented\":\"false\",\"display_date\":null,\"display_type\":\"2\",\"document_id\":\"27696\",\"favorited\":\"true\",\"ga_prefix\":null,\"guide\":null,\"guide_image\":null,\"head\":null,\"hit_count\":\"35105\",\"hit_count_string\":\"3.51万\",\"publish_time\":\"1465470000000\",\"published_at\":\"2016-06-09 19:00\",\"recommenders\":[{\"avatar\":\"http://ww4.sinaimg.cn/large/005O38k7jw1f0navob9dnj305k05k0sv.jpg\",\"id\":\"683368\",\"name\":\"吴彦祖的女人\"}],\"image\":null,\"section_name\":null,\"section_image\":null,\"key_words\":null,\"section_color\":null,\"section_id\":null,\"share_url\":null,\"original_tag\":null,\"tag_text\":null,\"thumbnail\":\"http://baozouribao-qiniu.b0.upaiyun.com/ribao_recommendation_image/2016/06/1465449544610-30e93963i6zx6xayr40sa1-ea6f7814dc820862c07c6b0a17628b3c\",\"timestamp\":\"1465449543\",\"title\":\"这位红三代牛X事迹一箩筐,还把三亿豪宅男主人和小公举藏了五年?!\",\"url\":\"http://mp.weixin.qq.com/s?__biz=MzA4NTI0Mjg2Nw==&mid=2652840480&idx=1&sn=bb0fe60ca701893251d3ca2bb628d67e&scene=0#wechat_redirect\",\"video_file_url\":null,\"video_image_url\":null,\"vote_count\":\"122\",\"voted\":\"false\"},{\"author_avatar\":\"http://ww4.sinaimg.cn/large/e8fffd59jw1ewj4gsa5mwj20dw0dwdgy.jpg\",\"author_id\":null,\"author_name\":\"大脸侠\",\"author_summary\":null,\"body\":null,\"channels\":null,\"comment_count\":\"140\",\"commented\":\"false\",\"display_date\":null,\"display_type\":\"1\",\"document_id\":\"27568\",\"favorited\":\"true\",\"ga_prefix\":null,\"guide\":null,\"guide_image\":null,\"head\":null,\"hit_count\":\"69462\",\"hit_count_string\":\"6.95万\",\"publish_time\":null,\"published_at\":null,\"recommenders\":null,\"image\":null,\"section_name\":\"电影收割机\",\"section_image\":\"http://ww1.sinaimg.cn/bmiddle/731ce372jw1evnuwui1kgj203c03cjra.jpg\",\"key_words\":null,\"section_color\":\"FF9999\",\"section_id\":\"124\",\"share_url\":\"http://baozouribao.com/documents/27568\",\"original_tag\":\"http://baozouribao-qiniu.b0.upaiyun.com/ribaopic/2016/05/1462853591015-b0edhpbqpf4lp02n4qk1b-21ee5b7a6e5b4c9bb2c2335a0bbb62dd\",\"tag_text\":null,\"thumbnail\":\"http://ww1.sinaimg.cn/large/005Oop2Wjw1f4p4m4fybtj303c03cwee.jpg\",\"timestamp\":null,\"title\":\"电影里那些让人毛骨悚然的表情,配合剧情食用更佳\",\"url\":\"http://dailyapi.ibaozou.com/api/v31/documents/27568\",\"video_file_url\":null,\"video_image_url\":null,\"vote_count\":\"324\",\"voted\":\"false\"},{\"author_avatar\":\"http://ww1.sinaimg.cn/large/0060idsIjw1ewj4ffcrynj30dw0dw405.jpg\",\"author_id\":null,\"author_name\":\"零小蝎\",\"author_summary\":null,\"body\":null,\"channels\":null,\"comment_count\":\"316\",\"commented\":\"false\",\"display_date\":null,\"display_type\":\"1\",\"document_id\":\"27654\",\"favorited\":\"true\",\"ga_prefix\":null,\"guide\":null,\"guide_image\":null,\"head\":null,\"hit_count\":\"68454\",\"hit_count_string\":\"6.85万\",\"publish_time\":null,\"published_at\":null,\"recommenders\":null,\"image\":null,\"section_name\":\"贵圈真乱\",\"section_image\":\"http://ww1.sinaimg.cn/thumbnail/7c1bc3cfjw1evobqxr369j20dw0dw0u7.jpg\",\"key_words\":null,\"section_color\":\"7CD095\",\"section_id\":\"125\",\"share_url\":\"http://baozouribao.com/documents/27654\",\"original_tag\":\"http://baozouribao-qiniu.b0.upaiyun.com/ribaopic/2016/05/1462853591015-b0edhpbqpf4lp02n4qk1b-21ee5b7a6e5b4c9bb2c2335a0bbb62dd\",\"tag_text\":null,\"thumbnail\":\"http://ww1.sinaimg.cn/large/005Oq1Rojw1f4o2i1gzo2j303c03cjrs.jpg\",\"timestamp\":null,\"title\":\"蔡依林打败三连冠的郭雪芙荣登全球百大美女第一名!\",\"url\":\"http://dailyapi.ibaozou.com/api/v31/documents/27654\",\"video_file_url\":null,\"video_image_url\":null,\"vote_count\":\"454\",\"voted\":\"false\"}]";
            var    list = JsonHelper.Deserlialize <List <Document> >(json);

            foreach (var item in list)
            {
                Favorites.Add(item);
            }

            IsEmpty = false;
        }
        private async void ExecuteAddFavoriteCommand()
        {
            var favoriteDialog = new FavoriteDialog();

            if (await favoriteDialog.ShowAsync() == Windows.UI.Xaml.Controls.ContentDialogResult.Primary)
            {
                Favorites.Add(favoriteDialog.Url);
                SqlHelper.Conn.Open();
                favoriteDialog.Url.Save();
                SqlHelper.Conn.Close();
            }
        }
Пример #18
0
        public FavoritesViewModel(INetworkService networkService, IMessenger messengerService,
                                  IFavoritesService favoritesService, ITileService tileService, IDialogService dialogService)
        {
            _networkService   = networkService;
            _messengerService = messengerService;
            _favoritesService = favoritesService;
            _settingsService  = SimpleIoc.Default.GetInstance <SettingsService>();
            _tileService      = tileService;
            _dialogService    = dialogService;

            Favorites.Add(GroupedFavoritePlaces);
            Favorites.Add(GroupedFavoriteRoutes);
        }
Пример #19
0
        public async Task AddItemAsync()
        {
            var newItem = new Favorite()
            {
                HostName   = this.HostName,
                PortNumber = this.PortNumber
            };

            Favorites.Add(newItem);

            var  repo   = new FavoritesRepository();
            bool saveOk = await repo.SaveAsync(Favorites.ToList());
        }
Пример #20
0
        public void DrawMenuBar()
        {
            ImGuiCli.BeginMenuBar();
            if (!CurrentDirectory.EndsWith(":") && !CurrentDirectory.EndsWith(":\\"))
            {
                //ImGuiEx.PushBoldFont();
                if (ImGuiCli.Button(ICON_FA.LEVEL_UP_ALT, new Vector2(32, 0)))
                {
                    CurrentDirectory = System.IO.Directory.GetParent(CurrentDirectory).FullName;
                    UpdateItems();
                }
                if (ImGuiCli.IsItemHovered())
                {
                    ImGuiCli.SetTooltip("To parent directory");
                }
                //ImGuiEx.PopFont();
            }
            ImGuiCli.Text(CurrentDirectory);
            ImGuiCli.PushItemWidth(ImGuiCli.GetContentRegionAvailWidth() * 0.7f - 70);
            filter_.Draw(ICON_FA.FILTER + " Filter");
            ImGuiCli.PopItemWidth();

            //ImGuiEx.PushBoldFont();
            ImGuiCli.SetCursorPosX(ImGuiCli.GetWindowWidth() - ImGuiCli.CalcTextSize(ICON_FA.LIST_UL + "  +  " + ICON_FA.STAR).X); //70);
            if (ImGuiCli.Button(ICON_FA.LIST_UL))
            {
                asDetail_ = !asDetail_;
            }
            if (ImGuiCli.IsItemHovered())
            {
                ImGuiCli.SetTooltip("Toggle details view");
            }

            if (ImGuiCli.Button("+" + ICON_FA.STAR))
            {
                if (!Favorites.Contains(CurrentDirectory))
                {
                    Favorites.Add(CurrentDirectory);
                }
            }
            if (ImGuiCli.IsItemHovered())
            {
                ImGuiCli.SetTooltip("Add to favorites");
            }
            //ImGuiEx.PopFont();

            ImGuiCli.EndMenuBar();
        }
Пример #21
0
        public static async Task AddFavorite(string mylistid)
        {
            if (!Favorites.Any(x => x.MylistId == mylistid))
            {
                Favorites.Add(new TNicoFavorite(mylistid, DateTime.Now.Ticks));

                using (var control = await DbUtil.GetControl())
                {
                    await control.BeginTransaction();

                    await control.MergeNicoFavorite(mylistid, DateTime.Now);

                    await control.Commit();
                }
            }
        }
Пример #22
0
        public async Task RefreshFavoritesAsync()
        {
            IsBusy = true;

            Favorites.Clear();

            //var favorites = await App.Database.GetItemsAsync();
            var favorites = await FavoritesManager.DefaultManager.GetFavoritesAsync();

            foreach (var favorite in favorites)
            {
                Favorites.Add(favorite.AsFavorite("Technology"));
            }

            IsBusy = false;
        }
Пример #23
0
        public async Task AddFavorite(TFavorite favorite)
        {
            if (!Favorites.Any(f => f.Mylist == favorite.Mylist))
            {
                using (var accessor = DbAccessor.GetAccessor())
                    using (var control = accessor.GetCommand())
                    {
                        Favorites.Add(favorite);
                        await control.BeginTransaction();

                        await control.InsertOrReplaceFavorite(favorite);

                        await control.Commit();
                    }
            }
        }
Пример #24
0
        private void AddToFavoritesExecute()
        {
            if (CurrentAddress == null)
            {
                return;
            }

            int postalCode = 0;

            if (int.TryParse(CurrentAddress.PostalCode, out postalCode))
            {
                GeoLocationCity city = null;

                try
                {
                    switch (CurrentAddress.CountryRegion)
                    {
                    case Greenland.Name:
                        city = Greenland.PostalCodes[postalCode];
                        break;

                    case FaroeIslands.Name:
                        city = FaroeIslands.PostalCodes[postalCode];
                        break;

                    case Denmark.Name:
                        city = Denmark.PostalCodes[postalCode];
                        break;

                    default:
                        city = Denmark.PostalCodes[Denmark.DefaultPostalCode];
                        break;
                    }
                }
                catch (Exception)
                {
                    city = Denmark.PostalCodes[Denmark.DefaultPostalCode];
                }

                if (city != null && Favorites.Any(c => c.Name == city.Name) == false)
                {
                    Favorites.Add(city);
                    SaveFavorites();
                }
            }
        }
Пример #25
0
        public void SetContent()
        {
            var favoriteList = CommonComponent.Current.UB.Favorites
                               .OrderBy(fav => fav.Position ?? -1)
                               .Select(x => new RouteStopModel {
                Route = x.Route, Stop = x.Stop
            })
                               .ToList();

            foreach (var item in favoriteList)
            {
                item.UpdateNextTrips();
            }
            Favorites.Clear();
            foreach (var fav in favoriteList)
            {
                Favorites.Add(fav);
            }
            base.OnPropertyChanged("FavoritesEmpty");
            base.OnPropertyChanged("FavoritesAny");

            rowCount = (int)Services.Resources.ValueOf("HistoryRowCount");

            var history = CommonComponent.Current.UB.History.TimetableEntries;

            History = history
                      .GroupBy(p => p.Route.RouteGroup)
                      .Select(x => new { RouteGroup = x.Key, Rating1 = x.Min(y => HistoryHelpers.DayPartDistance(y)), Rating2 = x.Sum(y => y.RawCount) })
                      .OrderByDescending(t => t.Rating2).OrderBy(t => t.Rating1)
                      .Select(t0 => t0.RouteGroup)
                      .Take(rowCount * 4)
                      .ToList();
            base.OnPropertyChanged("HistoryAny");

            var recent = CommonComponent.Current.UB.History.GetRecents();

            Recent = recent
                     .Select(x => x.Route.RouteGroup)
                     .Distinct()
                     .Take(rowCount)
                     .ToList();
            base.OnPropertyChanged("RecentAny");
            base.OnPropertyChanged("RecentHistory");
            //base.OnPropertyChanged("RecentEmpty");
        }
Пример #26
0
        public async Task AddToFavorites(RandomUser user)
        {
            var result = await this.SqliteDb.AddOrUpdate <RandomUser>(user);

            result.Error?.LogException();
            if (!result.Success)
            {
                DialogPrompt.ShowMessage(new Prompt()
                {
                    Title   = "Error",
                    Message = result.Error.Message
                });
            }
            else
            {
                Favorites.Add(user);
            }
        }
Пример #27
0
        void appDataModel_Favorites_Changed(object sender, EventArgs.FavoritesChangedEventArgs e)
        {
            Debug.Assert(e.error == null);

            if (e.error == null)
            {
                if (LocationTracker.LocationKnown == true)
                {
                    e.newFavorites.Sort(new FavoriteDistanceComparer(locationTracker.CurrentLocation));
                }

                UIAction(() => Favorites.Clear());
                e.newFavorites.ForEach(favorite => UIAction(() => Favorites.Add(favorite)));
            }
            else
            {
                ErrorOccured(this, e.error);
            }
        }
Пример #28
0
        public void LoadFavorites()
        {
            Favorites.Clear();
            List <FavoriteRouteAndStop> favorites = appDataModel.GetFavorites(FavoriteType.Favorite);

            // TODO: Add a way for calls to wait ~5 seconds for location to become available
            // but fallback to running without location if it times out
            if (LocationTracker.LocationKnown == true)
            {
                favorites.Sort(new FavoriteDistanceComparer(locationTracker.CurrentLocation));
            }
            favorites.ForEach(favorite => Favorites.Add(favorite));

            Recents.Clear();
            List <FavoriteRouteAndStop> recents = appDataModel.GetFavorites(FavoriteType.Recent);

            recents.Sort(new RecentLastAccessComparer());
            recents.ForEach(recent => Recents.Add(recent));
        }
        public async Task LoadFavorites()
        {
            try
            {
                var favorite = await App.Database.GetFavorites();

                if (favorite.Count > 0 && favorite.Any())
                {
                    foreach (var item in favorite)
                    {
                        if (item != null)
                        {
                            var thum = new Thumbnail
                            {
                                ImagePath = item.ImagePath,
                            };

                            var favorites = new Result
                            {
                                Name      = item.Name,
                                Thumbnail = thum,
                            };
                            Favorites.Add(favorites);
                        }
                    }
                }
                else
                {
                    Message = "VOCÊ AINDA NÃO ADICIONOU FAVORITOS";
                }
            }
            catch (Exception exception)
            {
                Favorites = new ObservableRangeCollection <Result>();
                Favorites.AddRange(Favorites);
                var properties = new Dictionary <string, string> {
                    { "FavoriteViewModel.cs", "LoadFavorites" }
                };
                // Crashes.TrackError(exception, properties);
            }
        }
Пример #30
0
        public void SetFavorite(int option)
        {
            lock (ThreadLock)
            {
                if (Options.Count > option || option < 0)
                {
                    return;
                }

                if (Favorites.Contains(option))
                {
                    Favorites.Remove(option);
                }
                else
                {
                    Favorites.Add(option);
                }
            }

            EventStream();
        }