public async Task <bool> StartDeviceFirmwareUpdate(DeviceInformationItem targetDevice)
        {
            GattDeviceService genericAttribute;
            GattDeviceService deviceFirmwareUpdate;

            targetDevice.Services.TryGetValue(ToolboxIdentifications.GattServiceNames.GENERIC_ATTRIBUTES, out genericAttribute);
            targetDevice.Services.TryGetValue(ToolboxIdentifications.GattServiceNames.DEVICE_FIRMWARE_UPDATE, out deviceFirmwareUpdate);
            if (genericAttribute != null && deviceFirmwareUpdate != null)
            {
                try
                {
                    var type = DFUPackageHandler.GetFirmwareType(SelectedDeviceFirmwareTypeName);
                    if (type.Equals(FirmwareTypeEnum.Softdevice_Bootloader))
                    {
                        var imageFile = ChosenFiles.Find(x => x.Name == dfuSettingViewModel.manifestObject.manifest.softdevice_bootloader.bin_file);
                        var dataFile  = ChosenFiles.Find(x => x.Name == dfuSettingViewModel.manifestObject.manifest.softdevice_bootloader.dat_file);
                        var sdSize    = dfuSettingViewModel.manifestObject.manifest.softdevice_bootloader.sd_size;
                        var blSize    = dfuSettingViewModel.manifestObject.manifest.softdevice_bootloader.bl_size;
                        await deviceFirmwareUpdateService.Start(deviceFirmwareUpdate, genericAttribute, type, dataFile, imageFile, sdSize, blSize);
                    }
                    else
                    {
                        var dat = ChosenFiles.Find(x => x.FileType == DeviceFirmwareUpdateSettingPageViewModel.DataFile_dat);
                        var img = ChosenFiles.Find(x => x.FileType == DeviceFirmwareUpdateSettingPageViewModel.ImageFile_Bin);
                        await deviceFirmwareUpdateService.Start(deviceFirmwareUpdate, genericAttribute, type, dat, img);
                    }
                    await deviceFirmwareUpdateService.EnableServiceChange();

                    await deviceFirmwareUpdateService.SwitchOnBootLoader();
                }
                catch (Exception e)
                {
                    this.exception = e;
                }
                if (this.exception != null)
                {
                    await UpdateDFUStatus(DeviceFirmwareUpdateStatusEnum.DFU_ERROR, 0, this.exception.GetType().ToString(), this.exception.Message);

                    return(false);
                }
                else
                {
                    RegisterTimer();
                    return(true);
                }
            }
            else
            {
                await UpdateDFUStatus(DeviceFirmwareUpdateStatusEnum.SERVICES_NOT_AVAILABLE);

                return(false);
            }
        }
        public bool IsImagesReadyToSend()
        {
            bool ready = false;

            if (ChosenFiles.Count == 2)
            {
                var flag1 = ChosenFiles.Exists(x => x.FileType == DeviceFirmwareUpdateSettingPageViewModel.ImageFile_Bin);
                var flag2 = ChosenFiles.Exists(x => x.FileType == DeviceFirmwareUpdateSettingPageViewModel.DataFile_dat);
                if (flag1 && flag2)
                {
                    ready = true;
                }
            }
            else
            {
                ready = false;
            }
            return(ready);
        }