public ISyncPartnership SyncPartnershipForDevice(string deviceSerialNumber) { ISyncPartnership partnership = null; this.SyncPartnershipCache.TryGetValue(deviceSerialNumber, out partnership); return(partnership); }
public void CreateSyncContentStream(ISyncPartnership partnership, SyncStartType type, SyncStoppedReason reason, TimeSpan syncDuration) { if ((partnership != null) && this.isSqmEnabled) { SqmSyncContentStream stream = new SqmSyncContentStream(); SetSyncType(partnership, type, stream); if (partnership.Device != null) { string winMoDeviceId = partnership.Device.WinMoDeviceId; long? nullable = (long?)DeviceSettings.Get(winMoDeviceId, "SyncCount"); uint num = 0; if (nullable.HasValue) { num = (uint)nullable.Value; } stream.SyncIndex = ++num; DeviceSettings.Set(winMoDeviceId, "SyncCount", num); } ISyncRules ruleManager = partnership.RuleManager; SetGlobalRules(stream, ruleManager); CalculateMusicSyncSelections(partnership.MusicAndMovieProvider, partnership.RuleManager, stream); this.CalculatePhotoSyncSelections(partnership.PhotoAndVideoProvider, partnership.RuleManager, stream); CalculateSyncResults(partnership, stream); stream.OperationTime = (uint)syncDuration.TotalMilliseconds; SetSyncResult(reason, stream); this.sqmManager.SetStream(stream); } }
private static void SetSyncType(ISyncPartnership partnership, SyncStartType type, SqmSyncContentStream stream) { if (partnership.IsFirstSync) { stream.SyncType = SqmSyncType.FirstTimeSync; } else { switch (type) { case SyncStartType.AutoSync: stream.SyncType = SqmSyncType.AutoSync; return; case SyncStartType.ManualSync: stream.SyncType = SqmSyncType.ManualSync; return; case SyncStartType.Delete: stream.SyncType = SqmSyncType.Delete; return; case SyncStartType.CopyToPC: stream.SyncType = SqmSyncType.CopyToPC; return; case SyncStartType.SendRingtones: stream.SyncType = SqmSyncType.Ringtones; return; } } }
public void HandleSyncErrors(ISyncPartnership partnership, ICollection <SyncResult> errors) { if ((partnership != null) && ((bool)GlobalSetting.GetApplicationSetting("ShowSyncErrors"))) { this.ShowSyncErrorsPanel(errors); } }
public void CreateSyncContentStream(ISyncPartnership partnership, SyncStartType type, SyncStoppedReason reason, TimeSpan syncDuration) { if ((partnership != null) && this.isSqmEnabled) { SqmSyncContentStream stream = new SqmSyncContentStream(); SetSyncType(partnership, type, stream); if (partnership.Device != null) { string winMoDeviceId = partnership.Device.WinMoDeviceId; long? nullable = (long?) DeviceSettings.Get(winMoDeviceId, "SyncCount"); uint num = 0; if (nullable.HasValue) { num = (uint) nullable.Value; } stream.SyncIndex = ++num; DeviceSettings.Set(winMoDeviceId, "SyncCount", num); } ISyncRules ruleManager = partnership.RuleManager; SetGlobalRules(stream, ruleManager); CalculateMusicSyncSelections(partnership.MusicAndMovieProvider, partnership.RuleManager, stream); this.CalculatePhotoSyncSelections(partnership.PhotoAndVideoProvider, partnership.RuleManager, stream); CalculateSyncResults(partnership, stream); stream.OperationTime = (uint) syncDuration.TotalMilliseconds; SetSyncResult(reason, stream); this.sqmManager.SetStream(stream); } }
private bool EnsurePartnershipForDevice(IDevice device, out ISyncPartnership partnership) { bool flag = this.repository.EnsureSyncPartnershipForDevice(device, out partnership); if (flag) { partnership.PartnershipClient = this; } return(flag); }
public IPictureLibraryProvider PictureLibraryForDevice(string deviceSerialNumber) { ISyncPartnership partnership = this.SyncPartnershipForDevice(deviceSerialNumber); if (partnership != null) { return(partnership.PhotoAndVideoProvider); } return(null); }
public IMusicLibraryProvider MusicLibraryForDevice(string deviceSerialNumber) { ISyncPartnership partnership = this.SyncPartnershipForDevice(deviceSerialNumber); if (partnership != null) { return(partnership.MusicAndMovieProvider); } return(null); }
public ISyncEngine SyncEngineForDevice(string deviceSerialNumber) { ISyncPartnership partnership = null; this.SyncPartnershipCache.TryGetValue(deviceSerialNumber, out partnership); if (partnership != null) { return(partnership.Engine); } return(null); }
public ISyncRules SyncRulesForDevice(string deviceSerialNumber) { ISyncPartnership partnership = null; this.SyncPartnershipCache.TryGetValue(deviceSerialNumber, out partnership); if (partnership != null) { return(partnership.RuleManager); } return(null); }
private void OnPartnershipChanged() { if (this.currentPartnership != null) { this.currentPartnership.StateChanged -= new EventHandler <PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); } this.currentPartnership = this.controller.CurrentSyncPartnership; if (this.currentPartnership != null) { this.currentPartnership.StateChanged += new EventHandler <PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); } }
private void OnPartnershipStateChanged(object sender, PartnershipStateChangeEventArgs e) { string progressHeaderForSync; ISyncPartnership partnership = sender as ISyncPartnership; if (partnership != this.controller.CurrentSyncPartnership) { return; } switch (e.NewState) { case PartnershipState.PreparingSync: progressHeaderForSync = string.Empty; switch (partnership.SyncStartType) { case SyncStartType.AutoSync: case SyncStartType.ManualSync: progressHeaderForSync = Resources.ProgressHeaderForSync; break; case SyncStartType.Delete: progressHeaderForSync = Resources.ProgressHeaderForDelete; break; case SyncStartType.CopyToPC: progressHeaderForSync = Resources.ProgressHeaderForCopyToPC; break; case SyncStartType.SendRingtones: progressHeaderForSync = Resources.ProgressHeaderForRingtones; break; } break; case PartnershipState.CancelingSync: this.UpdateProgressBar(Resources.CancellingSyncText, string.Empty, string.Empty, 100f, 100f, true); goto Label_00CB; case PartnershipState.Idle: this.IsProgressLocked = false; goto Label_00CB; default: goto Label_00CB; } this.UpdateProgressBar(progressHeaderForSync, string.Empty, string.Empty, 0f, 100f, false); Label_00CB: this.ResetModelState(); }
public void ResetModelState() { ISyncPartnership currentSyncPartnership = this.controller.CurrentSyncPartnership; if ((currentSyncPartnership != null) && ((((currentSyncPartnership.CurrentState != PartnershipState.Syncing) && (currentSyncPartnership.CurrentState != PartnershipState.CancelingSync)) && (currentSyncPartnership.CurrentState != PartnershipState.LoadingSources)) && (currentSyncPartnership.CurrentState != PartnershipState.VerifyingSources))) { this.Visibility = System.Windows.Visibility.Visible; } else { this.Visibility = System.Windows.Visibility.Hidden; } CommandManager.InvalidateRequerySuggested(); this.UpdateStorageGauge(); }
private static void ReloadPartnershipSources(ISyncPartnership partnership) { Action action = null; using (new OperationLogger("Partnership reloading sources")) { if (action == null) { action = delegate { partnership.LoadSourceContent(); }; } Task.Factory.StartNew(action); } }
private void ResetModelState() { ISyncPartnership currentSyncPartnership = this.controller.CurrentSyncPartnership; if ((currentSyncPartnership != null) && ((((currentSyncPartnership.CurrentState == PartnershipState.Syncing) || (currentSyncPartnership.CurrentState == PartnershipState.CancelingSync)) || ((currentSyncPartnership.CurrentState == PartnershipState.PreparingSync) || (currentSyncPartnership.CurrentState == PartnershipState.LoadingSources))) || (currentSyncPartnership.CurrentState == PartnershipState.VerifyingSources))) { this.Visibility = System.Windows.Visibility.Visible; } else { this.Visibility = System.Windows.Visibility.Hidden; this.ClearProgress(); } CommandManager.InvalidateRequerySuggested(); }
private static void ResetAndReloadPartnershipTargets(ISyncPartnership partnership) { Action action = null; using (new OperationLogger("Partnership targets resetting and reloading")) { if (action == null) { action = delegate { partnership.ResetAndReloadTargets(); }; } Task.Factory.StartNew(action); } }
private static void CalculateSyncResults(ISyncPartnership partnership, SqmSyncContentStream stream) { long? nullable; double num = 0.0; double num2 = 0.0; uint num3 = 0; List <SyncOperation> list = new List <SyncOperation>(partnership.AttemptedSyncOperations); stream.AttemptedFileCount = (uint)list.Count; foreach (SyncOperation operation in list) { int?nullable2 = operation.Item.Properties.NullableIntForKey("Size"); nullable = nullable2.HasValue ? new long?((long)nullable2.GetValueOrDefault()) : null; if (nullable.HasValue && (operation.OperationType != SyncOperationType.Delete)) { num += (double)nullable.Value; } } stream.AttemptedFileSize = (uint)(num / 1000000.0); num = 0.0; List <SyncOperation> list2 = new List <SyncOperation>(partnership.SuccessfulSyncOperations); stream.SuccessfulFileCount = (uint)list2.Count; foreach (SyncOperation operation2 in list2) { int?nullable4 = operation2.Item.Properties.NullableIntForKey("Size"); nullable = nullable4.HasValue ? new long?((long)nullable4.GetValueOrDefault()) : null; if (nullable.HasValue) { if (operation2.OperationType == SyncOperationType.Delete) { num2 += (double)nullable.Value; } else { num += (double)nullable.Value; } } if (operation2.OperationType == SyncOperationType.DeferredTransferTo) { num3++; } MarkFileType(operation2.Item, stream); } stream.SuccessfulFileSize = (uint)(num / 1000000.0); stream.DeletedFileSize = (uint)(num2 / 1000000.0); stream.SuccessfulTranscodedFileCount = num3; }
private void OnPartnershipStateChanged(object sender, PartnershipStateChangeEventArgs e) { if (this.Panel != null) { ISyncPartnership partnership = sender as ISyncPartnership; if (partnership == this.controller.CurrentSyncPartnership) { //this.Panel.Dispatcher.BeginInvoke(DispatcherPriority.Normal, delegate { // this.ResetModelState(); //}); if ((e.NewState == PartnershipState.Idle) && ((e.OldState == PartnershipState.CancelingSync) || (e.OldState == PartnershipState.Syncing))) { this.controller.CurrentDevice.ReloadZmdbIfChanged(false); } } } }
private static void CalculateAcquiredItemResults(ISyncPartnership partnership, SqmDeviceInfoStream stream) { double num = 0.0; uint num2 = 0; uint num3 = 0; uint num4 = 0; uint num5 = 0; List <SyncOperation> list = new List <SyncOperation>(partnership.SuccessfulAcquiredOperations); stream.AcquiredItemsCount = (uint)list.Count; foreach (SyncOperation operation in list) { int? nullable2 = operation.Item.Properties.NullableIntForKey("Size"); long?nullable = nullable2.HasValue ? new long?((long)nullable2.GetValueOrDefault()) : null; if (nullable.HasValue) { num += (double)nullable.Value; } if (operation.Item.Properties.BooleanForKey("Picture", false)) { num3++; } else { if (operation.Item.Properties.BooleanForKey("Podcast", false)) { num5++; continue; } if (operation.Item.Properties.BooleanForKey("Has Video", false)) { num4++; continue; } if (operation.Item.Properties.BooleanForKey("Audio", false)) { num2++; } } } stream.AcquiredItemsSize = (uint)(num / 1000000.0); stream.AcquiredPhotoItemsCount = num3; stream.AcquiredMusicItemsCount = num2; stream.AcquiredVideoItemsCount = num4; stream.AcquiredPodcastItemsCount = num5; }
private void CalculateDeviceStorageInfo(ISyncPartnership partnership, SqmDeviceInfoStream stream) { this.musicSize = 0.0; this.photoSize = 0.0; this.videoSize = 0.0; double num = 0.0; double freeBytes = 0.0; double totalBytes = 0.0; double num4 = 0.0; double num5 = 0.0; IDevice device = partnership.Device; StorageInfo info = (from i in device.StorageDevices.Values where i.StorageType == StorageType.FixedRam select i).FirstOrDefault <StorageInfo>(); if (info != null) { this.musicSize += info.UsedStorageMusic; this.photoSize += info.UsedStoragePictures; this.videoSize += info.UsedStorageVideos; num += info.UsedStorageDocs; freeBytes = info.FreeBytes; totalBytes = info.TotalBytes; } info = (from i in device.StorageDevices.Values where i.StorageType == StorageType.RemovableRam select i).FirstOrDefault <StorageInfo>(); if (info != null) { this.musicSize += info.UsedStorageMusic; this.photoSize += info.UsedStoragePictures; this.videoSize += info.UsedStorageVideos; num += info.UsedStorageDocs; num5 = info.TotalBytes; num4 = info.FreeBytes; } stream.InternalCapacity = (uint)(totalBytes / 1000000.0); stream.InternalFreeSpace = (uint)(freeBytes / 1000000.0); stream.SDCardCapacity = (uint)(num5 / 1000000.0); stream.SDCardFreeSpace = (uint)(num4 / 1000000.0); stream.MusicFileSize = (uint)(this.musicSize / 1000000.0); stream.PhotoFileSize = (uint)(this.photoSize / 1000000.0); stream.VideoFileSize = (uint)(this.videoSize / 1000000.0); stream.DocumentFileSize = (uint)(num / 1000000.0); stream.StorageAreaCount = (uint)device.StorageDevices.Count; }
private void OnPartnershipChanged() { if (this.currentPartnership != null) { this.currentPartnership.StateChanged -= new EventHandler <PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); if (this.currentPartnership.Device != null) { this.currentPartnership.Device.PropertyChanged -= new PropertyChangedEventHandler(this.OnDevicePropertyChanged); } } this.currentPartnership = this.controller.CurrentSyncPartnership; if (this.currentPartnership != null) { this.currentPartnership.StateChanged += new EventHandler <PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); this.currentPartnership.Device.PropertyChanged += new PropertyChangedEventHandler(this.OnDevicePropertyChanged); } this.ResetModelState(); }
public void CreateDeviceInfoStream(ISyncPartnership partnership, int uniqueIndex) { if ((partnership != null) && this.isSqmEnabled) { SqmDeviceInfoStream stream = new SqmDeviceInfoStream { DeviceIndex = (uint)(uniqueIndex + 1) }; if (partnership.Device != null) { stream.MakeModel = partnership.Device.ManufacturerModelID; } this.CalculateDeviceStorageInfo(partnership, stream); CalculateAcquiredItemResults(partnership, stream); CalculateCumulativeSyncResults(partnership, stream); SetAutoImportSetting(partnership.Device, stream); this.sqmManager.SetStream(stream); } }
public void CreateDeviceInfoStream(ISyncPartnership partnership, int uniqueIndex) { if ((partnership != null) && this.isSqmEnabled) { SqmDeviceInfoStream stream = new SqmDeviceInfoStream { DeviceIndex = (uint) (uniqueIndex + 1) }; if (partnership.Device != null) { stream.MakeModel = partnership.Device.ManufacturerModelID; } this.CalculateDeviceStorageInfo(partnership, stream); CalculateAcquiredItemResults(partnership, stream); CalculateCumulativeSyncResults(partnership, stream); SetAutoImportSetting(partnership.Device, stream); this.sqmManager.SetStream(stream); } }
public bool EnsureSyncPartnershipForDevice(IDevice device, out ISyncPartnership partnership) { if (device == null) { throw new ArgumentNullException("device"); } partnership = this.SyncPartnershipForDevice(device.WinMoDeviceId); if (partnership != null) { return(false); } using (new OperationLogger()) { partnership = DependencyContainer.ResolveISyncPartnership(device); this.AddSyncPartnershipForDevice(device.WinMoDeviceId, partnership); } return(true); }
public bool EnsureSyncPartnershipForDevice(IDevice device, out ISyncPartnership partnership) { if (device == null) { throw new ArgumentNullException("device"); } partnership = this.SyncPartnershipForDevice(device.WinMoDeviceId); if (partnership != null) { return false; } using (new OperationLogger()) { partnership = DependencyContainer.ResolveISyncPartnership(device); this.AddSyncPartnershipForDevice(device.WinMoDeviceId, partnership); } return true; }
private static void CalculateCumulativeSyncResults(ISyncPartnership partnership, SqmDeviceInfoStream stream) { double num = 0.0; List <SyncOperation> list = new List <SyncOperation>(partnership.SuccessfulCumulativeSyncOperations); stream.ItemsSuccessfullySyncedCount = (uint)list.Count; foreach (SyncOperation operation in list) { if ((operation.OperationType != SyncOperationType.Delete) && (operation.OperationType != SyncOperationType.Update)) { int? nullable2 = operation.Item.Properties.NullableIntForKey("Size"); long?nullable = nullable2.HasValue ? new long?((long)nullable2.GetValueOrDefault()) : null; if (nullable.HasValue) { num += (double)nullable.Value; } } } stream.ItemsSuccessfullySyncedSize = (uint)(num / 1000000.0); }
private void OnPartnershipChanged() { if (this.currentPartnership != null) { this.currentPartnership.PropertyChanged -= new PropertyChangedEventHandler(this.OnPartnershipPropertyChanged); this.SyncRules.PropertyChanged -= new PropertyChangedEventHandler(this.OnSyncRulesPropertyChanged); } this.currentPartnership = this.controller.CurrentSyncPartnership; if (this.currentPartnership != null) { this.currentPartnership.PropertyChanged += new PropertyChangedEventHandler(this.OnPartnershipPropertyChanged); this.SyncRules = this.currentPartnership.RuleManager; this.SyncRules.PropertyChanged += new PropertyChangedEventHandler(this.OnSyncRulesPropertyChanged); } else { this.SyncRules = null; } this.ResetMusicAndMovieProvider(); this.ResetPhotoAndVideoProvider(); }
private void OnPartnershipChanged() { if (this.currentPartnership != null) { if (this.currentPartnership.Engine != null) { this.currentPartnership.Engine.SyncProgressEvent -= new SyncEngine.SyncProgressDelegate(this.OnSyncProgress); this.currentPartnership.Engine.SendItemProgressEvent -= new SendItemProgressDelegate(this.AddProgress); } this.currentPartnership.StateChanged -= new EventHandler <PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); this.currentPartnership.ContentLoadingProgress -= new EventHandler <ContentLoadingEventArgs>(this.OnContentLoading); } this.currentPartnership = this.controller.CurrentSyncPartnership; if (this.currentPartnership != null) { this.currentPartnership.Engine.SyncProgressEvent += new SyncEngine.SyncProgressDelegate(this.OnSyncProgress); this.currentPartnership.Engine.SendItemProgressEvent += new SendItemProgressDelegate(this.AddProgress); this.currentPartnership.StateChanged += new EventHandler <PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); this.currentPartnership.ContentLoadingProgress += new EventHandler <ContentLoadingEventArgs>(this.OnContentLoading); } this.ResetModelState(); }
private static void CalculateCumulativeSyncResults(ISyncPartnership partnership, SqmDeviceInfoStream stream) { double num = 0.0; List<SyncOperation> list = new List<SyncOperation>(partnership.SuccessfulCumulativeSyncOperations); stream.ItemsSuccessfullySyncedCount = (uint) list.Count; foreach (SyncOperation operation in list) { if ((operation.OperationType != SyncOperationType.Delete) && (operation.OperationType != SyncOperationType.Update)) { int? nullable2 = operation.Item.Properties.NullableIntForKey("Size"); long? nullable = nullable2.HasValue ? new long?((long) nullable2.GetValueOrDefault()) : null; if (nullable.HasValue) { num += (double) nullable.Value; } } } stream.ItemsSuccessfullySyncedSize = (uint) (num / 1000000.0); }
private static void CalculateSyncResults(ISyncPartnership partnership, SqmSyncContentStream stream) { long? nullable; double num = 0.0; double num2 = 0.0; uint num3 = 0; List<SyncOperation> list = new List<SyncOperation>(partnership.AttemptedSyncOperations); stream.AttemptedFileCount = (uint) list.Count; foreach (SyncOperation operation in list) { int? nullable2 = operation.Item.Properties.NullableIntForKey("Size"); nullable = nullable2.HasValue ? new long?((long) nullable2.GetValueOrDefault()) : null; if (nullable.HasValue && (operation.OperationType != SyncOperationType.Delete)) { num += (double) nullable.Value; } } stream.AttemptedFileSize = (uint) (num / 1000000.0); num = 0.0; List<SyncOperation> list2 = new List<SyncOperation>(partnership.SuccessfulSyncOperations); stream.SuccessfulFileCount = (uint) list2.Count; foreach (SyncOperation operation2 in list2) { int? nullable4 = operation2.Item.Properties.NullableIntForKey("Size"); nullable = nullable4.HasValue ? new long?((long) nullable4.GetValueOrDefault()) : null; if (nullable.HasValue) { if (operation2.OperationType == SyncOperationType.Delete) { num2 += (double) nullable.Value; } else { num += (double) nullable.Value; } } if (operation2.OperationType == SyncOperationType.DeferredTransferTo) { num3++; } MarkFileType(operation2.Item, stream); } stream.SuccessfulFileSize = (uint) (num / 1000000.0); stream.DeletedFileSize = (uint) (num2 / 1000000.0); stream.SuccessfulTranscodedFileCount = num3; }
private void OnPartnershipChanged() { if (this.currentPartnership != null) { this.currentPartnership.StateChanged -= new EventHandler<PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); if (this.currentPartnership.Device != null) { this.currentPartnership.Device.PropertyChanged -= new PropertyChangedEventHandler(this.OnDevicePropertyChanged); } } this.currentPartnership = this.controller.CurrentSyncPartnership; if (this.currentPartnership != null) { this.currentPartnership.StateChanged += new EventHandler<PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); this.currentPartnership.Device.PropertyChanged += new PropertyChangedEventHandler(this.OnDevicePropertyChanged); } this.ResetModelState(); }
private static void CalculateAcquiredItemResults(ISyncPartnership partnership, SqmDeviceInfoStream stream) { double num = 0.0; uint num2 = 0; uint num3 = 0; uint num4 = 0; uint num5 = 0; List<SyncOperation> list = new List<SyncOperation>(partnership.SuccessfulAcquiredOperations); stream.AcquiredItemsCount = (uint) list.Count; foreach (SyncOperation operation in list) { int? nullable2 = operation.Item.Properties.NullableIntForKey("Size"); long? nullable = nullable2.HasValue ? new long?((long) nullable2.GetValueOrDefault()) : null; if (nullable.HasValue) { num += (double) nullable.Value; } if (operation.Item.Properties.BooleanForKey("Picture", false)) { num3++; } else { if (operation.Item.Properties.BooleanForKey("Podcast", false)) { num5++; continue; } if (operation.Item.Properties.BooleanForKey("Has Video", false)) { num4++; continue; } if (operation.Item.Properties.BooleanForKey("Audio", false)) { num2++; } } } stream.AcquiredItemsSize = (uint) (num / 1000000.0); stream.AcquiredPhotoItemsCount = num3; stream.AcquiredMusicItemsCount = num2; stream.AcquiredVideoItemsCount = num4; stream.AcquiredPodcastItemsCount = num5; }
private bool EnsurePartnershipForDevice(IDevice device, out ISyncPartnership partnership) { bool flag = this.repository.EnsureSyncPartnershipForDevice(device, out partnership); if (flag) { partnership.PartnershipClient = this; } return flag; }
private void OnPartnershipChanged() { if (this.currentPartnership != null) { this.currentPartnership.StateChanged -= new EventHandler<PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); } this.currentPartnership = this.controller.CurrentSyncPartnership; if (this.currentPartnership != null) { this.currentPartnership.StateChanged += new EventHandler<PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); } }
private static void ReloadSourcesAndTargets(ISyncPartnership partnership) { ReloadPartnershipSources(partnership); ResetAndReloadPartnershipTargets(partnership); }
private static void ResetAndReloadPartnershipTargets(ISyncPartnership partnership) { Action action = null; using (new OperationLogger("Partnership targets resetting and reloading")) { if (action == null) { action = delegate { partnership.ResetAndReloadTargets(); }; } Task.Factory.StartNew(action); } }
private void AddSyncPartnershipForDevice(string deviceSerialNumber, ISyncPartnership partnership) { this.SyncPartnershipCache[deviceSerialNumber] = partnership; }
private static void ReloadPartnershipSources(ISyncPartnership partnership) { Action action = null; using (new OperationLogger("Partnership reloading sources")) { if (action == null) { action = delegate { partnership.LoadSourceContent(); }; } Task.Factory.StartNew(action); } }
private void CalculateDeviceStorageInfo(ISyncPartnership partnership, SqmDeviceInfoStream stream) { this.musicSize = 0.0; this.photoSize = 0.0; this.videoSize = 0.0; double num = 0.0; double freeBytes = 0.0; double totalBytes = 0.0; double num4 = 0.0; double num5 = 0.0; IDevice device = partnership.Device; StorageInfo info = (from i in device.StorageDevices.Values where i.StorageType == StorageType.FixedRam select i).FirstOrDefault<StorageInfo>(); if (info != null) { this.musicSize += info.UsedStorageMusic; this.photoSize += info.UsedStoragePictures; this.videoSize += info.UsedStorageVideos; num += info.UsedStorageDocs; freeBytes = info.FreeBytes; totalBytes = info.TotalBytes; } info = (from i in device.StorageDevices.Values where i.StorageType == StorageType.RemovableRam select i).FirstOrDefault<StorageInfo>(); if (info != null) { this.musicSize += info.UsedStorageMusic; this.photoSize += info.UsedStoragePictures; this.videoSize += info.UsedStorageVideos; num += info.UsedStorageDocs; num5 = info.TotalBytes; num4 = info.FreeBytes; } stream.InternalCapacity = (uint) (totalBytes / 1000000.0); stream.InternalFreeSpace = (uint) (freeBytes / 1000000.0); stream.SDCardCapacity = (uint) (num5 / 1000000.0); stream.SDCardFreeSpace = (uint) (num4 / 1000000.0); stream.MusicFileSize = (uint) (this.musicSize / 1000000.0); stream.PhotoFileSize = (uint) (this.photoSize / 1000000.0); stream.VideoFileSize = (uint) (this.videoSize / 1000000.0); stream.DocumentFileSize = (uint) (num / 1000000.0); stream.StorageAreaCount = (uint) device.StorageDevices.Count; }
private void OnPartnershipChanged() { if (this.currentPartnership != null) { this.currentPartnership.PropertyChanged -= new PropertyChangedEventHandler(this.OnPartnershipPropertyChanged); this.SyncRules.PropertyChanged -= new PropertyChangedEventHandler(this.OnSyncRulesPropertyChanged); } this.currentPartnership = this.controller.CurrentSyncPartnership; if (this.currentPartnership != null) { this.currentPartnership.PropertyChanged += new PropertyChangedEventHandler(this.OnPartnershipPropertyChanged); this.SyncRules = this.currentPartnership.RuleManager; this.SyncRules.PropertyChanged += new PropertyChangedEventHandler(this.OnSyncRulesPropertyChanged); } else { this.SyncRules = null; } this.ResetMusicAndMovieProvider(); this.ResetPhotoAndVideoProvider(); }
private static void ReloadSourcesAndTargets(ISyncPartnership partnership) { ReloadPartnershipSources(partnership); ResetAndReloadPartnershipTargets(partnership); }
private void AddSyncPartnershipForDevice(string deviceSerialNumber, ISyncPartnership partnership) { this.SyncPartnershipCache[deviceSerialNumber] = partnership; }
private void OnPartnershipChanged() { if (this.currentPartnership != null) { if (this.currentPartnership.Engine != null) { this.currentPartnership.Engine.SyncProgressEvent -= new SyncEngine.SyncProgressDelegate(this.OnSyncProgress); this.currentPartnership.Engine.SendItemProgressEvent -= new SendItemProgressDelegate(this.AddProgress); } this.currentPartnership.StateChanged -= new EventHandler<PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); this.currentPartnership.ContentLoadingProgress -= new EventHandler<ContentLoadingEventArgs>(this.OnContentLoading); } this.currentPartnership = this.controller.CurrentSyncPartnership; if (this.currentPartnership != null) { this.currentPartnership.Engine.SyncProgressEvent += new SyncEngine.SyncProgressDelegate(this.OnSyncProgress); this.currentPartnership.Engine.SendItemProgressEvent += new SendItemProgressDelegate(this.AddProgress); this.currentPartnership.StateChanged += new EventHandler<PartnershipStateChangeEventArgs>(this.OnPartnershipStateChanged); this.currentPartnership.ContentLoadingProgress += new EventHandler<ContentLoadingEventArgs>(this.OnContentLoading); } this.ResetModelState(); }
private static void SetSyncType(ISyncPartnership partnership, SyncStartType type, SqmSyncContentStream stream) { if (partnership.IsFirstSync) { stream.SyncType = SqmSyncType.FirstTimeSync; } else { switch (type) { case SyncStartType.AutoSync: stream.SyncType = SqmSyncType.AutoSync; return; case SyncStartType.ManualSync: stream.SyncType = SqmSyncType.ManualSync; return; case SyncStartType.Delete: stream.SyncType = SqmSyncType.Delete; return; case SyncStartType.CopyToPC: stream.SyncType = SqmSyncType.CopyToPC; return; case SyncStartType.SendRingtones: stream.SyncType = SqmSyncType.Ringtones; return; } } }
public void HandleSyncErrors(ISyncPartnership partnership, ICollection<SyncResult> errors) { if ((partnership != null) && ((bool) GlobalSetting.GetApplicationSetting("ShowSyncErrors"))) { this.ShowSyncErrorsPanel(errors); } }
public void OnDeviceLocked(ISyncPartnership partnership) { }
public void OnDeviceLocked(ISyncPartnership partnership) { }