예제 #1
0
        internal void Create(BaseDTO dto)
        {
            Task <BaseDTO> t = _client.CreateObjectAsync(dto);

            t.ContinueWith(td =>
            {
                BaseDTO dtoFromServer = td.Result as BaseDTO;
                if (IfErrorShowMessage(dtoFromServer))
                {
                    return;
                }
                if (_dataSources.ContainsKey(dto.GetType()))
                {
                    ICachedData items = _dataSources[dto.GetType()];
                    items.Add(dto);
                }
                else
                {
                    ICachedData cache = new CacheCollection <BaseDTO>();
                    cache.Add(td.Result);
                    _dataSources.Add(dto.GetType(), cache);
                }
            });
        }