public BluetoothCharacteristicViewModel(BluetoothCharacteristicModel characteristic) { AvailableMeasures = new ContosoTemplate().GetMeasures(IoTCentral.Current.Model.Id); Characteristic = characteristic; InitMeasures(); TelemetryFieldAssigned += OnTelemetryAssigned; ClearSelection = new Command(Clear); }
public CreateAppViewModel(INavigationService navigation) : base(navigation) { Tenants = new ObservableCollection <Tenant>(); Subscriptions = new ObservableCollection <Subscription>(); ResourceGroups = new ObservableCollection <ResourceGroup>(); Regions = new ObservableCollection <string>(Constants.RM_REGIONS); contosoTemplate = new ContosoTemplate(); devKitTemplate = new DevKitTemplate(); Template = contosoTemplate; SelectTemplate = new Command((templateName) => { switch (templateName) { case "DevKit": Template = devKitTemplate; break; case "Contoso": Template = contosoTemplate; break; } }); CreateApplication = new Command(async() => { // manage exception try { IsBusy = true; var app = await(await IoTCentral.Current.GetArmClient()).CreateApplication(new Application(ApplicationName, ApplicationName, ApplicationDomain, SelectedRegion, Template), SelectedSubscription.SubscriptionId, SelectedResourceGroup.Name); await DialogService.Current.ShowMessage($"Application '{app.Name}' successfully created", "Application Creation", "Dismiss", async() => { IoTCentral.Current.Application = app; IsBusy = false; await Navigation.NavigateBack(); }); } catch (Exception ex) { await DialogService.Current.ShowError(ex, "Application Creation", "Dismiss", null); } }); }