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


C# Activity类代码示例

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


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


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