Ejemplo n.º 1
0
 private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     Save();
     _removeCompletedCommand?.RaiseCanExecuteChanged();
     _removeAllCommand?.RaiseCanExecuteChanged();
     _installAllCommand?.RaiseCanExecuteChanged();
     HasMoreThanOneWaiting = DownloadList.Count(x => x.State == ContentInstallationEntryState.WaitingForConfirmation) > 1;
 }
Ejemplo n.º 2
0
        private void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case nameof(ContentInstallationEntry.Cancelled):
            case nameof(ContentInstallationEntry.DisplayName):
            case nameof(ContentInstallationEntry.FailedCommentary):
            case nameof(ContentInstallationEntry.FailedMessage):
            case nameof(ContentInstallationEntry.FileName):
            case nameof(ContentInstallationEntry.InformationUrl):
            case nameof(ContentInstallationEntry.InputPassword):
            case nameof(ContentInstallationEntry.IsCancelling):
            case nameof(ContentInstallationEntry.IsPaused):
            case nameof(ContentInstallationEntry.LocalFilename):
            case nameof(ContentInstallationEntry.Version):
                Save();
                break;

            case nameof(ContentInstallationEntry.State):
                Save();
                _removeCompletedCommand?.RaiseCanExecuteChanged();
                _installAllCommand?.RaiseCanExecuteChanged();
                HasMoreThanOneWaiting = DownloadList.Count(x => x.State == ContentInstallationEntryState.WaitingForConfirmation) > 1;
                break;

            case nameof(ContentInstallationEntry.IsDeleted):
                // No reason to save here, list will be changed as well
                if (sender is ContentInstallationEntry deletedEntry)
                {
                    DownloadList.Remove(deletedEntry);
                }
                break;

            case nameof(ContentInstallationEntry.RestartFrom):
                // No reason to save here, list will be changed as well
                if (sender is ContentInstallationEntry restartedEntry)
                {
                    _taskCache.ForceRemove <bool>(restartedEntry.RestartFrom);
                    InstallAsync(restartedEntry.RestartFrom, restartedEntry.InstallationParams);
                }
                break;
            }
        }