Beispiel #1
0
        /* Delete the Selected Task from the List for the Logged in User.  Confirm on 2-second Hold. */

        private async void TryDelete(SlideItem.SlideItem item)
        {
            var frm = new frmDelete(2, "your task");

            Hide();

            if (frm.ShowDialog(this) == DialogResult.Yes)
            {
                Show();

                using (var client = new HttpClient())
                {
                    try
                    {
                        HttpResponseMessage response = await client.GetAsync(
                            BaseApiUrl + $"task/delete/{ LoginToken }/{ item.Tag }");

                        if (response.IsSuccessStatusCode)
                        {
                            var reply = XDocument.Parse(await response.Content.ReadAsStringAsync());

                            if (reply.Descendants("success").Any())
                            {
                                flowLayoutPanel.Controls.Remove(item);
                            }
                        }
                    } catch { }
                }
            }
            else
            {
                Show();
            }
        }
Beispiel #2
0
        /* Confirm the User's Intention to Delete the User/Account */
        private void CanDelete()
        {
            Invoke(new Action(() =>
            {
                var frm = new frmDelete(10, "your account and all lists and tasks in it");

                Hide();

                if (frm.ShowDialog(this) == DialogResult.Yes)
                {
                    Show();

                    UserAccount.Trigger(Trigger.deleteConfirmed);
                }
                else
                {
                    Show();

                    UserAccount.Trigger(Trigger.deleteDenied);
                }
            }));
        }