private void AddCheckBox() { _bLoaded = true; foreach (string item in MetaDataServices.Get(_objEntity.ObjectType)) { if (string.IsNullOrWhiteSpace(item) == false) { CheckBox objCheckBox = new CheckBox(); objCheckBox.Margin = new Thickness(5, 0, 0, 0); objCheckBox.Content = item; objCheckBox.IsChecked = false; if (_objEntity != null) { if (_objEntity.MetaDatas != null) { foreach (MetaData itemData in _objEntity.MetaDatas) { if (itemData != null) { if (itemData.Name == item) { objCheckBox.IsChecked = true; break; } } } } } RootPanel.Children.Add(objCheckBox); } } }
public ManageMetaData() { try { InitializeComponent(); DataContext = MetaDataServices.GetAll(); } catch (Exception ex) { CatchException(ex); } }
private void cmdSave_Click(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; IList <MetaData> objSource = MetaDataServices.GetAll(); IList <MetaData> objTarget = (IList <MetaData>)dtgData.DataContext; foreach (MetaData item in objSource) { if (!objTarget.Contains(item)) { MetaDataServices.Delete(item); } } foreach (MetaData item in objTarget) { if (!objSource.Contains(item) && string.IsNullOrWhiteSpace(item.Name) == false) { MetaDataServices.Add(item); } } Close(); }