Exemplo n.º 1
0
        private IPhoneDeviceInfo GetSelectedPhoneInfo()
        {
            List <IPhoneDeviceInfo> devicesInfo   = devicesInfo = new List <IPhoneDeviceInfo>(PhoneDeviceInfoReader.GetDevicesInfo());
            PhoneSelector           phoneSelector = new PhoneSelector(devicesInfo, _phoneSelectOptions);

            IPhoneDeviceInfo selectedPhone;

            selectedPhone = phoneSelector.AutoSelectPhoneDevice();

            if (phoneSelector.ShouldWarnAboutLaterSyncedPhone())
            {
                bool letUserChoosePhone;
                bool ignoreNewerSyncs;
                PromptToChooseLaterSync(out letUserChoosePhone, out ignoreNewerSyncs);

                if (letUserChoosePhone)
                {
                    selectedPhone = null;
                }
                else if (ignoreNewerSyncs)
                {
                    _phoneSelectOptions.WarnAboutMoreRecentSync = false;
                    _phoneSelectOptions.Save();
                }
            }

            if (selectedPhone != null)
            {
                _deviceInfo = selectedPhone;
                return(selectedPhone);
            }

            bool alwaysPrompt;

            if (PromptForPhoneSelectionOptions(devicesInfo, out selectedPhone, out alwaysPrompt) == false)
            {
                Environment.Exit(0);
            }

            _deviceInfo = selectedPhone;
            _phoneSelectOptions.PromptForPhoneChoice = alwaysPrompt;
            _phoneSelectOptions.PhoneDataPath        = selectedPhone.BackupPath;
            _phoneSelectOptions.Save();

            return(selectedPhone);
        }
Exemplo n.º 2
0
        private IPhoneDeviceInfo GetSelectedPhoneInfo()
        {
            List<IPhoneDeviceInfo> devicesInfo = devicesInfo = new List<IPhoneDeviceInfo>(PhoneDeviceInfoReader.GetDevicesInfo());
            PhoneSelector phoneSelector = new PhoneSelector(devicesInfo, _phoneSelectOptions);

            IPhoneDeviceInfo selectedPhone;

            selectedPhone = phoneSelector.AutoSelectPhoneDevice();

            if (phoneSelector.ShouldWarnAboutLaterSyncedPhone())
            {
                bool letUserChoosePhone;
                bool ignoreNewerSyncs;
                PromptToChooseLaterSync(out letUserChoosePhone, out ignoreNewerSyncs);

                if (letUserChoosePhone)
                {
                    selectedPhone = null;
                }
                else if (ignoreNewerSyncs)
                {
                    _phoneSelectOptions.WarnAboutMoreRecentSync = false;
                    _phoneSelectOptions.Save();
                }
            }

            if (selectedPhone != null)
            {
                _deviceInfo = selectedPhone;
                return selectedPhone;
            }

            bool alwaysPrompt;
            if (PromptForPhoneSelectionOptions(devicesInfo, out selectedPhone, out alwaysPrompt) == false)
            {
                Environment.Exit(0);
            }

            _deviceInfo = selectedPhone;
            _phoneSelectOptions.PromptForPhoneChoice = alwaysPrompt;
            _phoneSelectOptions.PhoneDataPath = selectedPhone.BackupPath;
            _phoneSelectOptions.Save();

            return selectedPhone;
        }