/// <summary> /// DataGrid's Delete button click /// </summary> private void datagridDelete_Click(object sender, RoutedEventArgs e) { PluginModel pm = ((FrameworkElement)sender).DataContext as PluginModel; if (pm == null) { throw new ApplicationException(); } this.m_data.Remove(pm); this.dataGrid.Items.Refresh(); this.dataGrid.UpdateLayout(); PluginStorage.SaveModels(this.m_data); }
/// <summary> /// Add new model of type m_addplugin /// </summary> private void btnAdd_Click(object sender, RoutedEventArgs e) { SettingsWindow sw = new SettingsWindow(); if (sw.ShowDialog(this.m_addplugin) == true) { this.m_data.Add(new PluginModel { Plugin = sw.GetName(), Data = sw.GetData(), Type = this.m_addplugin.GetType() }); this.dataGrid.Items.Refresh(); this.dataGrid.UpdateLayout(); PluginStorage.SaveModels(this.m_data); } }