コード例 #1
0
        public ComputerName()
        {
            ComputerNameViewModel = new StatusViewModel("Loading...");
            _compNameBridge       = new ComputerNameBridge();

            this.InitializeComponent();
        }
コード例 #2
0
 protected async Task RunAPIInBackground(Action toRun, StatusViewModel toUpdate = null)
 {
     await RunAPIInBackgroundWithManualStatus(() =>
     {
         toRun();
         return(null);
     }, toUpdate);
 }
コード例 #3
0
        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;
        }
コード例 #4
0
 public TPM()
 {
     TpmViewModel = new StatusViewModel("Loading...");
     this.InitializeComponent();
     _tpmBridge = new TpmBridge();
 }
コード例 #5
0
 public TelemetryLevel()
 {
     TelemetryLevelViewModel = new StatusViewModel("Loading...");
     this.InitializeComponent();
     _telemetryBridge = new TelemetryLevelBridge();
 }
コード例 #6
0
 public BaseAPIPage()
 {
     ViewModel = new StatusViewModel();
 }