Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ws">The ws.</param>
        protected override void OnChangeNotifySharedStore(WritingSystemDefinition ws)
        {
            base.OnChangeNotifySharedStore(ws);

            if (m_globalStore != null)
            {
                WritingSystemDefinition globalWs;
                if (m_globalStore.TryGet(ws.Id, out globalWs))
                {
                    if (ws.DateModified > globalWs.DateModified)
                    {
                        WritingSystemDefinition newWs = ws.Clone();
                        newWs.Modified = true;
                        try
                        {
                            m_globalStore.Remove(ws.Id);
                            m_globalStore.Set(newWs);
                        }
                        catch (UnauthorizedAccessException)
                        {
                            // Live with it if we can't update the global store. In a CS world we might
                            // well not have permission.
                        }
                    }
                }

                else
                {
                    m_globalStore.Set(ws.Clone());
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ws">The ws.</param>
        protected override void OnChangeNotifySharedStore(WritingSystemDefinition ws)
        {
            base.OnChangeNotifySharedStore(ws);

            if (m_globalStore != null)
            {
                if (m_globalStore.Contains(ws.Id))
                {
                    if (ws.DateModified > m_globalStore.Get(ws.Id).DateModified)
                    {
                        WritingSystemDefinition newWs = ws.Clone();
                        newWs.Modified = true;
                        m_globalStore.Remove(ws.Id);
                        m_globalStore.Set(newWs);
                    }
                }

                else
                {
                    m_globalStore.Set(ws.Clone());
                }
            }
        }
Exemplo n.º 3
0
        public void CanStoreVariants_CountTwo()
        {
            var ws1 = new WritingSystemDefinition();

            ws1.Language = "en";
            Assert.AreEqual("en", ws1.LanguageTag);
            WritingSystemDefinition ws2 = ws1.Clone();

            ws2.Variants.Add("1901");
            Assert.AreEqual("en-1901", ws2.LanguageTag);

            RepositoryUnderTest.Set(ws1);
            Assert.AreEqual(1, RepositoryUnderTest.Count);
            RepositoryUnderTest.Set(ws2);
            Assert.AreEqual(2, RepositoryUnderTest.Count);
        }
        public void CanStoreVariants_CountTwo()
        {
            var ws1 = new WritingSystemDefinition();
            ws1.Language = "en";
            Assert.AreEqual("en", ws1.Bcp47Tag);
            WritingSystemDefinition ws2 = ws1.Clone();
            ws2.Variant = "1901";
            Assert.AreEqual("en-1901", ws2.Bcp47Tag);

            RepositoryUnderTest.Set(ws1);
            Assert.AreEqual(1, RepositoryUnderTest.Count);
            RepositoryUnderTest.Set(ws2);
            Assert.AreEqual(2, RepositoryUnderTest.Count);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Makes a duplicate of an existing writing system definition.  Set will need
 /// to be called with this new duplicate once identifying information has been changed
 /// in order to place the new definition in the store.
 /// </summary>
 public WritingSystemDefinition MakeDuplicate(WritingSystemDefinition definition)
 {
     return(definition.Clone());
 }