From 49119fc6dcf7d23fa3a2d1198891853c14aa9994 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sat, 5 Sep 2020 17:42:51 +1000 Subject: [PATCH] implemented clear all button --- MainWindow.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/MainWindow.cs b/MainWindow.cs index 57c0396..653f710 100755 --- a/MainWindow.cs +++ b/MainWindow.cs @@ -418,13 +418,14 @@ namespace Buypeeb { aid.Dispose(); // vry simpl url validation for simpol creachers + // TODO: better. do better. Regex rx = new Regex(@"^http.+yahoo.+"); if (rx.IsMatch(url)) { this.UpdateItem(this.settings.Watch(url, name).id); this.RenderList(); } else { - var md = this.MsgBox($"\"{url}\" is not a valid Buyee or Yahoo! Auctions Japan URL."); + var md = this.MsgBox($"\"{url}\" is not a valid Buyee or Yahoo! Auctions Japan URL.", ButtonsType.Ok); md.Run(); md.Dispose(); } @@ -457,7 +458,12 @@ namespace Buypeeb { } private void ButtonClearAllClicked(object sender, EventArgs a) { - Console.WriteLine("ButtonClearAllClicked"); + var md = this.MsgBox("Are you sure you want to clear ALL items?"); + if (md.Run() == (int)ResponseType.Ok) { + this.settings.watchlist.Clear(); + this.RenderList(); + } + md.Dispose(); } private void ButtonOpenClicked(object sender, EventArgs a) {