public ComputerName() { ComputerNameViewModel = new StatusViewModel("Loading..."); _compNameBridge = new ComputerNameBridge(); this.InitializeComponent(); }
protected async Task RunAPIInBackground(Action toRun, StatusViewModel toUpdate = null) { await RunAPIInBackgroundWithManualStatus(() => { toRun(); return(null); }, toUpdate); }
protected async Task RunAPIInBackgroundWithManualStatus(Func <string> toRun, StatusViewModel toUpdate = null) { if (toUpdate == null) { toUpdate = ViewModel; } string statusUpdate; try { statusUpdate = await Task.Run(() => { return(toRun()); }); if (string.IsNullOrWhiteSpace(statusUpdate)) { statusUpdate = "Success"; } } catch (Exception ex) { statusUpdate = ex.Message?.Split('\r')[0]; } toUpdate.Status = statusUpdate; }
public TPM() { TpmViewModel = new StatusViewModel("Loading..."); this.InitializeComponent(); _tpmBridge = new TpmBridge(); }
public TelemetryLevel() { TelemetryLevelViewModel = new StatusViewModel("Loading..."); this.InitializeComponent(); _telemetryBridge = new TelemetryLevelBridge(); }
public BaseAPIPage() { ViewModel = new StatusViewModel(); }