public void AddMultiMaterials(string packedMaterials) { var pairs = packedMaterials.Split(';').Where(i => !String.IsNullOrEmpty(i)); foreach (var pair in pairs) { Guid materialId = new Guid(pair.Split(':').First()); String materialName = EditorKmh.Encoding.UTF8.GetString(Convert.FromBase64String(pair.Split(':').Last())); transfer_add added = new transfer_add() { UMs = this._dicts.UMs, Ss = this._dicts.Ss, STEs = this._dicts.STEs, material_id = materialId, material = materialName }; DataGrid dataGrid = (AddTabs.SelectedItem as TabItem).Content as DataGrid; var add_materials = dataGrid.ItemsSource as ObservableCollection<transfer_add>; add_materials.Add(added); added.UpdateDicts(); } }
private void addMaterial(object sender, RoutedEventArgs e) { transfer_add new_AddMaterial = new transfer_add() { UMs = this._dicts.UMs, Ss = this._dicts.Ss, STEs = this._dicts.STEs }; DataGrid dataGrid = (AddTabs.SelectedItem as TabItem).Content as DataGrid; ObservableCollection<transfer_add> add_materials = dataGrid.ItemsSource as ObservableCollection<transfer_add>; add_materials.Add(new_AddMaterial); new_AddMaterial.UpdateDicts(); }
public transfer_add(transfer_add orig) { this.material_id = orig.material_id; this.um_id = orig.um_id; this.s_id = orig.s_id; this.ste_id = orig.ste_id; this.no = orig.no; }