void InitTokenEdit() { foreach (KeyValuePair <int, string> item in TokenRegistry.GetTokens()) { repositoryItemMyTokenEdit1.Tokens.AddToken(item.Value, new ObjectWrapper(item.Key)); } }
private void OnValidateToken(object sender, TokenEditValidateTokenEventArgs e) { int id; if (int.TryParse(e.Description, out id)) { string tok = TokenRegistry.GetToken(id); e.Description = tok; e.Value = new ObjectWrapper(id); e.IsValid = true; } }
void OnCustomUnboundColumnData(object sender, CustomColumnDataEventArgs e) { Employee emp = e.Row as Employee; if (emp == null) { return; } if (e.IsGetData) { BindingList <ObjectWrapper> col = new BindingList <ObjectWrapper>(); foreach (string tok in emp.Tokens) { int id = TokenRegistry.GetId(tok); col.Add(new ObjectWrapper(id)); } e.Value = col; } }
void UpdateTokens(TokenEdit edit, Employee emp) { if (update) { return; } this.update = true; try { emp.Tokens.Clear(); foreach (ObjectWrapper wr in (IList)edit.EditValue) { string tok = TokenRegistry.GetToken(wr.Obj); emp.Tokens.Add(tok); } gridView1.UpdateCurrentRow(); } finally { this.update = false; } }