private void listView1_SelectedIndexChanged(object sender, EventArgs e) { _activeTbLogs = null; _activeTb = null; updateTrackableInfo(); if (listView1.SelectedItems.Count > 0) { _activeTb = listView1.SelectedItems[0].Tag as Utils.API.LiveV6.Trackable; } button3.Enabled = _activeTb != null; }
private void button1_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { using (Utils.API.GeocachingLiveV6 api = new Utils.API.GeocachingLiveV6(_core, _useTestSite)) { Utils.API.LiveV6.GetTrackableResponse resp; if (textBox1.Text.ToUpper().StartsWith("TB")) { resp = api.Client.GetTrackablesByTBCode(api.Token, textBox1.Text.ToUpper(), 0); } else { resp = api.Client.GetTrackablesByTrackingNumber(api.Token, textBox1.Text.ToUpper(), 0); } if (resp.Status.StatusCode == 0) { if (resp.Trackables.Count() > 0) { Utils.API.LiveV6.Trackable tb = resp.Trackables[0]; if (!tb.Archived && tb.CurrentOwner.UserName == _core.GeocachingComAccount.AccountName) { if (!imageList1.Images.ContainsKey(tb.IconUrl)) { Image img = LoadImage(tb.IconUrl); if (img != null) { imageList1.Images.Add(tb.IconUrl, img); } } ListViewItem lv = new ListViewItem(new string[] { "", tb.Code, tb.Name ?? "" }, tb.IconUrl); lv.Tag = tb; listView1.Items.Add(lv); } } } else { System.Windows.Forms.MessageBox.Show(resp.Status.StatusMessage, Utils.LanguageSupport.Instance.GetTranslation(Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR)), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } } catch { } this.Cursor = Cursors.Default; }
private void listView1_SelectedIndexChanged(object sender, EventArgs e) { _activeTbLogs = null; _activeTb = null; updateTrackableInfo(); if (listView1.SelectedItems.Count > 0) { _activeTb = listView1.SelectedItems[0].Tag as Utils.API.LiveV6.Trackable; } button3.Enabled = _activeTb!=null; }