private void WordsControl_Load(object sender, EventArgs e) { var wordsStorage = WordStorage.getInstance(); loadWords(wordsStorage.getWords()); wordsStorage.wordsUpdated += (words) => { runOnGui(() => { loadWords(words); }); }; wordsStorage.wordUpdated += (word) => { runOnGui(() => { EditWordRowControl item = wordControls.Find(control => control.Id == word.Id); if (item != null) { item.Names = word.Names; item.Code = word.Code; } else { var newItem = createWordControl(word); FLPlist.ScrollControlIntoView(newItem); } }); }; wordsStorage.wordDeleted += removeWord; }
private static void Main() { // One-time initialization per application DotsRuntime.Initialize(); // Setup the global static string interning storage TempMemoryScope.EnterScope(); WordStorage.Initialize(); TempMemoryScope.ExitScope(); // A UnityInstance can exist per game state (there may potentially be more than one) var unity = UnityInstance.Initialize(); unity.OnTick = (double timestampInSeconds) => { var shouldContinue = unity.Update(timestampInSeconds); if (shouldContinue == false) { unity.Deinitialize(); } return(shouldContinue); }; // Anything which can come after EnterMainLoop must occur in an event because // on some platforms EnterMainLoop exits immediately and the application enters // an event-driven lifecycle. PlatformEvents.OnQuit += (object sender, QuitEvent evt) => { Shutdown(); }; PlatformEvents.OnSuspendResume += (object sender, SuspendResumeEvent evt) => { unity.Suspended = evt.Suspend; }; // Run RunLoop.EnterMainLoop(unity.OnTick); // DON'T CALL ANY CLEANUP HERE! }
public void GetWords_ShouldReturnEmptyListOnLetter() { var provider = this.CreateProviderMock(); var storage = new WordStorage(provider); var stored = storage.GetWords('b'); stored.Should().BeEmpty(); }
private static void Shutdown() { // Cleanup of word storage TempMemoryScope.EnterScope(); WordStorage.Shutdown(); TempMemoryScope.ExitScope(); DotsRuntime.Shutdown(); }
void createWordCache() { searchOptimizedWords = WordStorage.getInstance().getWords().Select((word) => new SearchOptimizedWord() { Word = word, Names = word.Names.Split().Select(name => name.Trim()).ToArray() }).ToList(); search(); }
public virtual void Setup() { backupCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = testCulture; //disable obsolete word/numberedwords collections #pragma warning disable 0618 WordStorage.Setup(); #pragma warning restore 0618 }
private void BaddWord_Click(object sender, EventArgs e) { WordStorage.getInstance().AddWord(new Word() { Id = WordStorage.getInstance().getNextId(), Code = "3F", Names = "", }); }
public void GetWords_ShouldReturnEmptyListEmptyWords() { var words = new HashSet <string>(); var provider = this.CreateProviderMock(('b', words)); var storage = new WordStorage(provider); var stored = storage.GetWords('b'); stored.Should().BeEmpty(); }
private void TBname_TextChanged(object sender, EventArgs e) { var word = WordStorage.getInstance().getWordById(Id); if (word.Names != TBname.Text) { word.Names = TBname.Text; WordStorage.getInstance().UpdateWord(word); } }
public void InstantiateKeepsName() { WordStorage.Setup(); var entity = m_Manager.CreateEntity(); m_Manager.SetName(entity, "Blah"); var instance = m_Manager.Instantiate(entity); Assert.AreEqual("Blah", m_Manager.GetName(instance)); }
public void GetWords_ShouldSearchByLower() { var words = new HashSet <string> { "beacon", "borsch" }; var provider = this.CreateProviderMock(('b', words)); var storage = new WordStorage(provider); var stored = storage.GetWords('B'); stored.Should().HaveCount(words.Count); }
private void TBcode_TextChanged(object sender, EventArgs e) { updateLetter(); var word = WordStorage.getInstance().getWordById(Id); if (word.Code != TBcode.Text) { word.Code = TBcode.Text; WordStorage.getInstance().UpdateWord(word); } }
public SearchControl() { InitializeComponent(); createWordCache(); var wordStorage = WordStorage.getInstance(); wordStorage.wordDeleted += (_) => { createWordCache(); }; wordStorage.wordsUpdated += (_) => { createWordCache(); }; wordStorage.wordUpdated += (_) => { createWordCache(); }; setupList(); }
private void Pdelete_Click(object sender, EventArgs e) { if (SettingsStorage.getInstance().getSettings().ConfirmDelete) { var confirmResult = MessageBox.Show("Are you sure to delete this item ??", "Confirm Delete!!", MessageBoxButtons.YesNo); ParentForm.Show(); if (confirmResult == DialogResult.Yes) { WordStorage.getInstance().removeWord(Id); } } else { WordStorage.getInstance().removeWord(Id); } }
public void NameEntities() { WordStorage.Setup(); var archetype = m_Manager.CreateArchetype(typeof(EcsTestData)); var count = 1024; var array = new NativeArray <Entity>(count, Allocator.Temp); m_Manager.CreateEntity(archetype, array); for (int i = 0; i < count; i++) { m_Manager.SetName(array[i], "Name" + i); } for (int i = 0; i < count; ++i) { Assert.AreEqual(m_Manager.GetName(array[i]), "Name" + i); } // even though we've made 1024 entities, the string table should contain only two entries: // "", and "Name" Assert.IsTrue(WordStorage.Instance.Entries == 2); array.Dispose(); }
public static int Main(string[] args) { // Not using UnityInstance.Initialize here because it also creates a world, and some tests exist // that expect to handle their own world life cycle which currently conflicts with our world design UnityInstance.BurstInit(); DotsRuntime.Initialize(); TempMemoryScope.EnterScope(); // Static storage used for the whole lifetime of the process. Create it once here // so heap tracking tests won't fight over the storage causing alloc/free mismatches WordStorage.Initialize(); // TypeManager initialization uses temp memory, so let's free it before creating a global scope Unity.Entities.TypeManager.Initialize(); TempMemoryScope.ExitScope(); // Should have stack trace with tests NativeLeakDetection.Mode = NativeLeakDetectionMode.EnabledWithStackTrace; int result = 0; #if UNITY_PORTABLE_TEST_RUNNER double start = Time.timeAsDouble; UnitTestRunner.Run(); double end = Time.timeAsDouble; PrintResults(end - start); #else result = new AutoRun().Execute(args); #endif TempMemoryScope.EnterScope(); Unity.Entities.TypeManager.Shutdown(); WordStorage.Shutdown(); TempMemoryScope.ExitScope(); DotsRuntime.Shutdown(); return(result); }
public WordStorageDebugView(WordStorage wordStorage) { m_wordStorage = wordStorage; }
public virtual void Setup() { backupCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = testCulture; WordStorage.Setup(); }
public virtual void Setup() { WordStorage.Setup(); }