1using CommunityToolkit.Mvvm.ComponentModel;
2using CommunityToolkit.Mvvm.Input;
9using System.Collections.ObjectModel;
21 private readonly
string? requestorFullJid;
22 private readonly
string? petitionId;
23 private readonly PhotosLoader photosLoader;
32 this.photosLoader =
new PhotosLoader(this.
Photos);
47 await base.OnInitializeAsync();
49 this.AssignProperties();
55 private async
void LoadPhotos()
63 this.FirstPhotoSource = First?.Source;
64 this.FirstPhotoRotation = First?.Rotation ?? 0;
76 this.photosLoader.CancelLoadPhotos();
78 await base.OnDisposeAsync();
84 public ObservableCollection<Photo>
Photos {
get; }
100 private async Task Accept()
102 if (!await this.authenticationService.AuthenticateUserAsync(
AuthenticationPurpose.AcceptPetitionRequest,
true))
106 this.RequestedContract!.ContractId,
this.petitionId!,
this.requestorFullJid!,
true));
116 private async Task Decline()
119 this.RequestedContract!.ContractId,
this.petitionId!,
this.requestorFullJid!,
false));
129 private async Task Ignore()
143 private DateTime? created;
149 private DateTime? updated;
155 private DateTime? expires;
161 private string? legalId;
167 private string? networkId;
179 private DateTime? from;
185 private DateTime? to;
191 [NotifyPropertyChangedFor(nameof(FullName))]
192 private string? firstName;
198 [NotifyPropertyChangedFor(nameof(FullName))]
199 private string? middleNames;
205 [NotifyPropertyChangedFor(nameof(FullName))]
206 private string? lastNames;
212 private string? personalNumber;
218 private string? address;
224 private string? address2;
230 private string? zipCode;
236 private string? area;
242 private string? city;
248 private string? region;
254 private string? countryCode;
260 private string? nationalityCode;
266 private string? gender;
272 private DateTime? birthDate;
278 private string? orgName;
284 private string? orgNumber;
290 private string? orgDepartment;
296 private string? orgRole;
302 private string? orgAddress;
308 private string? orgAddress2;
314 private string? orgZipCode;
320 private string? orgArea;
326 private string? orgCity;
332 private string? orgRegion;
338 private string? orgCountryCode;
350 private bool hasPhotos;
356 private string? phoneNr;
362 private string? eMail;
368 private string? deviceId;
374 private bool isApproved;
380 private string? purpose;
386 private ImageSource? firstPhotoSource;
392 private int? firstPhotoRotation;
396 private void AssignProperties()
426 if (!
string.IsNullOrEmpty(BirthDayStr) &&
int.TryParse(BirthDayStr, out
int BirthDay) &&
427 !
string.IsNullOrEmpty(BirthMonthStr) &&
int.TryParse(BirthMonthStr, out
int BirthMonth) &&
428 !
string.IsNullOrEmpty(BirthYearStr) &&
int.TryParse(BirthYearStr, out
int BirthYear))
432 this.BirthDate =
new DateTime(BirthYear, BirthMonth, BirthDay);
437 this.BirthDate =
null;
453 !
string.IsNullOrEmpty(this.OrgName) ||
454 !
string.IsNullOrEmpty(this.OrgNumber) ||
455 !
string.IsNullOrEmpty(this.OrgDepartment) ||
456 !
string.IsNullOrEmpty(this.OrgRole) ||
457 !
string.IsNullOrEmpty(this.OrgAddress) ||
458 !
string.IsNullOrEmpty(this.OrgAddress2) ||
459 !
string.IsNullOrEmpty(this.OrgZipCode) ||
460 !
string.IsNullOrEmpty(this.OrgArea) ||
461 !
string.IsNullOrEmpty(this.OrgCity) ||
462 !
string.IsNullOrEmpty(this.OrgRegion) ||
463 !
string.IsNullOrEmpty(this.OrgCountryCode);
464 this.HasPhotos = this.Photos.Count > 0;
468 this.IsApproved = this.RequestorIdentity.State ==
IdentityState.Approved;
472 this.Created = DateTime.MinValue;
473 this.Updated = DateTime.MinValue;
489 this.NationalityCode =
string.Empty;
490 this.Gender =
string.Empty;
491 this.BirthDate =
null;
504 this.HasPhotos =
false;
508 this.IsApproved =
false;
516 private async Task Copy(
object Item)
520 if (Item is
string Label)
522 if (Label == this.LegalId)
531 await Clipboard.SetTextAsync(Label);
const string IotId
The IoT ID URI Scheme (iotid)
XMPP Protocol Properties.
const string PersonalNumber
Personal number
const string OrgAddress2
Organization Address line 2
const string DeviceId
Device ID
const string Country
Country
const string OrgArea
Organization Area
const string Region
Region
const string OrgRegion
Organization Region
const string Nationality
Nationality
const string ZipCode
Zip Code
const string BirthYear
Birth Year
const string OrgCity
Organization City
const string OrgRole
Organization Role
const string Phone
Phone number
const string EMail
e-Mail address
const string OrgZipCode
Organization Zip Code
const string MiddleNames
Middle names
const string BirthDay
Birth Day
const string OrgCountry
Organization Country
const string OrgDepartment
Organization Department
const string Address2
Address line 2
const string OrgAddress
Organization Address line 1
const string Address
Address line 1
const string LastNames
Last names
const string OrgNumber
Organization number
const string BirthMonth
Birth Month
const string FirstName
First name
const string Gender
Gender
const string OrgName
Organization name
A set of never changing property constants and helpful values.
const string NotAvailableValue
A generic "no value available" string.
A strongly-typed resource class, for looking up localized strings, etc.
static string IdCopiedSuccessfully
Looks up a localized string similar to A link to the ID was copied to the clipboard....
static string TagValueCopiedToClipboard
Looks up a localized string similar to Tag value copied to clipboard.
static string SuccessTitle
Looks up a localized string similar to Success.
Base class that references services in the app.
static IServiceProvider Provider
The service provider for the app. This is set before the app is started, and will be used to resolve ...
static ILogService LogService
Log service.
static INetworkService NetworkService
Network service.
static IUiService UiService
Service serializing and managing UI-related tasks.
static IReportingStringLocalizer Localizer
Localization service
static IXmppService XmppService
The XMPP service for XMPP communication.
A base class for all view models, inheriting from the BindableObject. NOTE: using this class requir...
virtual async Task GoBack()
Method called when user wants to navigate to the previous screen.
Holds navigation parameters specific to views displaying a contract petition request.
Contract? RequestedContract
The identity of the requestor.
LegalIdentity? RequestorIdentity
The identity of the requestor.
string? PetitionId
The petition id.
string? Purpose
The purpose of the petition.
string? RequestorFullJid
The identity of the requestor.
The view model to bind to when displaying petitioning of a contract in a view or page.
ObservableCollection< Photo > Photos
The list of photos related to the contract being petitioned.
PetitionContractViewModel(PetitionContractNavigationArgs? Args)
Creates a new instance of the PetitionContractViewModel class.
override async Task OnDisposeAsync()
Method called when the view is disposed, and will not be used more. Use this method to unregister eve...
LegalIdentity? RequestorIdentity
Requestor Identity object
Contract? RequestedContract
The contract to display.
override async Task OnInitializeAsync()
Method called when view is initialized for the first time. Use this method to implement registration ...
Contains the definition of a contract
DateTime From
From what point in time the legal identity is valid.
DateTime Updated
When the identity object was last updated
DateTime To
To what point in time the legal identity is valid.
DateTime Created
When the identity object was created
IdentityState State
Current state of identity
string Id
ID of the legal identity
Attachment[] Attachments
Attachments assigned to the legal identity.
class Photo(byte[] Binary, int Rotation, Attachment? Attachment)
Class containing information about a photo.
AuthenticationPurpose
Purpose for requesting the user to authenticate itself.
IdentityState
Lists recognized legal identity states.
SignWith
Options on what keys to use when signing data.