示例#1
0
        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);
        }
示例#2
0
        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());
        }
示例#3
0
        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);
        }
示例#4
0
 private void SelectLastChanged(Vocabulary voc)
 {
     SelectedVoc = Vocs.FirstOrDefault(x => x.voc == voc);
 }
示例#5
0
 public SampleVocabularyListViewModel()
 {
     Vocs.Add(new VocabularyViewModel(Mocks.voc));
     AvailableVocs.Add(new VocabularyViewModel(Mocks.voc2));
 }