/// <summary> /// Gets a list of recently updated corkboards. /// </summary> /// <param name="currentUser">Represents the currently logged in user.</param> /// <returns>Returns the last four recently updated corkboards, or an empty list.</returns> public static List <Models.Corkboard> GetRecentlyUpdatedCorkboards(User currentUser) { var corkboards = CorkboardHelper.GetRecentUpdatedCorkboards(currentUser); // corkboards.OrderBy(x => x.LastUpdate); // return corkboards.GetRange(0, 4); return(corkboards); }
private void GetCorkboard(string title) { Corkboard = CorkboardHelper.GetCorkboard(Owner, title); PushpinView.SelectionMode = SelectionMode.Single; PushpinView.Items.Clear(); foreach (var pin in Corkboard.Pushpins) { var item = new { Url = pin.Url, Pushpin = pin }; PushpinView.Items.Add(item); } }
private void SetSwitchButton() { if (Owner.Email.Equals(viewer.Email)) { SwitchButton.Content = "Add PushPin"; } else if (!Corkboard.IsPrivate) { var alreadyWatching = CorkboardHelper.GetCorkboardWatchers(Corkboard).Exists(x => x.Email.Equals(viewer.Email)); if (alreadyWatching) { SwitchButton.Content = "Unwatch"; } else { SwitchButton.Content = "Watch"; } } }
private void DisplayMyCorkboards() { MyCorkboardView.SelectionMode = SelectionMode.Single; var view = new GridView(); MyCorkboardView.View = view; view.Columns.Add(CreateGridColumn("Title", 309)); view.Columns.Add(CreateGridColumn("Pushpins", 209)); view.Columns.Add(CreateGridColumn("", 109, "Private")); var corkboards = CorkboardHelper.GetUserPublicCorkboards(MainWindow.User); foreach (var board in corkboards) { var isPrivate = string.Empty; if (board.IsPrivate) { isPrivate = "Private"; } MyCorkboardView.Items.Add(new { Title = board.Title, Pushpins = board.Pushpins.Count, Private = isPrivate }); } }
private void SetWatch() { var watchers = CorkboardHelper.GetCorkboardWatchers(Corkboard); if (Owner.Email.Equals(viewer.Email)) { WatcherBlock.Visibility = Visibility.Hidden; } else { if (watchers.Count == 0) { WatcherBlock.Text = "No one is watching this corkboard. Be the first!"; } else if (watchers.Count == 1) { WatcherBlock.Text = "This corkboard has 1 watcher."; } else { WatcherBlock.Text = $"This corkboard has {watchers.Count} watchers."; } } }
private bool ValidatePassword(string password) { return(CorkboardHelper.CanViewCorkboard(title, ownerEmail, password)); }