private async static Task InsertTestData(IServiceProvider scropeServiceProvider) { List <FlowerTag> flowerTags = GetFlowerTag(FlowerDict, TagDict); //插入的顺序要注意,主键表一定要在外键表之前插入数据库,比如Assortment表一定要在Tag表之前插入数据库 List <Stock> stocks = GetStocks(FlowerDict); await AddOrUpdateAsync(scropeServiceProvider, AssortmentDict.Select(a => a.Value)); await AddOrUpdateAsync(scropeServiceProvider, FlowerDict.Select(f => f.Value)); await AddOrUpdateAsync(scropeServiceProvider, TagDict.Select(t => t.Value)); await AddOrUpdateAsync(scropeServiceProvider, flowerTags); await AddOrUpdateAsync(scropeServiceProvider, stocks); }
private void DeleteTagFromDocOption_Click(object sender, EventArgs e) { string tag = ((sender as ToolStripMenuItem)?.Owner as ContextMenuStrip)?.SourceControl?.Text; if (tag == null) { return; } Rhino.RhinoApp.RunScript(string.Format("{0} {1}", Commands.TagFilterCommand.CommandString, tag), false); if (_selectedObjects.Count > 0) { Rhino.RhinoApp.RunScript(string.Format("{0} {1}", Commands.DeleteTagsCommand.CommandString, tag), true); } TagDict.Remove(tag); ResetUI(); }
private void UpdateUI() { foreach (var control in this.pnlTagContainer.Controls) { if (!(control is Button)) { continue; } var btn = (Button)control; TagButton tagBtn; if (!TagDict.TryGetValue(btn.Text, out tagBtn)) { continue; } UpdateUIButton(ref btn, tagBtn); } UpdateCurrentFilterText(); //UpdateSavedFilters(); }