private void AddToolbar(bykIFv1.PlugInInterface plugin) { ToolStripItem item = new ToolStripButton(plugin.Icon); item.ToolTipText = plugin.Name; item.Tag = plugin; item.Click += Item_Click; _locationToolbar.Items.Add(item); }
private void Item_Click(object sender, EventArgs e) { ToolStripItem item = sender as ToolStripItem; if (null == item) { return; } bykIFv1.PlugInInterface plugin = item.Tag as bykIFv1.PlugInInterface; bykIFv1.TrackItem[] results = null; try { results = plugin.GetTrackItems(this); } catch (Exception ex) { MessageBox.Show(string.Format(Properties.Resources.MSG2, plugin.Name, ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } if (null == results) { return; } bool blNewTracks = false; foreach (bykIFv1.TrackItem track in results) { if (null == track) { continue; } if (1 > track.Items.Count) { continue; } System.Diagnostics.Debug.Print(string.Format("create:{1} name:{0}", track.Name, track.CreateTime)); _trackItemBag.AddItem(track); blNewTracks = true; } if (blNewTracks) { this.UseWaitCursor = true; // 読み込んでいるイメージに対して再度位置情報のマッチングを実施する LocationMatching(); // リストを更新する UpdateLocationList(); #if true // データが変化したので保存します。 var task = Task.Factory.StartNew(() => { _trackItemBag.Save(); }).ContinueWith(_ => { this.UseWaitCursor = false; }, TaskScheduler.FromCurrentSynchronizationContext()); #else _trackItemBag.Save(); this.UseWaitCursor = false; #endif } }