private void AddContainerToList(CloudBlobContainer container)
 {
     if (!ContainerList.Any(x => x.Name.Equals(container.Name)))
     {
         Log.Info($"adding container to list:{container.Name}", ConsoleColor.Green);
         ContainerList.Add(container);
     }
 }
    public Container <T> Redo()
    {
        var element = GetLast(redoList);

        undoList.Add(element);
        redoList.Remove(element);

        return(element);
    }
        private void InnerAdd <TFact>(TFact fact, IEqualityComparer <IFact> comparer) where TFact : IFact
        {
            IFactType factType = fact.GetFactType();

            if (ContainerList.Contains(fact, comparer))
            {
                throw CommonHelper.CreateException(ErrorCode.InvalidData, $"The fact container already contains '{factType.FactName}' fact.");
            }

            ContainerList.Add(fact);
        }
        /// <summary>
        /// Resolve the <see cref="ContainerList{T}"/> from a <see cref="IEnumerable{Guid}"/> that represent the ids of the contained <see cref="Thing"/>s
        /// </summary>
        /// <typeparam name="T">The type of <see cref="Thing"/></typeparam>
        /// <param name="list">The <see cref="ContainerList{T}"/> to resolve</param>
        /// <param name="guidList">The source <see cref="IEnumerable{Guid}"/></param>
        /// <param name="iterationId">The potential <see cref="Iteration"/> container id of the contained <see cref="Thing"/>s</param>
        /// <param name="cache">The cache that stores the <see cref="Thing"/>s</param>
        internal static void ResolveList <T>(this ContainerList <T> list, IEnumerable <Guid> guidList, Guid?iterationId, ConcurrentDictionary <CacheKey, Lazy <CommonData.Thing> > cache) where T : Thing
        {
            list.Clear();

            foreach (var guid in guidList)
            {
                if (cache.TryGet(guid, iterationId, out T thing))
                {
                    thing.ChangeKind = ChangeKind.None;
                    list.Add(thing);
                }
            }
        }
示例#5
0
        /// <summary>
        /// Create the container if not exists
        /// </summary>
        /// <param name="container">A cloudblobcontainer object</param>
        /// <param name="options">Blob request option</param>
        /// <param name="operationContext">Operation context</param>
        /// <returns>True if the container did not already exist and was created; otherwise false.</returns>
        public bool CreateContainerIfNotExists(CloudBlobContainer container, BlobRequestOptions requestOptions = null, OperationContext operationContext = null)
        {
            CloudBlobContainer containerRef = GetContainerReference(container.Name);

            if (DoesContainerExist(containerRef, requestOptions, operationContext))
            {
                return(false);
            }
            else
            {
                containerRef = GetContainerReference(container.Name);
                ContainerList.Add(containerRef);
                return(true);
            }
        }
        private void AddContainerToList(TreeNode tNode)
        {
            var contI = new ContainerInfo
            {
                TreeNode = tNode,
                Name     = Convert.ToString(_sqlDataReader["Name"])
            };

            var conI = GetConnectionInfoFromSql();

            conI.Parent      = contI;
            conI.IsContainer = true;
            contI.CopyFrom(conI);

            if (DatabaseUpdate)
            {
                var prevCont = PreviousContainerList.FindByConstantID(conI.ConstantID);
                if (prevCont != null)
                {
                    contI.IsExpanded = prevCont.IsExpanded;
                }

                if (conI.ConstantID == PreviousSelected)
                {
                    _selectedTreeNode = tNode;
                }
            }
            else
            {
                contI.IsExpanded = Convert.ToBoolean(_sqlDataReader["Expanded"]);
            }

            ContainerList.Add(contI);
            ConnectionList.Add(conI);
            tNode.Tag                = contI;
            tNode.ImageIndex         = (int)TreeImageType.Container;
            tNode.SelectedImageIndex = (int)TreeImageType.Container;
        }