private int MakeAvailableVms() { var ids = EntityQuery <Vocabulary> .All(Session)().Select(y => y.Id).ToList(); var notInstalled = serverNonCustomVocs .Where(x => !ids.Contains(x.Id)); var vms = notInstalled.Select(voc => AvailableVocs .Where(vm => vm.voc == voc) .FirstOrDefault() ?? new VocabularyViewModel(voc)) .ToList(); uiTaskFactory.StartNew(() => AvailableVocs.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); }
public SampleVocabularyListViewModel() { Vocs.Add(new VocabularyViewModel(Mocks.voc)); AvailableVocs.Add(new VocabularyViewModel(Mocks.voc2)); }