public Disk(ILowLevelApi lowLevelApi, uint number, ByteSize size, ByteSize allocatedSize) { LowLevelApi = lowLevelApi; Number = number; Size = size; AllocatedSize = allocatedSize; }
public DeploymentViewModel(IDeviceProvider deviceProvider, IWindowsOptionsProvider optionsProvider, IWoaDeployer deployer, UIServices uiServices, AdvancedViewModel advancedViewModel, WimPickViewModel wimPickViewModel, ILowLevelApi lowLevelApi) { this.optionsProvider = optionsProvider; this.deployer = deployer; this.uiServices = uiServices; this.advancedViewModel = advancedViewModel; this.wimPickViewModel = wimPickViewModel; var isSelectedWim = wimPickViewModel.WhenAnyObservable(x => x.WimMetadata.SelectedImageObs) .Select(metadata => metadata != null); FullInstallWrapper = new CommandWrapper <Unit, Unit>(this, ReactiveCommand.CreateFromTask(Deploy, isSelectedWim), uiServices.Dialog); IsBusyObservable = FullInstallWrapper.Command.IsExecuting; isBusy = IsBusyObservable.ToProperty(this, model => model.IsBusy); RefreshDisksCommandWrapper = new CommandWrapper <Unit, ICollection <Disk> >(this, ReactiveCommand.CreateFromTask(lowLevelApi.GetDisks), uiServices.Dialog); disks = RefreshDisksCommandWrapper.Command .Select(x => x.Select(disk => new DiskViewModel(disk))) .ToProperty(this, x => x.Disks); this.WhenAnyValue(x => x.SelectedDisk).Where(x => x != null).Subscribe(x => deviceProvider.Device = new RaspberryPi(lowLevelApi, x.Disk)); }
private static Disk ToDisk(ILowLevelApi lowLevelApi, object disk) { var number = (uint)disk.GetPropertyValue("Number"); var size = new ByteSize((ulong)disk.GetPropertyValue("Size")); var allocatedSize = new ByteSize((ulong)disk.GetPropertyValue("AllocatedSize")); return(new Disk(lowLevelApi, number, size, allocatedSize)); }
public Disk(ILowLevelApi lowLevelApi, DiskInfo diskProps) { LowLevelApi = lowLevelApi; FriendlyName = diskProps.FriendlyName; Number = diskProps.Number; Size = diskProps.Size; AllocatedSize = diskProps.AllocatedSize; FriendlyName = diskProps.FriendlyName; IsSystem = diskProps.IsSystem; IsBoot = diskProps.IsBoot; IsReadOnly = diskProps.IsReadOnly; IsOffline = diskProps.IsOffline; }
/* * * // Get device list for specific group using /device/search MC 14+ API (reads elasticsearch DB) * private async Task<string> GetDeviceListJsonSearchDbAsync(string deviceGroupPath, string filter, bool includeSubgroups, bool verifyAndSync, int skip, int take) * { * * // Generate resourcePath * //string resourcePath = "devices/search?path=%255C" + deviceGroupPath.Replace(" ", "%2520").Replace("/", "%255C"); * * string resourcePath = "devices/search?path=" + deviceGroupPath; * * if (!String.IsNullOrEmpty(filter)) * resourcePath += "&filter=" + filter.Replace(" ", "%2520").Replace("/", "%255C"); * * // if (includeSubgroups) * * resourcePath += "&includeSubgroups=" + includeSubgroups.ToString().ToLower(); * * resourcePath += * "&skip=" + skip.ToString() + "&take=" + take.ToString(); + + // Call GetJsonAsync + return await GetJsonAsync(resourcePath); + + + } */ // GET /devices/{deviceId}/collectedData // Retrieve Collected Data for a Device public async Task <List <CollectedDataModel> > GetCollectedDataDeviceAsync(ILowLevelApi lowLevelApi, string deviceId, DateTimeOffset startDate, DateTimeOffset stopDate) { List <CollectedDataModel> collectedDateModels = new List <CollectedDataModel>(); // /collectedData?startDate=2019-11-01T00%3A00%3A00-02%3A00&endDate=2019-12-01T00%3A00%3A00-02%3A00&builtInDataType=BatteryStatus string resourcePath = "devices/" + deviceId + "/collectedData?startDate="; string requestBody = null; // Call GetJsonAsync var response = await lowLevelApi.PostJsonAsync(resourcePath, requestBody); return(collectedDateModels); }
private static Disk ToDisk(ILowLevelApi lowLevelApi, object disk) { var number = (uint)disk.GetPropertyValue("Number"); var size = new ByteSize((ulong)disk.GetPropertyValue("Size")); var allocatedSize = new ByteSize((ulong)disk.GetPropertyValue("AllocatedSize")); var diskProps = new DiskInfo { Number = number, Size = size, AllocatedSize = allocatedSize, FriendlyName = (string)disk.GetPropertyValue("FriendlyName"), IsSystem = (bool)disk.GetPropertyValue("IsSystem"), IsBoot = (bool)disk.GetPropertyValue("IsBoot"), IsOffline = (bool)disk.GetPropertyValue("IsOffline"), IsReadOnly = (bool)disk.GetPropertyValue("IsReadOnly"), }; return(new Disk(lowLevelApi, diskProps)); }
public DiskService(ILowLevelApi api) { this.api = api; }
protected Device(ILowLevelApi lowLevelApi) { LowLevelApi = lowLevelApi; }
public Phone(ILowLevelApi lowLevelApi, IPhoneModelReader phoneModelReader, BcdInvokerFactory bcdInvokerFactory) : base(lowLevelApi) { this.phoneModelReader = phoneModelReader; this.bcdInvokerFactory = bcdInvokerFactory; }
public static async Task <Phone> Load(ILowLevelApi lowLevelApi) { var disk = await lowLevelApi.GetPhoneDisk(); return(new Phone(disk)); }
public TestPhone(ILowLevelApi lowLevelApi, IPhoneModelReader phoneModelReader, BcdInvokerFactory bcdInvokerFactory) : base(lowLevelApi, phoneModelReader, bcdInvokerFactory) { }
public RaspberryPi(ILowLevelApi lowLevelApi, Disk disk) : base(lowLevelApi) { this.disk = disk; }
public RaspberryPi(ILowLevelApi lowLevelApi, int diskNumber) : base(lowLevelApi) { this.diskNumber = diskNumber; }