private async void FactoryResetAsync()
        {
            var resetParams = new FactoryResetDataContract.ResetParams();

            resetParams.clearTPM = DesiredClearTPM.IsChecked == true;
            resetParams.recoveryPartitionGUID = DesiredRecoveryPartitionGUID.Text;
            string resetParamsString = resetParams.ToJsonString();

            Debug.WriteLine("Reset params : " + resetParamsString);

            CancellationToken       cancellationToken = new CancellationToken();
            DeviceMethodReturnValue result            = await _deviceTwin.CallDeviceMethod(FactoryResetDataContract.StartFactoryResetAsync, resetParamsString, new TimeSpan(0, 0, 30), cancellationToken);

            MessageBox.Show("FactoryReset Command Result:\nStatus: " + result.Status + "\nReason: " + result.Payload);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Start factory reset via direct methods.
        /// </summary>
        private void SetFactoryStatusButton_Click(object sender, RoutedEventArgs e)
        {
            var resetParam = new FactoryResetDataContract.ResetParams();

            if (RecoveryPartitionGUIDInput.Text.Length == 0)
            {
                _mainPage.ShowDialogAsync("Invaid Input", "Please enter all fields to start Factory Reset");
                return;
            }
            resetParam.recoveryPartitionGUID = RecoveryPartitionGUIDInput.Text;
            resetParam.clearTPM = ClearTPMChckbx.IsChecked == true;

            var result = _mainPage.CallDeviceMethod(FactoryResetDataContract.StartFactoryResetAsync, resetParam.ToJsonString());
        }