• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Activity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Activity的典型用法代码示例。如果您正苦于以下问题:C# Activity类的具体用法?C# Activity怎么用?C# Activity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Activity类属于命名空间,在下文中一共展示了Activity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RequestTransport

		public void RequestTransport(CPos destination, Activity afterLandActivity)
		{
			var destPos = self.World.Map.CenterOfCell(destination);
			if (destination == CPos.Zero || (self.CenterPosition - destPos).LengthSquared < info.MinDistance.LengthSquared)
			{
				WantsTransport = false; // Be sure to cancel any pending transports
				return;
			}

			Destination = destination;
			this.afterLandActivity = afterLandActivity;
			WantsTransport = true;

			if (locked || Reserved)
				return;

			// Inform all idle carriers
			var carriers = self.World.ActorsWithTrait<Carryall>()
				.Where(c => !c.Trait.IsBusy && !c.Actor.IsDead && c.Actor.Owner == self.Owner && c.Actor.IsInWorld)
				.OrderBy(p => (self.Location - p.Actor.Location).LengthSquared);

			// Is any carrier able to transport the actor?
			// Any will return once it finds a carrier that returns true.
			carriers.Any(carrier => carrier.Trait.RequestTransportNotify(self));
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:25,代码来源:Carryable.cs


示例2: Tick

        public override Activity Tick(Actor self)
        {
            if (!target.IsValidFor(self))
                return NextActivity;

            // Move to the next activity only if all ammo pools are depleted and none reload automatically
            // TODO: This should check whether there is ammo left that is actually suitable for the target
            if (ammoPools.All(x => !x.Info.SelfReloads && !x.HasAmmo()))
                return NextActivity;

            if (attackPlane != null)
                attackPlane.DoAttack(self, target);

            if (inner == null)
            {
                if (IsCanceled)
                    return NextActivity;

                // TODO: This should fire each weapon at its maximum range
                if (attackPlane != null && target.IsInRange(self.CenterPosition, attackPlane.Armaments.Select(a => a.Weapon.MinRange).Min()))
                    inner = ActivityUtils.SequenceActivities(new FlyTimed(ticksUntilTurn, self), new Fly(self, target), new FlyTimed(ticksUntilTurn, self));
                else
                    inner = ActivityUtils.SequenceActivities(new Fly(self, target), new FlyTimed(ticksUntilTurn, self));
            }

            inner = ActivityUtils.RunActivity(self, inner);

            return this;
        }
开发者ID:cjshmyr,项目名称:OpenRA,代码行数:29,代码来源:FlyAttack.cs


示例3: addActivity

 public void addActivity(Activity act)
 {
     if(LstActivity.Count() < Parameter.DIX)
         LstActivity.Add(act);
     else
         System.Console.Write("Le nombre maximum d'activités est déjà atteint");
 }
开发者ID:ghislainm,项目名称:env-dev-logiciel,代码行数:7,代码来源:Pupil.cs


示例4: Cancelled

        public ActivityGroup Cancelled(SingleActivity next)
        {
            if (next == null) throw new ArgumentNullException("next");

            OnCancel = next;
            return this;
        }
开发者ID:inprotech-dev,项目名称:dependable,代码行数:7,代码来源:ActivityGroup.cs


示例5: CreateOrUpdateActivity

        static Activity CreateOrUpdateActivity(Activity activity, string packageName)
        {
            Console.WriteLine("Creating/Updating Activity...");
            bool newlyCreated = false;
            if (activity == null)
            {
                activity = new Activity() { Id = ActivityName };
                newlyCreated = true;
            }

            activity.Instruction = new Instruction()
            {
                Script = "_test\n"
            };
            activity.Parameters = new Parameters()
            {
                InputParameters = {
                        new Parameter() { Name = "HostDwg", LocalFileName = "$(HostDwg)" },
                        new Parameter() { Name = "ProductDb", LocalFileName="dummy.txt"}
                    },
                OutputParameters = { new Parameter() { Name = "Result", LocalFileName = "result.pdf" } }
            };
            activity.RequiredEngineVersion = "20.1";
            if (newlyCreated)
            {
                activity.AppPackages.Add(packageName); // reference the custom AppPackage
                container.AddToActivities(activity);
            }
            else
                container.UpdateObject(activity);
            container.SaveChanges();
            return activity;
        }
开发者ID:szilvaa,项目名称:variadic,代码行数:33,代码来源:Program.cs


示例6: Queue

 public virtual void Queue(Activity activity)
 {
     if (NextActivity != null)
         NextActivity.Queue(activity);
     else
         NextActivity = activity;
 }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:7,代码来源:Activity.cs


示例7: AddActivity

 public void AddActivity(Activity activ)
 {
     if (LstActivities.Count <= Parameter.MAX_ACTIVITY)
     {
         LstActivities.Add(activ);
     }
 }
开发者ID:slimk93,项目名称:sourceCsharp,代码行数:7,代码来源:Pupil.cs


示例8: GetFrequency

 public static int GetFrequency(ITashaPerson person, Activity activity, Random random, int maxFrequency, int householdPD, int workPD, GenerationAdjustment[] generationAdjustments)
 {
     int freq = 0;
     freq = Distribution.GetRandomFrequencyValue(
         0, maxFrequency, random, Distribution.GetDistributionID(person, activity), householdPD, workPD, generationAdjustments);
     return freq;
 }
开发者ID:dianatle,项目名称:XTMF,代码行数:7,代码来源:TimeTable.cs


示例9: Add

        public void Add(Activity value)
        {
            if (value.Created == null || value.ChallengeID == 0)
                return;

            if (value.RowKey == null)
                value.RowKey = value.Created.ToString();

            if (value.PartitionKey == null)
                value.PartitionKey = "Chal" + value.ChallengeID.ToString();

            context.AttachTo(TableName, value, null);
            context.UpdateObject(value);

            context.SaveChangesWithRetries();
            context.Detach(value);

            /*
            try
            {
                using (var redisClient = GetRedisClient())
                {
                    IRedisTypedClient<Activity> redis = redisClient.As<Activity>();
                    redis.SetEntry(this.RedisKeyForLatestActivity(value.ChallengeID), value);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Trace.WriteLine("Activity repo exception: " + e.ToString());
            } */
        }
开发者ID:mchambers,项目名称:howmuchto-service,代码行数:31,代码来源:ActivityRepository.cs


示例10: InsertActivityLogTest

        public void InsertActivityLogTest()
        {
            var log = new Activity(DateTime.Now, "Test", "Test Activity");

            repository.Insert(log, "Contact", 1);
            Assert.IsNotNull(log.Id);
        }
开发者ID:robgray,项目名称:Tucana,代码行数:7,代码来源:ActivityLogRepositoryTests.cs


示例11: NewActivity

 public static Activity NewActivity(this IActivityRepository activityRepository, byte[] streamId, int pattern)
 {
     var id = Encoding.UTF8.GetBytes($"activity_{pattern}");
     var activity = new Activity(streamId, id, new TestActivityBody($"body_{pattern}"), $"author_{pattern}", new DateTime(2000, 1, pattern));
     activityRepository.Append(activity);
     return activity;
 }
开发者ID:SayliS,项目名称:ActivityStreams,代码行数:7,代码来源:Class1.cs


示例12: benchmarkSystem_JobTerminated

 static void benchmarkSystem_JobTerminated(object sender, JobEventArgs e)
 {
     Activity ac = new Activity(e.job, Job.JobState.Succesfull, System.DateTime.Now.Ticks);
       BenchmarkSystem.db.Activities.Add(ac);
       BenchmarkSystem.db.SaveChanges();
       Console.WriteLine("Job Terminated: " + e.job);
 }
开发者ID:ButterFree,项目名称:AS38,代码行数:7,代码来源:Logger.cs


示例13: benchmarkSystem_JobRemoved

 static void benchmarkSystem_JobRemoved(object sender, JobEventArgs e)
 {
     Activity ac = new Activity(e.job, Job.JobState.Failed, System.DateTime.Now.Ticks);
       BenchmarkSystem.db.Activities.Add(ac);
       BenchmarkSystem.db.SaveChanges();
       Console.WriteLine("Job Cancelled: " + e.job);
 }
开发者ID:ButterFree,项目名称:AS38,代码行数:7,代码来源:Logger.cs


示例14: _GetPerformance

        private static string _GetPerformance(string interval, Activity mg_old, Activity mg_new)
        {
            Activity mg_dif = mg_new - mg_old;
            if (mg_dif.Score > 0 || mg_dif.Rank != 0)
            {
                string result = @"\u{0}:\u ".FormatWith(interval);

                if (mg_dif.Score > 0)
                {
                    result += @"\c03{0}\c score, ".FormatWith(mg_dif.Score);
                }

                if (mg_dif.Rank > 0)
                {
                    result += @"\c3+{0}\c rank{1};".FormatWith(mg_dif.Rank, mg_dif.Rank > 1 ? "s" : string.Empty);
                }
                else if (mg_dif.Rank < 0)
                {
                    result += @"\c4{0}\c rank{1};".FormatWith(mg_dif.Rank, mg_dif.Rank < -1 ? "s" : string.Empty);
                }

                return result.EndsWithI(", ") ? result.Substring(0, result.Length - 2) + ";" : result;
            }
            return null;
        }
开发者ID:alfaproject,项目名称:Supay-Bot,代码行数:25,代码来源:Activity.cs


示例15: GenerateProfileUpdatedActivity

        /// <summary>
        /// Make a profile updated joined activity object from the more generic database activity object
        /// </summary>
        /// <param name="activity"></param>
        /// <returns></returns>
        private ProfileUpdatedActivity GenerateProfileUpdatedActivity(Activity activity)
        {

            var cacheKey = string.Concat(CacheKeys.Activity.StartsWith, "GenerateProfileUpdatedActivity-", activity.GetHashCode());
            return _cacheService.CachePerRequest(cacheKey, () =>
            {
                var dataPairs = ActivityBase.UnpackData(activity);

                if (!dataPairs.ContainsKey(ProfileUpdatedActivity.KeyUserId))
                {
                    // Log the problem then skip
                    _loggingService.Error($"A profile updated activity record with id '{activity.Id}' has no user id in its data.");
                    return null;
                }

                var userId = dataPairs[ProfileUpdatedActivity.KeyUserId];
                var user = _context.MembershipUser.FirstOrDefault(x => x.Id == new Guid(userId));

                if (user == null)
                {
                    // Log the problem then skip
                    _loggingService.Error($"A profile updated activity record with id '{activity.Id}' has a user id '{userId}' that is not found in the user table.");
                    return null;
                }

                return new ProfileUpdatedActivity(activity, user);
            });

        }
开发者ID:lenwen,项目名称:mvcforum,代码行数:34,代码来源:ActivityService.cs


示例16: GetMatch

        public Activity GetMatch(Activity updatedChild)
        {
            this.ThrowIfDisposed();

            if (updatedChild != null)
            {
                Activity result = this.matcher.GetMatch(updatedChild);
                if (updatedChild.MemberOf == this.targetActivity.MemberOf)
                {
                    return result;
                }
                else if (result != null)
                {
                    // GetMatch checks that the activities have the same relationship to declaring parent.
                    // But for referenced children, we also need to check whether they have the same relationship 
                    // to referencing parent.
                    // In case of multiple references from the same parent, we'll compare the first one we find.
                    bool updatedIsImport;
                    bool updatedIsReferenced = IsChild(this.TargetActivity, updatedChild, out updatedIsImport);
                    bool updatedIsDelegate = updatedChild.HandlerOf != null;

                    bool originalIsImport;
                    bool originalIsReferenced = IsChild(GetMatch(this.TargetActivity), result, out originalIsImport);
                    bool originalIsDelegate = result.HandlerOf != null;

                    if (updatedIsReferenced && originalIsReferenced && updatedIsImport == originalIsImport && updatedIsDelegate == originalIsDelegate)
                    {
                        return result;
                    }
                }
            }
            
            return null;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源:UpdateMapMetadata.cs


示例17: ReplaceParentChainWithSource

        // case 1: StateMachine -> Default expression of StateMachine's variable -> ...
        // case 2: StateMachine -> InternalState -> ...
        public void ReplaceParentChainWithSource(Activity parentActivity, List<object> parentChain)
        {
            Activity lastActivity = parentChain[parentChain.Count - 1] as Activity;
            StateMachine stateMachine = (StateMachine)parentActivity;

            foreach (Variable variable in stateMachine.Variables)
            {
                if (variable != null && variable.Default == lastActivity)
                {
                    parentChain.Add(stateMachine);
                    return;
                }
            }

            if (parentChain.Count > 1)
            {
                // assume lastActivity is InternalState

                // remove InternalState
                parentChain.RemoveAt(parentChain.Count - 1);

                Activity targetActivity = (Activity)parentChain[parentChain.Count - 1];

                // the targetActivity will be available in the path
                parentChain.RemoveAt(parentChain.Count - 1);

                List<object> path = FindRelativePath(stateMachine, targetActivity);

                foreach (object pathObject in path)
                {
                    parentChain.Add(pathObject);
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:36,代码来源:StateMachineValidationErrorSourceLocator.cs


示例18: Initialize

        protected override void Initialize(Activity activity)
        {
            base.Initialize(activity);

            HelpText = DR.GetString(DR.DropExceptionsHere);
            ShowPreview = false;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:ExceptionHandlersDesigner.cs


示例19: TaskCollection

        public TaskCollection(Activity owner)
        {
            Guard.ThrowExceptionIfNull(owner, "owner");

            this.owner = owner;
            this.tasks = new List<Task>();
        }
开发者ID:AnnaVel,项目名称:RecurringTaskScheduler,代码行数:7,代码来源:TaskCollection.cs


示例20: GetFrequency

 public static int GetFrequency(ITashaPerson person, Activity activity, Random random, int maxFrequency)
 {
     int freq = 0;
     freq = Distribution.GetRandomFrequencyValue(
         0, maxFrequency, random, Distribution.GetDistributionID( person, activity ) );
     return freq;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:7,代码来源:TimeTable.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ActivityContext类代码示例发布时间:2022-05-24
下一篇:
C# ActiveUp类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap