private async Task ExecuteGetFavCommand() { if (IsBusy) { return; } IsBusy = true; GetFavoriteListCommand.ChangeCanExecute(); try { var favList = await FavoriteDataService.GetFavListHistory(); if (favList != null) { foreach (var item in favList) { FavList.Add(item); } } IsBusy = false; } catch (Exception ex) { } }
public static bool GenerateFavList() { if (FavList == null) { FavList = new BindingList <Server>(); FavList.RaiseListChangedEvents = true; } FavList.Clear(); try { foreach (XElement xel in _FavFile.Root.Descendants("server")) { try { FavList.Add(new Server(xel.Element("ip").Value, xel.Element("nickname").Value)); } finally { } } return(true); } finally { } }
private void OnGUI() { //if (AssetDatabase.FindAssets("List/Your_favourites.asset").Length == 0) //{ // if (GUILayout.Button("Create Favourites")) // { // currentList = ScriptableObjManager.CreateScriptable<FavList>("Resources/List/", "Your_favourites"); // currentList.favs = new List<Object>(); // } // return; //} if (!currentList) { currentList = (FavList)EditorGUILayout.ObjectField(currentList, typeof(FavList), false); } EditorGUILayout.LabelField("search"); EditorGUILayout.BeginHorizontal(); _searchQuery = EditorGUILayout.TextField(_searchQuery); if (GUILayout.Button("Search", GUILayout.Width(50), GUILayout.Height(18)) || Input.GetKeyDown(KeyCode.Return)) { showSearches = true; } EditorGUILayout.EndHorizontal(); if (showSearches) { SearchBar(); } DrawFavourites(); }
private void ShowFavoritesBtn_Click(object sender, RoutedEventArgs e) { PannelGrid.Children.Clear(); FavList favList = new FavList(); favList.VideoSelected += FavList_VideoSelected; favList.LoadAsync(); PannelGrid.Children.Add(favList); }
public void GetComicsFromDb() { using (SQLiteConnection connection = new SQLiteConnection(App.FilePath)) { connection.CreateTable <Comic>(); var list = connection.Table <Comic>().ToList(); foreach (var comic in list) { FavList.Insert(0, comic); } } }
private void OnEnable() { if (defaultList && currentList == null) { currentList = defaultList; } string[] defaultStrings = new string[] { AssetDatabase.GetAssetPath(defaultList) }; if (currentList == null && AssetDatabase.FindAssets("Your_favourites", defaultStrings).Length > 0) { currentList = (FavList)AssetDatabase.LoadAssetAtPath("Assets/Unity+/Favourites/List/Your_favourites.Asset", typeof(FavList)); } defaultColor = GUI.backgroundColor; }
public async Task <IActionResult> AddToFavorites(string MovieId, string UserId) { var response = await _client.GetAsync($"?i={MovieId}&apikey=ab73b87f"); var movie = await response.Content.ReadAsAsync <MovieRoot>(); FavList newFavMovie = new FavList(movie.Title, int.Parse(movie.Year), movie.Genre, movie.Runtime, movie.Actors, movie.Plot, UserId); var match = _context.FavList.ToList().Where(p => p.Title == newFavMovie.Title); if (match.Count() != 1) { _context.FavList.Add(newFavMovie); _context.SaveChanges(); } return(View("Index")); }
public static bool DeleteServer(Server server) { try { var serv = _FavFile.Root.Descendants("server").Where(x => x.Element("ip").Value == (server.Ip.ToString() + ":" + server.Port)).First(); if (serv != null) { serv.Remove(); FavList.Remove(FavList.Where(x => (x.Ip == server.Ip) && (x.Port == server.Port)).FirstOrDefault()); return(true); } return(false); } catch (Exception ex) { return(false); } }
private void DeleteSwipe(object obj) { Comic comic = obj as Comic; using (SQLiteConnection connection = new SQLiteConnection(App.FilePath)) { connection.Delete(comic); SQLiteCommand cmd = new SQLiteCommand(connection); cmd.CommandText = $"Select count(*) FROM Comic WHERE Num = '{comic.Num}'"; int count = Convert.ToInt32(cmd.ExecuteScalar <int>()); if (count == 0) { FavList.Remove(comic); DependencyService.Get <IToastMessage>().LongAlert("Removed from Favorites"); } else { DependencyService.Get <IToastMessage>().LongAlert("Could not remove from Favorites"); } } }
/// <summary> /// 마이리스트 조회 /// </summary> public void InitMyList() { //로그인 예외처리 //테스트 끝나면 풀것 if (null == MainViewModel.LoginUser) { return; } DataSet dsResult = new DataSet(); dsResult = callQuery.S_MA_USR_FAV_LIST(MainViewModel.LoginUser.USER_NO); //dsResult = callQuery.S_MA_USR_FAV_LIST("wildowl"); if (0 == dsResult.Tables.Count) { return; } FavList.Clear(); foreach (DataRow item in dsResult.Tables[0].Rows) { UdtMyListItem myItem = new UdtMyListItem(); myItem.ContentID = item["CONS_ID"].ToString(); myItem.ContentName = item["CONS_NM"].ToString(); System.Drawing.Image thumbImg = IMRUtils.TypeParser.ByteArrayToImage(Convert.FromBase64String(item["CONS_THUMB_PATH"].ToString())); myItem.ContentThumbnail = StaticUtils.ImageToImageSource(thumbImg); myItem.ContentType = item["CONS_TP"].ToString(); myItem.EnterDtm = item["FAV_DTM"].ToString(); myItem.Deleterable = System.Windows.Visibility.Visible; FavList.Add(myItem); } }
private void FavListShow() { int scrollPos = FavList.FirstDisplayedScrollingRowIndex; int?selectedIndex = null; for (int i = 0; i < FavList.Rows.Count; i++) { if (FavList.Rows[i].Selected) { selectedIndex = i; break; } } FavList.SuspendLayout(); List <FavoriteItem> favList = _favoritesManager.Favorites; if (_favListSortColumnIndex.HasValue) { favList.Sort(new FavoritesItemSorter(_favListSortColumnIndex.Value, _favListSortColumnAscend)); } List <DataGridViewRow> rows = new List <DataGridViewRow>(); for (int favIdx = 0; favIdx < favList.Count; favIdx++) { FavoriteItem favItem = favList[favIdx]; if (favItem.IsEmpty) { continue; } DataGridViewRow row = new DataGridViewRow(); row.CreateCells(FavList); row.Cells[FAVLIST_INDEX].Value = (favIdx + 1).ToString(); row.Cells[FAVLIST_NUMBER].Value = favItem.Number; row.Cells[FAVLIST_NAME].Value = favItem.Name; row.Cells[FAVLIST_ADDRESS].Value = favItem.Address; row.Cells[FAVLIST_PORT].Value = favItem.Port > 0 ? favItem.Port.ToString() : ""; row.Cells[FAVLIST_DIRECTDIAL].Value = favItem.DirectDial > 0 ? favItem.DirectDial.ToString() : ""; /* * var btnCell = (row.Cells[FAVLIST_DIALBTN] as DataGridViewButtonCell); * //btnCell.ToolTipText = "Add/Delete HD Timer"; * if (favItem.IsValid) * { * btnCell.Style.ForeColor = Color.Black; * } * else * { * btnCell.Style.ForeColor = Color.LightGray; * } */ rows.Add(row); } FavList.Rows.Clear(); FavList.Rows.AddRange(rows.ToArray()); if (selectedIndex.HasValue && selectedIndex < FavList.Rows.Count) { FavList.Rows[selectedIndex.Value].Selected = true; } if (scrollPos > -1 && scrollPos < FavList.Rows.Count) { FavList.FirstDisplayedScrollingRowIndex = scrollPos; } FavList.ResumeLayout(); }
private void PicklistClosed(object sender, EventArgs eventArgs) { if (pickList.IsOpen) { pickList.IsOpen = false; } ApplicationBar.IsVisible = true; PickFavoriteList list = (PickFavoriteList) sender; if (list.Result != MessageBoxResult.OK) return; // Fetch the new list name, or the selected one string name = list.SelectedList; FavList favList = DataLoader.Store != null ? DataLoader.Store.FavLists.FirstOrDefault(f => f.Name == name) : null; if (favList == null) { favList = new FavList(Enumerable.Empty<Game>()) {Name = name}; if (DataLoader.Store == null) DataLoader.Store = new Store(); if (DataLoader.Store.FavLists == null) DataLoader.Store.FavLists = new FavLists(); DataLoader.Store.FavLists.Add(favList); } favList.Add(Game); DataLoader.SaveSettings(); OnPropertyChanged(this, new PropertyChangedEventArgs("FavoriteUri")); }