当前位置: 首页>>代码示例>>C#>>正文


C# ITimeProvider.GetUtcNow方法代码示例

本文整理汇总了C#中ITimeProvider.GetUtcNow方法的典型用法代码示例。如果您正苦于以下问题:C# ITimeProvider.GetUtcNow方法的具体用法?C# ITimeProvider.GetUtcNow怎么用?C# ITimeProvider.GetUtcNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITimeProvider的用法示例。


在下文中一共展示了ITimeProvider.GetUtcNow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddPlannedWorkgroup

        public void AddPlannedWorkgroup(DrillingDepartmentId id, RequestId requestId, WorkgroupEntity we, ITimeProvider provider)
        {
            // Create the Planned Workgroup
            DoWork("Create a Planned Workgroup and add to the Drilling Department Structure");

            RecordAndRealizeThat(new PlannedWorkgroupAddedToDepartment(id, requestId, we, provider.GetUtcNow()));
        }
开发者ID:11646729,项目名称:iSeismic,代码行数:7,代码来源:DrillingDepartmentAggregate.cs

示例2: DefineProject

        public void DefineProject(Guid requestId, string name, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();
            var id = new ProjectId(NewGuidIfEmpty(requestId));

            Apply(new ProjectDefined(_state.Id, id, name, time));
        }
开发者ID:jcwrequests,项目名称:btw-gtd,代码行数:8,代码来源:TenantAggregate.cs

示例3: DefineAction

        public void DefineAction(Guid requestId, string actionName, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();
            var id = new ActionId(NewGuidIfEmpty(requestId));

            Apply(new ActionDefined(_state.Id, id, actionName, time));
        }
开发者ID:jcwrequests,项目名称:btw-gtd,代码行数:8,代码来源:TenantAggregate.cs

示例4: ArchiveAction

 public void ArchiveAction(ActionId actionId, ITimeProvider time)
 {
     var action = GetActionOrThrow(actionId);
     if (!action.Archived)
     {
         Apply(new ActionArchived(_aggState.Id, actionId, action.Project, time.GetUtcNow()));
     }
 }
开发者ID:beingtheworst,项目名称:btw-gtd,代码行数:8,代码来源:TrustedSystemAggregate.cs

示例5: AssignPlannedMetricsToDrillWorkunits

 public void AssignPlannedMetricsToDrillWorkunits(DrillingDepartmentId id, ITimeProvider provider, string testtext)
 {
     // Check if Drilling Department has already been opened
     // Check if Planned Structure has already been imported
     // TODO - Check if Planned Resources have already been imported into Drilling Department
     // Check if Planned Metrics have already been imported
     // Add the Metrics to the Drilling Department
     // Issue PlannedMetricsAssignedToDrillWorkunits event
     RecordAndRealizeThat(new PlannedMetricsAssignedToDrillWorkunits(id, new RequestId(), provider.GetUtcNow()));
 }
开发者ID:11646729,项目名称:iSeismic,代码行数:10,代码来源:DrillingDepartmentAggregate.cs

示例6: CaptureInboxEntry

        public void CaptureInboxEntry(Guid requestId, string name, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();
            var id = new ActionId(NewGuidIfEmpty(requestId));

            Apply(new InboxEntryCaptured(_state.Id, requestId, name));

            //Apply(new ActionCaptured(_state.Id, id, name, time));
        }
开发者ID:jcwrequests,项目名称:btw-gtd,代码行数:10,代码来源:TenantAggregate.cs

示例7: ChangeDescriptionOfStuff

 public void ChangeDescriptionOfStuff(StuffId stuffId, string newDescriptionOfStuff, ITimeProvider time)
 {
     StuffInfo stuffInfo;
     if (!_aggState.StuffInInbox.TryGetValue(stuffId, out stuffInfo))
     {
         throw DomainError.Named("unknown stuff", "Unknown stuff {0}", stuffId);
     }
     if (stuffInfo.Description != newDescriptionOfStuff)
     {
         Apply(new StuffDescriptionChanged(_aggState.Id, stuffId, newDescriptionOfStuff, time.GetUtcNow()));
     }
 }
开发者ID:beingtheworst,项目名称:btw-gtd,代码行数:12,代码来源:TrustedSystemAggregate.cs

示例8: ChangeActionOutcome

 public void ChangeActionOutcome(ActionId actionId, string outcome, ITimeProvider time)
 {
     ActionInfo actionInfo;
     if (!_aggState.Actions.TryGetValue(actionId, out actionInfo))
     {
         throw DomainError.Named("unknown action", "Unknown action {0}", actionId);
     }
     if (actionInfo.Outcome != outcome)
     {
         Apply(new ActionOutcomeChanged(_aggState.Id, actionId, actionInfo.Project, outcome, time.GetUtcNow()));
     }
 }
开发者ID:beingtheworst,项目名称:btw-gtd,代码行数:12,代码来源:TrustedSystemAggregate.cs

示例9: Initialize

        /// <summary>
        /// Initializes the data feed for the specified job and algorithm
        /// </summary>
        public void Initialize(IAlgorithm algorithm, AlgorithmNodePacket job, IResultHandler resultHandler)
        {
            if (!(job is LiveNodePacket))
            {
                throw new ArgumentException("The LiveTradingDataFeed requires a LiveNodePacket.");
            }

            _cancellationTokenSource = new CancellationTokenSource();

            _algorithm = algorithm;
            _job = (LiveNodePacket) job;
            _resultHandler = resultHandler;
            _timeProvider = GetTimeProvider();
            _dataQueueHandler = GetDataQueueHandler();

            _frontierTimeProvider = new ManualTimeProvider(_timeProvider.GetUtcNow());
            _customExchange = new BaseDataExchange("CustomDataExchange") {SleepInterval = 10};
            // sleep is controlled on this exchange via the GetNextTicksEnumerator
            _exchange = new BaseDataExchange("DataQueueExchange", GetNextTicksEnumerator()){SleepInterval = 0};
            _subscriptions = new ConcurrentDictionary<SymbolSecurityType, Subscription>();

            Bridge = new BusyBlockingCollection<TimeSlice>();

            // run the exchanges
            _exchange.Start();
            _customExchange.Start();

            // find the minimum resolution, ignoring ticks
            _fillForwardResolution = algorithm.SubscriptionManager.Subscriptions
                .Where(x => x.Resolution != Resolution.Tick)
                .Select(x => x.Resolution)
                .Union(algorithm.Universes.Select(x => x.SubscriptionSettings.Resolution))
                .DefaultIfEmpty(algorithm.UniverseSettings.Resolution)
                .Min();

            // add user defined subscriptions
            var start = _timeProvider.GetUtcNow();
            foreach (var kvp in _algorithm.Securities.OrderBy(x => x.Key.ToString()))
            {
                var security = kvp.Value;
                AddSubscription(security, start, Time.EndOfTime, true);
            }

            // add universe subscriptions
            foreach (var universe in _algorithm.Universes)
            {
                var subscription = CreateUniverseSubscription(universe, start, Time.EndOfTime);
                _subscriptions[new SymbolSecurityType(subscription)] = subscription;
            }
        }
开发者ID:reinhardtken,项目名称:Lean,代码行数:53,代码来源:LiveTradingDataFeed.cs

示例10: TrashStuff

        // Trash vs. Archives
        // Archiving is an internal housekeeping process.
        // It is an event that happens within the system as a result of another user command.
        // A user doesn't "Archive" something, the system does.
        // A user Trashes stuff, puts stuff in their ReferenceSystem, Puts stuff In SomedayMaybe, MovesToProject, etc.
        // If a user Moves Stuff from the Inbox to a Project, then StuffArchived from Inbox, not StuffTrashed.
        // If a user wants to "View Archives" then things that were Archived by the system appear in that View.
        // However, if a user expressed their intent to TRASH an item, it is NOT in the "Archived Views".
        // The trashed stuff is still in the Event Stream, but from the user's perspective, it is GONE/TRASHED/Not visible!
        // This Event happens when Stuff is intentionally "trashed" by the user because they want it "out" of the system
        public void TrashStuff(StuffId stuffId, ITimeProvider provider)
        {
            if (!_aggState.Inbox.Contains(stuffId))
                throw DomainError.Named("no stuff", "Stuff with Id {0} not found", stuffId.Id);

            Apply(new StuffTrashed(_aggState.Id, stuffId, provider.GetUtcNow()));
        }
开发者ID:beingtheworst,项目名称:btw-gtd,代码行数:17,代码来源:TrustedSystemAggregate.cs

示例11: PutStuffInInbox

 public void PutStuffInInbox(RequestId requestId, string stuffDescription, ITimeProvider provider)
 {
     var stuffId = new StuffId(NewGuidIfEmpty(requestId));
     Apply(new StuffPutInInbox(_aggState.Id, stuffId, stuffDescription, provider.GetUtcNow()));
 }
开发者ID:beingtheworst,项目名称:btw-gtd,代码行数:5,代码来源:TrustedSystemAggregate.cs

示例12: MoveStuffToProject

        public void MoveStuffToProject(IEnumerable<StuffId> stuffToMove, ProjectId projectId, ITimeProvider provider)
        {
            GetProjectOrThrow(projectId);
            var dateTime = provider.GetUtcNow();
            foreach (var stuffId in stuffToMove)
            {
                StuffInfo stuffInfo;
                if (!_aggState.StuffInInbox.TryGetValue(stuffId, out stuffInfo))
                {
                    throw DomainError.Named("unknown-stuff", "Unknown stuff {0}", stuffId);
                }

                Apply(new StuffArchived(_aggState.Id, stuffId, dateTime));
                Apply(new ActionDefined(_aggState.Id,new ActionId(Guid.NewGuid()), projectId, stuffInfo.Description, dateTime));
            }
        }
开发者ID:beingtheworst,项目名称:btw-gtd,代码行数:16,代码来源:TrustedSystemAggregate.cs

示例13: DefineSingleActionProject

        public void DefineSingleActionProject(RequestId requestId, StuffId stuffId, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();
            var projectId = new ProjectId(NewGuidIfEmpty(requestId));

            // generate actionId
            var actionId = new ActionId(Guid.NewGuid());

            // make sure Stuff exists in the Inbox
            StuffInfo stuffInfo;
            if (!_aggState.StuffInInbox.TryGetValue(stuffId, out stuffInfo))
            {
                throw DomainError.Named("unknown stuff", "Unknown stuff {0}", stuffId);
            }
            // TODO: May be able to use this to change the stuff description and then let that cascade down
            // as both the Project AND Action Outcome in case you wanted to use a different name than from original desc
            // With current design it may be better to kick off a "RENAME" command or Apply Renamed event for that purpose though.
            //if (stuffInfo.Description != stuffDescription)
            //{
            //    Apply(new StuffDescriptionChanged(_aggState.Id, stuffId, newDescriptionOfStuff, time.GetUtcNow()));
            //}

            // TODO: Not sure if it best to just reuse existing Events and projections (probably)
            // or if I should create a new composite event for this new command msg.
            // Thinking the former, not latter is way to go.
            Apply(new ProjectDefined(_aggState.Id, projectId, stuffInfo.Description, ProjectType.List, time));
            Apply(new ActionDefined(_aggState.Id, actionId, projectId, stuffInfo.Description, time));
            //Apply(new SingleActionProjectDefined(_aggState.Id, etc.)

            // Archive the Stuff from the Inbox now that is has transitioned from "Stuff" to a defined "Action"
            Apply(new StuffArchived(_aggState.Id, stuffId, time));
        }
开发者ID:beingtheworst,项目名称:btw-gtd,代码行数:33,代码来源:TrustedSystemAggregate.cs

示例14: DefineProject

        // This Event happens when Stuff is moved from the Inbox to another part of the system
        // TODO: Not sure if I need a method for a Command to call because StuffArchived Event is system generated.
        //public void ArchiveStuff(StuffId stuffId, ITimeProvider provider)
        //{
        //    if (!_aggState.Inbox.Contains(stuffId))
        //        throw DomainError.Named("no stuff", "Stuff with Id {0} not found", stuffId);
        //    Apply(new StuffArchived(_aggState.Id, stuffId, provider.GetUtcNow()));
        //}
        public void DefineProject(RequestId requestId, string name, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();
            var projectId = new ProjectId(NewGuidIfEmpty(requestId));

            const ProjectType defaultProjectType = ProjectType.List;
            Apply(new ProjectDefined(_aggState.Id, projectId, name, defaultProjectType, time));
        }
开发者ID:beingtheworst,项目名称:btw-gtd,代码行数:17,代码来源:TrustedSystemAggregate.cs

示例15: ChangeWorkgroupName

 public void ChangeWorkgroupName(DrillingDepartmentId id, RequestId requestId, string newName, ITimeProvider provider)
 {
     RecordAndRealizeThat(new WorkgroupNameChanged(id, requestId, newName, provider.GetUtcNow()));
 }
开发者ID:11646729,项目名称:iSeismic,代码行数:4,代码来源:DrillingDepartmentAggregate.cs


注:本文中的ITimeProvider.GetUtcNow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。