Пример #1
0
 public void Handle(VideoFileOperationCoroutine message)
 {
     if (!desiredFileOperationsStack.Contains(message) && message.DesiredFileAction == AcceptableFileAction)
     {
         desiredFileOperationsStack.Add(message.Register(desiredFileOperationsStack));
         FindAcceptingFolder(message);
     }
 }
Пример #2
0
 public void Handle(VideoFileOperationCoroutine message)
 {
     if (!fileOperationsStack.Contains(message) && message.DesiredFileAction != VideoArchiveAction.NoAction)
     {
         fileOperationsStack.Add(message.Register(fileOperationsStack));
     }
     //Items.SelectMany(sg => sg.VideoFileTree).Cast<VideoFileStorageDevice>()
     //    .Apply(sd => sd.AvailableFreeSpace = sd.StorageDevice.AvailableFreeSpace
     //        + fileOperationsStack.Where(op => (op.AcceptedFileAction == VideoArchiveAction.ToArchive || op.AcceptedFileAction == VideoArchiveAction.ToPrelimArchive) && op.BaseFile.ParentFolder.StorageDevice.FolderPath == sd.SeriesDirectoryAsPath).Sum(op => op.ByteVolume)
     //        - fileOperationsStack.Where(op => (op.AcceptedFileAction == VideoArchiveAction.ToArchive || op.AcceptedFileAction == VideoArchiveAction.ToPrelimArchive || op.AcceptedFileAction == VideoArchiveAction.TransferCopy) && op.DestinationSeriesFolder.StorageDevice.FolderPath == sd.SeriesDirectoryAsPath).Sum(op => op.ByteVolume));
 }
Пример #3
0
        /// <summary>
        /// Determines whether this instance can shutdown based on the evaluated shutdown model.
        /// </summary>
        /// <param name="shutdownModel">The shutdown model.</param>
        /// <returns>
        ///     <c>true</c> if this instance can shutdown; otherwise, <c>false</c>.
        /// </returns>
        bool ISupportCustomShutdown.CanShutdown(ISubordinate shutdownModel)
        {
            var  subordinateGroup   = (SubordinateGroup)shutdownModel;
            var  presentersToRemove = new List <IPresenter>();
            bool result             = true;

            foreach (var presenter in _presenters)
            {
                var match = (from child in subordinateGroup
                             where child.Master == presenter
                             select child).FirstOrDefault();

                if (match == null)
                {
                    if (presenter.CanShutdown())
                    {
                        presentersToRemove.Add(presenter);
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    var custom      = (ISupportCustomShutdown)presenter;
                    var canShutdown = custom.CanShutdown(match);

                    if (canShutdown)
                    {
                        presentersToRemove.Add(presenter);
                    }
                    else
                    {
                        result = false;
                    }
                }
            }

            FinalizeShutdown(result, presentersToRemove);

            if (_currentPresenter == null || !_presenters.Contains(_currentPresenter))
            {
                if (_presenters.Count > 0)
                {
                    _presenters[0].Activate();
                    ChangeCurrentPresenterCore(_presenters[0]);
                }
            }

            return(result);
        }
Пример #4
0
        public void Toggle(T item)
        {
            var wasSelected = _selectedItems.Contains(item);

            if (wasSelected)
            {
                _selectedItems.Delete(item);
            }
            else
            {
                _selectedItems.InsertAt(0, item);
            }
        }
Пример #5
0
 /// <summary>
 /// Adds a collection of assemblies to AssemblySource
 /// </summary>
 /// <param name="assemblies">The assemblies to add</param>
 public static void AddRange(IEnumerable <Assembly> assemblies)
 {
     foreach (var assembly in assemblies)
     {
         try
         {
             if (!Instance.Contains(assembly))
             {
                 Instance.Add(assembly);
             }
         }
         catch (ArgumentException)
         {
             // ignore
         }
     }
 }
Пример #6
0
 public bool Contains(T item)
 {
     return(collection.Contains(item));
 }
Пример #7
0
 public bool Contains(TGlyphData item) => _collectionImplementation.Contains(item);
 /// <summary>
 /// Verifica se o item informado existe na coleção.
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public bool Contains(T item)
 {
     return(_source.Contains(item));
 }