public bool PartnerWithPhone() { if ((this.CurrentDevice.SetSyncPartner() == ResultCode.Success) && !string.IsNullOrEmpty(this.CurrentDevice.SyncPartner)) { DeviceSettings.EnsureSettingsForDevice(this.CurrentDevice.WinMoDeviceId); this.CurrentDevice.IsFirstConnect = true; this.ResetCurrentDeviceTo(this.CurrentDevice); return(true); } return(false); }
private void ResetCurrentDeviceTo(IDevice device) { Action action = null; using (new OperationLogger()) { if ((device != null) && device.RefreshLockStatus()) { device.DeviceUnlockedEvent += new EventHandler(this.OnDeviceUnlockedEvent); if (action == null) { action = delegate { device.NotifyWhenUnlocked(); }; } Task.Factory.StartNew(action); } bool flag = this.IsDevicePartnered(device); if (flag) { DeviceSettings.EnsureSettingsForDevice(device.WinMoDeviceId); } Trace.WriteLine("\n\n"); this.CurrentDevice = device; if (flag) { ISyncPartnership partnership; this.EnsurePartnershipForDevice(this.CurrentDevice, out partnership); this.CurrentSyncPartnership = partnership; ReloadSourcesAndTargets(partnership); } else { this.CurrentSyncPartnership = null; } this.OnPropertyChanged("CurrentDeviceIndex"); } }