public void OnHouseholdDeviceDeleteComplete(bool success, Exception error)
        {
            if (error != null)
            {
                if (error is APIException)
                {
                    APIException exception = error as APIException;
                    if (exception.Code != APIException.DeviceNotInDomain)
                    {
                        Console.WriteLine("Failed to delete household device: " + error.Message);
                        code      = -1;
                        openTasks = 0;
                        return;
                    }
                }
                else
                {
                    Console.WriteLine("Failed to delete household device: " + error.Message);
                    code      = -1;
                    openTasks = 0;
                    return;
                }
            }

            HouseholdDevice newDevice = new HouseholdDevice();

            newDevice.Name    = MASTER_DEVICE;
            newDevice.Udid    = MASTER_DEVICE;
            newDevice.BrandId = MASTER_DEVICE_BRAND;

            HouseholdDeviceService.Add(newDevice)
            .SetCompletion(new OnCompletedHandler <HouseholdDevice>(OnHouseholdDeviceAddComplete))
            .Execute(client);
        }
        public void OnHouseholdDeviceAddComplete(HouseholdDevice householdDevice, Exception error)
        {
            if (error != null)
            {
                Console.WriteLine("Failed to delete household device: " + error.Message);
                code      = -1;
                openTasks = 0;
                return;
            }

            openTasks--;
        }
        public void OnHouseholdDeviceAddComplete(HouseholdDevice householdDevice, Exception error)
        {
            if (error != null)
            {
                Console.WriteLine("Failed to delete household device: " + error.Message);
                code      = -1;
                openTasks = 0;
                return;
            }

            HouseholdDeviceService.Delete(householdDevice.Udid)
            .SetCompletion(new OnCompletedHandler <bool>(OnHouseholdDeviceDeleteComplete))
            .Execute(client);
        }
        private void AddHouseholdDevice()
        {
            openTasks++;

            HouseholdDevice newDevice = new HouseholdDevice();

            newDevice.Name    = Guid.NewGuid().ToString();
            newDevice.Udid    = Guid.NewGuid().ToString();
            newDevice.BrandId = MASTER_DEVICE_BRAND;

            HouseholdDeviceService.Add(newDevice)
            .SetCompletion(new OnCompletedHandler <HouseholdDevice>(OnHouseholdDeviceAddComplete))
            .Execute(client);
        }
 public static HouseholdDeviceUpdateRequestBuilder Update(string udid, HouseholdDevice device)
 {
     return(new HouseholdDeviceUpdateRequestBuilder(udid, device));
 }
 public static HouseholdDeviceAddRequestBuilder Add(HouseholdDevice device)
 {
     return(new HouseholdDeviceAddRequestBuilder(device));
 }