private async void VoteClicked(int vote)//(object sender, EventArgs e) { //int ret = await UserActions.Favourite(Post.Id, state); bool ret = await UserActions.VoteAsync(Post.Id, vote); if (ret) { switch (vote) { case -1: UIVoteUp.Source = "voteupgrey.png"; UIVoteDown.Source = "votedown.png"; break; case 0: UIVoteUp.Source = "voteupgrey.png"; UIVoteDown.Source = "votedowngrey.png"; break; case 1: UIVoteUp.Source = "voteup.png"; UIVoteDown.Source = "votedowngrey.png"; break; } } else { UpdateNotification("Unable to process request.", Color.IndianRed, 1); } }
public SettingsPage() { InitializeComponent(); //Display Settings UIEntryTitle.Text = Settings.HostTitle; UIEntryURL.Text = Settings.HostValue; UIEntryUserame.Text = Settings.Username; // UIButtonUpdateHost.Clicked += UpdateSettings; UIButtonLogin.Clicked += LoginAsync; UICheckVersion.Clicked += CheckForUpdates; if (UserActions.Isloggedin()) { UILabelLoggedIn.Text = $"Welcome back, {Settings.Username}"; UILabelLoggedIn.BackgroundColor = Color.LightGreen; } else { UILabelLoggedIn.Text = $"Not logged in"; UILabelLoggedIn.BackgroundColor = Color.IndianRed; } //Adverts GroundZer0s.Clicked += async(s, e) => { await Launcher.OpenAsync(new Uri("https://groundzer0s-art.tumblr.com/")); }; }
private async void LoginAsync(object sender, EventArgs e) { bool status = await UserActions.Login(UIEntryUserame.Text, UIEntryPassword.Text); if (status) { UIGetWelcomeText(); } }
public void UIGetWelcomeText() { if (UserActions.Isloggedin()) { UILabelLoggedIn.Text = $"Welcome back, {Settings.Username}"; UILabelLoggedIn.BackgroundColor = Color.LightGreen; } else { UILabelLoggedIn.Text = $"Not logged in"; UILabelLoggedIn.BackgroundColor = Color.IndianRed; } }
private async void HeartClicked() //(object sender, EventArgs e) { //note: upvoting is different than favorating _liked = !_liked; int ret = await UserActions.Favourite(Post.Id, _liked); if (_liked & (ret == 1)) {//if the action was a success and the current state is "like" UIFavoriteClicked.Source = "star.png"; } else if (_liked & (ret == 0)) {//if the action was a success and the current state is "dislike" UIFavoriteClicked.Source = "stargrey.png"; } else { UpdateNotification("Unable to process request.", Color.IndianRed, 1); } }
public MainPage() { InitializeComponent(); TitleText.Text = Settings.HostTitle; UIForumBrowse.Clicked += SearchClicked; SearchBox.Completed += SearchClicked; SettingsButton.Clicked += SettingsClicked; UIForumButton.Clicked += ViewForms; if (UserActions.Isloggedin()) { UILoggedInStatus.Text = $"Welcome back, {Settings.Username}"; UISettingsBar.BackgroundColor = Color.LightGreen; } else { UILoggedInStatus.Text = "log in here -> "; UISettingsBar.BackgroundColor = Color.IndianRed; } Connection.Connect(Settings.HostValue); }