private async void FileListPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName != nameof(ItemObservableCollection <FileItemViewModel> .ItemPropertyChangedSender)) { return; } var item = ((ItemObservableCollection <FileItemViewModel>)sender).ItemPropertyChangedSender; var propertyName = ((ItemObservableCollection <FileItemViewModel>)sender).ItemPropertyChangedEventArgs.PropertyName; if (propertyName == nameof(FileItemViewModel.IsSelected)) { switch (item.Status) { case FileStatus.NotCopied: // Make remote file as to be copied. if (!item.IsAliveRemote) { break; } item.Status = FileStatus.ToBeCopied; break; case FileStatus.ToBeCopied: // Make remote file as not to be copied. item.Status = item.IsAliveLocal ? FileStatus.Copied : FileStatus.NotCopied; break; case FileStatus.Copied: // Load image data from local file. if (!IsCurrentImageVisible || Op.IsCopying) { break; } await Op.LoadSetAsync(item); break; } } else if (propertyName == nameof(FileItemViewModel.Status)) { switch (item.Status) { case FileStatus.ToBeCopied: // Trigger instant copy. if (!Settings.Current.InstantCopy || Op.IsChecking || Op.IsCopying) { break; } await Op.CopyFileAsync(); break; } } }
private async void FileListPropertyChanged(object sender, PropertyChangedEventArgs e) { //Debug.WriteLine("File List property changed: {0} {1}", sender, e.PropertyName); if (e.PropertyName != CaseItemProperty) { return; } var item = ((FileItemViewModelCollection)sender).ItemPropertyChangedSender; var propertyName = ((FileItemViewModelCollection)sender).ItemPropertyChangedEventArgs.PropertyName; //Debug.WriteLine(String.Format("ItemPropartyChanegd: {0} {1}", item.FileName, propertyName)); if (CaseFileStatus == propertyName) { switch (item.Status) { case FileStatus.NotCopied: // Make remote file as to be copied. if (!item.IsAliveRemote) { return; } item.Status = FileStatus.ToBeCopied; break; case FileStatus.ToBeCopied: // Make remote file as not to be copied. item.Status = item.IsAliveLocal ? FileStatus.Copied : FileStatus.NotCopied; break; case FileStatus.Copied: // Load image data from local file. if (!IsCurrentImageVisible || Op.IsCopying) { return; } await Op.LoadSetFileAsync(item); break; } } else if (CaseInstantCopy == propertyName) { if ((item.Status != FileStatus.ToBeCopied) || Op.IsChecking || Op.IsCopying || !Settings.Current.InstantCopy) { return; } await Op.CopyFileAsync(); } }
private async void CopyExecute() => await Op.CopyFileAsync();