Пример #1
0
        protected virtual void OnChangeNotifySharedStore(T ws)
        {
            DateTime lastDateModified;

            if (_writingSystemsToIgnore.TryGetValue(ws.LanguageTag, out lastDateModified) && ws.DateModified > lastDateModified)
            {
                _writingSystemsToIgnore.Remove(ws.LanguageTag);
            }

            if (_globalRepository != null)
            {
                T globalWs;
                if (_globalRepository.TryGet(ws.LanguageTag, out globalWs))
                {
                    if (ws.DateModified > globalWs.DateModified)
                    {
                        T newWs = WritingSystemFactory.Create(ws, cloneId: true);
                        try
                        {
                            _globalRepository.Replace(ws.LanguageTag, newWs);
                        }
                        catch (Exception)
                        {
                            // Live with it if we can't update the global store. In a CS world we might
                            // well not have permission.
                        }
                    }
                }
                else
                {
                    _globalRepository.Set(WritingSystemFactory.Create(ws, cloneId: true));
                }
            }
        }