public TViewModel Update(Guid Id, TViewModel data, ProcessDataDelegate <TModel> processDelegate = null) { var _store = Store; if (!ReadMode && _store != null) { TModel item = (TModel)Activator.CreateInstance(typeof(TModel), new object[] { }); item.LoadFrom(data); _store.Save(item, (x) => { x = processDelegate?.Invoke(x) ?? x; if (CheckHashChange(x)) { return(x); } return(null); }); StoreChanges(); data.LoadFrom(item); } else if (ReadMode) { throw new AccessViolationException("Repository is in Read Mode"); } return(data); }
void ICallback.AddPoints(List <Message> messages) { ProcessDataDelegate pdt = ProcessData; if (pdt != null) { foreach (Message message in messages) { pdt(message.Data1, message.Data2, message.Data3, message.Data4); } } }
public SimpleServer(HttpListener listener, string url, ProcessDataDelegate handler) { this.listener = listener; this.handler = handler; listener.Prefixes.Add(url); }