コード例 #1
0
        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);
        }
コード例 #2
0
 private void AddHouseholdDevice()
 {
     openTasks++;
     HouseholdDeviceService.Delete(MASTER_DEVICE)
     .SetCompletion(new OnCompletedHandler <bool>(OnHouseholdDeviceDeleteComplete))
     .Execute(client);
 }
コード例 #3
0
 private void GetHouseholdDevice()
 {
     openTasks++;
     HouseholdDeviceService.Get()
     .SetCompletion(new OnCompletedHandler <HouseholdDevice>(OnHouseholdDeviceGetComplete))
     .Execute(client);
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }