/// <summary> /// Main entry point for handling a Sandbox operation /// </summary> /// <param name="portal">DevicePortal reference for communicating with the device.</param> /// <param name="parameters">Parsed command line parameters.</param> public static void HandleOperation(DevicePortal portal, ParameterHelper parameters) { if (parameters.HasFlag(ParameterHelper.HelpFlag)) { Console.WriteLine(SandboxUsageMessage); return; } string desiredValue = parameters.GetParameterValue("value"); if (string.IsNullOrEmpty(desiredValue)) { Task <Sandbox> getSandboxTask = portal.GetXboxLiveSandbox(); getSandboxTask.Wait(); Console.WriteLine(getSandboxTask.Result); } else { Task <Sandbox> setSandboxTask = portal.SetXboxLiveSandbox(desiredValue); setSandboxTask.Wait(); Console.WriteLine("{0} -> {1}", setSandboxTask.Result, desiredValue); if (parameters.HasFlag("reboot")) { Task rebootTask = portal.Reboot(); rebootTask.Wait(); Console.WriteLine("Console rebooting..."); } else { Console.WriteLine("A reboot is required before this setting takes effect."); } } }