public void ShowAddOptionDialog(object obj) { var newWindow = new AddOption(); var viewModel = new AddOptionViewModel(dataReceiver); viewModel.RequestClose += newWindow.Close; newWindow.DataContext = viewModel; newWindow.Show(); }
void AddOptionFromASM(Assembly asm) { foreach (var type in asm.DefinedTypes) { Attribute attr = type.GetCustomAttribute(typeof(AddOption)); if (attr != null) { List <Type> typeList; AddOption option = (AddOption)attr; if (!Center.OptionTypes.TryGetValue(option.Cate, out typeList)) { typeList = new List <Type>(); Center.OptionTypes.Add(option.Cate, typeList); } if (!typeList.Contains(type)) { typeList.Add(type); } } } }
private async void TSB_AddOption_Click(object sender, EventArgs e) { await AddOption?.Invoke(); }