private void MakeVms() { var vocs = EntityQuery <Vocabulary> .All(Session)(); var vms = vocs.Select(v => Vocs .Where(vm => vm.voc == v) .FirstOrDefault() ?? new VocabularyViewModel(v)); Vocs.SyncWith(vms); }
private int MakeInstalledVms() { var vms = VocabularyQuery.NonCustom(Session)() .Select(voc => Vocs .Where(vm => vm.voc == voc) .FirstOrDefault() ?? new VocabularyViewModel(voc)) .ToList(); uiTaskFactory.StartNew(() => Vocs.SyncWith(vms)); return(vms.Count()); }
protected override void Dispose(bool disposing) { if (disposing) { Syncer.SyncEnded -= syncer_SyncEnded; Poster.MessagePosted -= syncer_MessagePosted; uiTaskFactory.StartNew(() => { Vocs.Clear(); AvailableVocs.Clear(); }); Remote.Dispose(); this.Send(Event.PushToSettings, new object[] { Constants.SyncServerConstrSettingName, Remote.ConnectionString }.AsParams(MessageKeys.Name, MessageKeys.Value)); this.Send(Event.PushToSettings, new object[] { Constants.SyncServerProviderSettingName, Remote.ProviderName }.AsParams(MessageKeys.Name, MessageKeys.Value)); } base.Dispose(disposing); }
private void SelectLastChanged(Vocabulary voc) { SelectedVoc = Vocs.FirstOrDefault(x => x.voc == voc); }
public SampleVocabularyListViewModel() { Vocs.Add(new VocabularyViewModel(Mocks.voc)); AvailableVocs.Add(new VocabularyViewModel(Mocks.voc2)); }