public PeopleViewModel() { People = new RangeEnabledObservableCollection <ParentedEntryItem>(); _dataProvider = SimpleIoc.Default.GetInstance <IDataProvider>(); _subscriptions = new CompositeDisposable(); Task.Run(async() => { var peopleData = await _dataProvider.GetPeople(); var people = peopleData .People .Select(p => p.ToEntry()) .Select(e => this.CreateParented(e)) .OrderBy(p => p.Item.FirstName); People.InsertRange(people); }) .ContinueWith((task) => { SubscribeToCollectionChanged() .DisposeWith(_subscriptions); }); }
public PersonDirectoryViewModel(IPersonService personService, IDispatcher dispatcher, IEventAggregator aggregator, IDialogService dialogService) : base(personService, dispatcher, aggregator, dialogService) { personDirectory = new RangeEnabledObservableCollection<Person>(); aggregator.GetEvent<PersonDirectoryUpdatedEvent>().Subscribe(OnPersonDirectoryUpdated, ThreadOption.BackgroundThread); aggregator.GetEvent<PersonDeletedEvent>().Subscribe(OnPersonDeleted, ThreadOption.UIThread); }
public MainWindowModel(IJournalRepository journalRepository, CollectionsRepository collectionsRepository, MenuModel menu) { try { _menu = menu; _journalRepository = journalRepository; _collectionsRepository = collectionsRepository; UncheckedRecord = new UncheckedRecord(_collectionsRepository.LoadSheldue().ToList()); _saveCommand = new SaveCommand(UncheckedRecord, _journalRepository, this); _deleteCommand = new DeleteCommand(_journalRepository, this); _editCommand = new EditCommand(UncheckedRecord); JournalRecords = new RangeEnabledObservableCollection <JournalRecordViewModel>(); _refreshCommand = new RefreshCommand(this); _addCommand = new AddCommand(UncheckedRecord); _cancellCommand = new CancellCommand(UncheckedRecord); RefreshJournalRecords(); Shift = new DateShiftVM(_collectionsRepository.LoadSheldue().ToList()); Shift.PropertyChanged += CurrentShiftChanged; RefreshTotals(); LoadCollections(); } catch (Exception e) { MessageBox.Show(e.Message); } }
public PersonDirectoryViewModel(IPersonService personService, IDispatcher dispatcher, IEventAggregator aggregator, IDialogService dialogService) : base(personService, dispatcher, aggregator, dialogService) { personDirectory = new RangeEnabledObservableCollection <Person>(); aggregator.GetEvent <PersonDirectoryUpdatedEvent>().Subscribe(OnPersonDirectoryUpdated, ThreadOption.BackgroundThread); aggregator.GetEvent <PersonDeletedEvent>().Subscribe(OnPersonDeleted, ThreadOption.UIThread); }
public RequestIdentityProofViewModel( IUserDialogs userDialogs, INavigationService navigationService, IAgentProvider agentContextProvider, IMessageService messageService, IConnectionService defaultConnectionService, ISchemaService schemaService, ICredentialService credentialService, ILedgerService ledgerService, IProofService proofService ) : base( "Request Identity Proof", userDialogs, navigationService) { _agentContextProvider = agentContextProvider; _connectionService = defaultConnectionService; _proofService = proofService; _messageService = messageService; _schemaService = schemaService; _credentialService = credentialService; _ledgerService = ledgerService; Schemas = new RangeEnabledObservableCollection <SchemaRecord>(); CredDefinitions = new RangeEnabledObservableCollection <DefinitionRecord>(); }
public SSICredentialViewModel(CredentialRecord credential) { _credential = credential; Attributes = new RangeEnabledObservableCollection <SSICredentialAttribute>(); foreach (var cred in _credential.CredentialAttributesValues) { Console.WriteLine("credential-name: " + cred.Name); Attributes.Add(new SSICredentialAttribute() { Name = cred.Name, Value = cred.Value, }); } }
public SSICredentialViewModel( INavigationService navigationService, CredentialRecord credential ) : base( nameof(SSICredentialViewModel), navigationService ) { _credential = credential; Console.WriteLine("credential-id:" + credential.Id); Preferences.Set("credential-id", credential.Id); Attributes = new RangeEnabledObservableCollection <SSICredentialAttribute>(); foreach (var cred in _credential.CredentialAttributesValues) { Attributes.Add(new SSICredentialAttribute() { Name = cred.Name, Value = cred.Value, }); } }
private async Task CreateRequestedCredential() { var requestedCredentials = new RequestedCredentials(); var context = await _agentProvider.GetContextAsync(); _proofRequestAndCredentialMaps.Clear(); RangeEnabledObservableCollection <ProofRequestAndCredentialMap> proofRequestMapList = new RangeEnabledObservableCollection <ProofRequestAndCredentialMap>(); foreach (var requestedAttribute in ProofRequestObject.RequestedAttributes) { ProofRequestAndCredentialMap proofCredMap = new ProofRequestAndCredentialMap(); proofCredMap.ProofKey = requestedAttribute.Key; var credentials = await _proofService.ListCredentialsForProofRequestAsync(context, _proofRequest, requestedAttribute.Key); if (credentials.Count != 0) { var firstSuitableCredential = credentials.First(); _isSatisfied = true; proofCredMap.Referent = firstSuitableCredential.CredentialInfo.Referent; var key = this.RemoveAllSpaceAndToLower(requestedAttribute.Value.Name); var proofKeyAndCredentialMap = firstSuitableCredential.CredentialInfo.Attributes.ToDictionary(k => RemoveAllSpaceAndToLower(k.Key), v => new KeyValuePair <string, string>(v.Key, v.Value)); if (proofKeyAndCredentialMap.ContainsKey(key)) { var value = proofKeyAndCredentialMap[key].Value; var credKey = proofKeyAndCredentialMap[key].Key; KeyValuePair <string, string> keyValuePair = new KeyValuePair <string, string>(credKey, value); proofCredMap.CredentialAttribute = keyValuePair; } requestedCredentials.RequestedAttributes.Add(requestedAttribute.Key, new RequestedAttribute { CredentialId = firstSuitableCredential.CredentialInfo.Referent, Revealed = true }); } else { _isSatisfied = false; proofCredMap.Referent = "Unavailable"; var key = requestedAttribute.Value.Name; var value = "Unavailable"; KeyValuePair <string, string> keyValuePair = new KeyValuePair <string, string>(key, value); proofCredMap.CredentialAttribute = keyValuePair; requestedCredentials.RequestedAttributes.Add(requestedAttribute.Key, new RequestedAttribute { CredentialId = "Unavailable", Revealed = true }); } proofRequestMapList.Add(proofCredMap); //requestedCredentials.RequestedAttributes. //proofAndCredentialAttributesMapping.Add(requestedAttribute, credentials.First().CredentialInfo.Attributes.) } foreach (var requestedAttribute in ProofRequestObject.RequestedPredicates) { var credentials = await _proofService.ListCredentialsForProofRequestAsync(context, ProofRequestObject, requestedAttribute.Key); ProofRequestAndCredentialMap proofCredMap = new ProofRequestAndCredentialMap(); if (credentials.Count != 0) { var firstSuitableCredential = credentials.First(); _isSatisfied = true; proofCredMap.Referent = firstSuitableCredential.CredentialInfo.Referent; var key = this.RemoveAllSpaceAndToLower(requestedAttribute.Value.Name); var proofKeyAndCredentialMap = firstSuitableCredential.CredentialInfo.Attributes.ToDictionary(k => RemoveAllSpaceAndToLower(k.Key), v => new KeyValuePair <string, string>(v.Key, v.Value)); if (proofKeyAndCredentialMap.ContainsKey(key)) { var value = proofKeyAndCredentialMap[key].Value; var credKey = proofKeyAndCredentialMap[key].Key; KeyValuePair <string, string> keyValuePair = new KeyValuePair <string, string>(credKey, value); proofCredMap.CredentialAttribute = keyValuePair; } requestedCredentials.RequestedPredicates.Add(requestedAttribute.Key, new RequestedAttribute { CredentialId = firstSuitableCredential.CredentialInfo.Referent, Revealed = true }); } else { _isSatisfied = false; proofCredMap.ProofKey = requestedAttribute.Key; proofCredMap.Referent = "Unavailable"; var key = requestedAttribute.Value.Name; var value = "Unavailable"; KeyValuePair <string, string> keyValuePair = new KeyValuePair <string, string>(key, value); proofCredMap.CredentialAttribute = keyValuePair; requestedCredentials.RequestedPredicates.Add(requestedAttribute.Key, new RequestedAttribute { CredentialId = "Unavailable", Revealed = true }); } proofRequestMapList.Add(proofCredMap); } ProofRequestAndCredentialMaps = proofRequestMapList; RequestedCredentials = requestedCredentials; }
public SSICredentialViewModel() { Attributes = new RangeEnabledObservableCollection <SSICredentialAttribute>(); }
private async Task GenerateGraphs(DateTime birthday, DateTime secondbirthday) { var firstTotalDays = SelectedDate - birthday; var secondTotalDays = SelectedDate - secondbirthday; if (IsMain) { InitMainBounds(); var graphs = InnerGenerateGraphs(birthday); var statesRange = new ConcurrentDictionary <DateTime, GraphState>(); Parallel.For(-Scale / 2, Scale / 2, (i) => { var firstStates = graphs.GetGraphStates(firstTotalDays.Days, i, SelectedDate); var date = SelectedDate.AddDays(i); if (secondbirthday != DateTime.MinValue && secondbirthday != DateTime.Today) { var secondStates = graphs.GetGraphStates(secondTotalDays.Days, i, SelectedDate); statesRange[date] = new GraphState(date, firstStates, secondStates); } else { statesRange[date] = new GraphState(date, firstStates); } }); var statesList = statesRange .OrderBy(x => x.Key) .Select(x => x.Value); var t = DispatcherHelper.RunAsync(() => { GraphStates = new RangeEnabledObservableCollection <GraphState>(); GraphStates.InsertRange(statesList); }); if (birthday != DateTime.Today) { Graph24 = new RangeEnabledObservableCollection <Point>(graphs.ElementAt(0).Points); Graph28 = new RangeEnabledObservableCollection <Point>(graphs.ElementAt(1).Points); Graph33 = new RangeEnabledObservableCollection <Point>(graphs.ElementAt(2).Points); Graph40 = new RangeEnabledObservableCollection <Point>(graphs.ElementAt(3).Points); } if (secondbirthday != DateTime.Today && secondbirthday != DateTime.MinValue) { graphs = InnerGenerateGraphs(secondbirthday); Graph24_2 = new RangeEnabledObservableCollection <Point>(graphs.ElementAt(0).Points); Graph28_2 = new RangeEnabledObservableCollection <Point>(graphs.ElementAt(1).Points); Graph33_2 = new RangeEnabledObservableCollection <Point>(graphs.ElementAt(2).Points); Graph40_2 = new RangeEnabledObservableCollection <Point>(graphs.ElementAt(3).Points); } else { Graph24_2 = null; Graph28_2 = null; Graph33_2 = null; Graph40_2 = null; } await t; } else { InitAuxBounds(); var g56 = new Graph56(); g56.GenerateGraph(firstTotalDays.Days, _auxScale, SelectedDate); var g92 = new Graph92(); g92.GenerateGraph(firstTotalDays.Days, _auxScale, SelectedDate); var g276 = new Graph276(); g276.GenerateGraph(firstTotalDays.Days, _auxScale, SelectedDate); Graph56 = new RangeEnabledObservableCollection <Point>(g56.Points); Graph92 = new RangeEnabledObservableCollection <Point>(g92.Points); Graph276 = new RangeEnabledObservableCollection <Point>(g276.Points); } GenerateTodayLine(); ScrollIntoViewTrigger = Guid.NewGuid(); }
private void GenerateTodayLine() { TodayLine = new RangeEnabledObservableCollection <Point>(); TodayLine.Add(new Point(0, GraphYMin, SelectedDate)); TodayLine.Add(new Point(0, GraphYMax, SelectedDate)); }