public override async Task <bool> BeforeOk() { /* * This is a chance to verify the data. If user didn't enter the correct values, return false * Once this function returns true, OnOk will be called. * */ try { IsRefreshing = true; try { await WebReader.GetItemsAsync(Url); return(true); } finally { IsRefreshing = false; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(false); } }
public void GetItemsTest() { var sampleUrl = "https://raw.githubusercontent.com/manictime/samplewebtagsource/master/ManicTime.TagSource.SampleWeb/SampleTags.txt"; var tags = WebReader.GetItemsAsync(sampleUrl).Result; Assert.AreEqual(5, tags.Length); CollectionAssert.AreEqual(new [] { "client 1", "project 1", "Activity 1" }, tags[0].Tags); Assert.AreEqual("Activity 1 notes", tags[0].Notes); }
protected override void Update() { /* * * Add your implementation of what happens on update. * * This is the main function of the plugin, it is responsible to get tags from your service * * After you get your tags from the service call TagSourceCache.Update * */ TagSourceItem[] items = WebReader.GetItemsAsync(_settings.Url).Result; TagSourceCache.Update(InstanceId, items, null, true); }