Ejemplo n.º 1
0
        private DatasetProxy CreateNewDatasetProxy(DatasetCreationInformation newChild)
        {
            var id = new DatasetId();
            Action <DatasetId> cleanupAction = localId => DeleteDatasetAndChildren(localId, d => { });
            var parameters = new DatasetConstructionParameters
            {
                Id    = id,
                Owner = this,
                DistributionPlanGenerator = m_DatasetDistributor,
                CreatedOnRequestOf        = newChild.CreatedOnRequestOf,
                CanBecomeParent           = newChild.CanBecomeParent,
                CanBeAdopted = newChild.CanBeAdopted,
                CanBeCopied  = newChild.CanBeCopied,
                CanBeDeleted = newChild.CanBeDeleted,
                IsRoot       = newChild.IsRoot,
                LoadFrom     = newChild.LoadFrom,
                OnRemoval    = cleanupAction,
            };

            var newDataset = m_Timeline.AddToTimeline(
                DatasetProxy.CreateInstance,
                parameters,
                m_DataStorageProxyBuilder,
                m_Notifications,
                m_Diagnostics);

            return(newDataset);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetProxy"/> class.
        /// </summary>
        /// <param name="constructorArgs">The object that holds all the constructor arguments that do not belong to the timeline.</param>
        /// <param name="proxyBuilder">The function that is used to create the proxy for the data inside the dataset.</param>
        /// <param name="notifications">The object that stores the notifications for the user interface.</param>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <param name="historyId">The ID for use in the history system.</param>
        /// <param name="name">The data structure that stores the history information for the name of the dataset.</param>
        /// <param name="summary">The data structure that stores the history information for the summary of the dataset.</param>
        /// <param name="distributionLocation">
        /// The data structure that stores the history information indicating if the dataset is activated at any point.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="constructorArgs"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="proxyBuilder"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="notifications"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="historyId"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="name"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="summary"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="distributionLocation"/> is <see langword="null" />.
        /// </exception>
        private DatasetProxy(
            DatasetConstructionParameters constructorArgs,
            Func <DatasetOnlineInformation, DatasetStorageProxy> proxyBuilder,
            ICollectNotifications notifications,
            SystemDiagnostics diagnostics,
            HistoryId historyId,
            IVariableTimeline <string> name,
            IVariableTimeline <string> summary,
            IVariableTimeline <NetworkIdentifier> distributionLocation)
        {
            {
                Lokad.Enforce.Argument(() => constructorArgs);
                Lokad.Enforce.Argument(() => proxyBuilder);
                Lokad.Enforce.Argument(() => notifications);
                Lokad.Enforce.Argument(() => diagnostics);
                Lokad.Enforce.Argument(() => historyId);
                Lokad.Enforce.Argument(() => name);
                Lokad.Enforce.Argument(() => summary);
                Lokad.Enforce.Argument(() => distributionLocation);
            }

            m_ConstructorArgs      = constructorArgs;
            m_ProxyBuilder         = proxyBuilder;
            m_Notifications        = notifications;
            m_Diagnostics          = diagnostics;
            m_HistoryId            = historyId;
            m_Name                 = name;
            m_Summary              = summary;
            m_DistributionLocation = distributionLocation;

            m_Name.OnExternalValueUpdate    += HandleOnNameUpdate;
            m_Summary.OnExternalValueUpdate += HandleOnSummaryUpdate;
            m_DistributionLocation.OnExternalValueUpdate += HandleOnIsActivatedUpdate;
        }
Ejemplo n.º 3
0
        private DatasetProxy CreateNewDatasetProxy(DatasetCreationInformation newChild)
        {
            var id = new DatasetId();
            Action<DatasetId> cleanupAction = localId => DeleteDatasetAndChildren(localId, d => { });
            var parameters = new DatasetConstructionParameters
                {
                    Id = id,
                    Owner = this,
                    DistributionPlanGenerator = m_DatasetDistributor,
                    CreatedOnRequestOf = newChild.CreatedOnRequestOf,
                    CanBecomeParent = newChild.CanBecomeParent,
                    CanBeAdopted = newChild.CanBeAdopted,
                    CanBeCopied = newChild.CanBeCopied,
                    CanBeDeleted = newChild.CanBeDeleted,
                    IsRoot = newChild.IsRoot,
                    LoadFrom = newChild.LoadFrom,
                    OnRemoval = cleanupAction,
                };

            var newDataset = m_Timeline.AddToTimeline(
                DatasetProxy.CreateInstance,
                parameters,
                m_DataStorageProxyBuilder,
                m_Notifications,
                m_Diagnostics);

            return newDataset;
        }