private void UpdateActivity(int activityId, ActivityMode activityMode)
        {
            if (activityMode == ActivityMode.Public)
            {
                var view = _viewManager.Get <ICollection <ActivityView> >();
                if (view != null) // if null, could signify that ApplicationStarted build is not yet complete.
                {
                    Rwlock.EnterWriteLock();

                    try
                    {
                        var entity = _entities.Query <Activity>().SingleOrDefault(a => a.RevisionId == activityId);
                        if ((entity != null) &&
                            (entity.Mode == ActivityMode.Public) &&
                            (entity.EditSourceId == null))
                        {
                            var existingActivityView = view.SingleOrDefault(a => a.Id == entity.RevisionId);
                            if (existingActivityView != null)
                            {
                                view.Remove(existingActivityView);
                            }

                            view.Add(new ActivityView(entity));

                            _viewManager.Set <ICollection <ActivityView> >(view);
                        }
                    }
                    finally
                    {
                        Rwlock.ExitWriteLock();
                        Debug.WriteLine(DateTime.Now + " ActivityView update activity complete with " + view.Count + " activities.");
                    }
                }
            }
        }
Example #2
0
 /// <summary>
 /// Constructs a new PInterpolatingActivity that will interpolate between two states
 /// in the order specified by the mode, starting at the given start time and looping
 /// the given number of iterations.
 /// </summary>
 /// <param name="duration">The length of one loop of the activity.</param>
 /// <param name="stepInterval">
 /// The minimum number of milliseconds that this activity should delay between steps.
 /// </param>
 /// <param name="startTime">
 /// The time (relative to <c>PUtil.CurrentTimeMillis()</c>) that
 /// this activity should start.
 /// </param>
 /// <param name="loopCount">
 /// The number of times the activity should reschedule itself.
 /// </param>
 /// <param name="mode">
 /// The mode defines how the activity interpolates between states.
 /// </param>
 public PInterpolatingActivity(long duration, long stepInterval, long startTime, int loopCount, ActivityMode mode) :
     base(duration, stepInterval, startTime)
 {
     this.loopCount = loopCount;
     this.mode      = mode;
     slowInSlowOut  = true;
     firstLoop      = true;
 }
 /// <summary>
 /// Constructs a new PTransformActivity that animate between the source and destination
 /// matrices in the order specified by the mode, looping the given number of iterations.
 /// </summary>
 /// <param name="duration">The length of one loop of the activity.</param>
 /// <param name="stepInterval">
 /// The minimum number of milliseconds that this activity should delay between steps.
 /// </param>
 /// <param name="loopCount">
 /// The number of times the activity should reschedule itself.
 /// </param>
 /// <param name="mode">
 /// Defines how the activity interpolates between states.
 /// </param>
 /// <param name="aTarget">
 /// The object that the activity will be applied to and where the source
 /// state will be taken from.
 /// </param>
 /// <param name="aDestination">The destination matrix.</param>
 public PTransformActivity(long duration, long stepInterval, int loopCount, ActivityMode mode, Target aTarget, PMatrix aDestination) :
     base(duration, stepInterval, loopCount, mode)
 {
     source      = new float[6];
     destination = new float[6];
     target      = aTarget;
     if (aDestination != null)
     {
         destination = aDestination.MatrixReference.Elements;
     }
 }
Example #4
0
 /// <summary>
 /// Constructs a new PTransformActivity that animate between the source and destination
 /// matrices in the order specified by the mode, looping the given number of iterations.
 /// </summary>
 /// <param name="duration">The length of one loop of the activity.</param>
 /// <param name="stepInterval">
 /// The minimum number of milliseconds that this activity should delay between steps.
 /// </param>
 /// <param name="loopCount">
 /// The number of times the activity should reschedule itself.
 /// </param>
 /// <param name="mode">
 /// Defines how the activity interpolates between states.
 /// </param>
 /// <param name="aTarget">
 /// The object that the activity will be applied to and where the source
 /// state will be taken from.
 /// </param>
 /// <param name="aDestination">The destination matrix.</param>
 public PTransformActivity(long duration, long stepInterval, int loopCount, ActivityMode mode, Target aTarget, Matrix aDestination) :
     base(duration, stepInterval, loopCount, mode)
 {
     source      = new float[6];
     destination = new float[6];
     target      = aTarget;
     if (aDestination != null)
     {
         destination = MatrixExtensions.GetElements(aDestination);
     }
 }
Example #5
0
        /// <summary>
        /// Checks to see if an activity has already been set before in this run. If so, it sets the activity to ShowHelp
        /// and outputs an error to the user
        /// </summary>
        /// <param name="activityMode">Requested mode to run.</param>
        /// <returns>Either the requested mode or the ShowHelp mode, if an activity was already set.</returns>
        private static ActivityMode TrySetActivity(ActivityMode activityMode)
        {
            if (_isActivityAlreadySet)
            {
                DisplayErrors(new[] { ResourceStrings.MultipleSwitches });
                return(ActivityMode.ShowHelp);
            }

            _isActivityAlreadySet = true;
            return(activityMode);
        }
Example #6
0
        public Task<GetActivitiesResponse> GetActivities(MembershipType membershipType, long membershipId, long characterId, ActivityMode mode, int? count = null, int? page = null, bool? definitions = null)
        {
            var model = new
            {
                membershipType,
                membershipId,
                characterId,
                mode,
                count,
                page,
                definitions
            };

            return Request<GetActivitiesResponse>(model);
        }
Example #7
0
 internal static IQueryable<Activity> WithMode(this IQueryable<Activity> queryable, ActivityMode mode)
 {
     var modeText = mode.AsSentenceFragment();
     return queryable.Where(
         a =>
         modeText.Equals(a.ModeText, StringComparison.OrdinalIgnoreCase)
     );
 }
 /// <summary>
 /// Constructs a new PPathActivity that will interpolate between multiple states in the
 /// order specified by the mode, transitioning from state to state as specified by the
 /// given knot values and looping the given number of iterations.
 /// </summary>
 /// <param name="duration">The length of the activity.</param>
 /// <param name="stepInterval">
 /// The minimum number of milliseconds that this activity should delay between steps.
 /// </param>
 /// <param name="loopCount">
 /// The number of times the activity should reschedule itself.
 /// </param>
 /// <param name="mode">
 /// The mode defines how the activity interpolates between states.
 /// </param>
 /// <param name="knots">
 /// An array of values between 0 and 1 that indicate when the state transitions should
 /// occur.
 /// </param>
 public PPathActivity(long duration, long stepInterval, int loopCount, ActivityMode mode, float[] knots)
     : base(duration, stepInterval, loopCount, mode)
 {
     Knots = knots;
 }
		/// <summary>
		/// Constructs a new PTransformActivity that animate between the source and destination
		/// matrices in the order specified by the mode, looping the given number of iterations.
		/// </summary>
		/// <param name="duration">The length of one loop of the activity.</param>
		/// <param name="stepInterval">
		/// The minimum number of milliseconds that this activity should delay between steps.
		/// </param>
		/// <param name="loopCount">
		/// The number of times the activity should reschedule itself.
		/// </param>
		/// <param name="mode">
		/// Defines how the activity interpolates between states.
		/// </param>
		/// <param name="aTarget">
		/// The object that the activity will be applied to and where the source
		/// state will be taken from.
		/// </param>
		/// <param name="aDestination">The destination matrix.</param>
		public PTransformActivity(long duration, long stepInterval, int loopCount, ActivityMode mode, Target aTarget, PMatrix aDestination) :
			base(duration, stepInterval, loopCount, mode) {

			source = new float[6];
			destination = new float[6];
			target = aTarget;
			if (aDestination != null) {
				destination = aDestination.MatrixReference.Elements;
			}
		}
Example #10
0
        internal static IQueryable <Activity> WithMode(this IQueryable <Activity> queryable, ActivityMode mode)
        {
            var modeText = mode.AsSentenceFragment();

            return(queryable.Where(
                       a =>
                       modeText.Equals(a.ModeText, StringComparison.OrdinalIgnoreCase)
                       ));
        }
		/// <summary>
		/// Constructs a new PInterpolatingActivity that will interpolate between two states
		/// in the order specified by the mode, starting at the given start time and looping
		/// the given number of iterations.
		/// </summary>
		/// <param name="duration">The length of one loop of the activity.</param>
		/// <param name="stepInterval">
		/// The minimum number of milliseconds that this activity should delay between steps.
		/// </param>
		/// <param name="startTime">
		/// The time (relative to <c>PUtil.CurrentTimeMillis()</c>) that
		/// this activity should start.
		/// </param>
		/// <param name="loopCount">
		/// The number of times the activity should reschedule itself.
		/// </param>
		/// <param name="mode">
		/// The mode defines how the activity interpolates between states.
		/// </param>
		public PInterpolatingActivity(long duration, long stepInterval, long startTime, int loopCount, ActivityMode mode) :
			base(duration, stepInterval, startTime) {
			this.loopCount = loopCount;
			this.mode = mode;
			slowInSlowOut = true;
			firstLoop = true;
		}
 /// <summary>
 /// Constructs a new PColorActivity that animate between the source and destination
 /// colors in the order specified by the mode, looping the given number of iterations.
 /// </summary>
 /// <param name="duration">The length of one loop of the activity.</param>
 /// <param name="stepInterval">
 /// The minimum number of milliseconds that this activity should delay between steps.
 /// </param>
 /// <param name="loopCount">
 /// The number of times the activity should reschedule itself.
 /// </param>
 /// <param name="mode">
 /// Defines how the activity interpolates between states.
 /// </param>
 /// <param name="aTarget">
 /// The object that the activity will be applied to and where the source state
 /// will be taken from.
 /// </param>
 /// <param name="aDestination">The destination color state.</param>
 public PColorActivity(long duration, long stepInterval, int loopCount, ActivityMode mode, Target aTarget, Color aDestination) :
     base(duration, stepInterval, loopCount, mode)
 {
     target      = aTarget;
     destination = aDestination;
 }
        public HttpResponseMessage PutMove(int workCopyActivityId, int originalActivityId, ActivityMode mode)
        {
            if (workCopyActivityId == 0 || originalActivityId == 0)
                return Request.CreateResponse(HttpStatusCode.BadRequest);

            var command = new ReplaceActivity(User, workCopyActivityId, originalActivityId)
            {
                Mode = mode,
            };
            _replaceActivity.Handle(command);

            return Request.CreateResponse(HttpStatusCode.OK);
        }
 /// <summary>
 /// Constructs a new PPositionPathActivity that will move the target through the given
 /// positions in the order specified by the mode, transitioning from position to position
 /// as specified by the given knot values and looping the given number of iterations.
 /// </summary>
 /// <param name="duration">The length of the activity.</param>
 /// <param name="stepInterval">
 /// The minimum number of milliseconds that this activity should delay between steps.
 /// </param>
 /// <param name="loopCount">
 /// The number of times the activity should reschedule itself.
 /// </param>
 /// <param name="mode">
 /// The mode defines how the activity interpolates between states.
 /// </param>
 /// <param name="aTarget">The object that the activity will be applied to.</param>
 /// <param name="knots">
 /// An array of values between 0 and 1 that indicate when the position UsefulThings.WinForms.Transitions should
 /// occur.
 /// </param>
 /// <param name="positions">
 /// The sequence of points that this activity animates through.
 /// </param>
 public PPositionPathActivity(long duration, long stepInterval, int loopCount, ActivityMode mode, Target aTarget, float[] knots, PointF[] positions)
     : base(duration, stepInterval, loopCount, mode, knots)
 {
     target         = aTarget;
     this.positions = positions;
 }
Example #15
0
 /// <summary>
 /// Constructs a new PPathActivity that will interpolate between multiple states in the
 /// order specified by the mode, transitioning from state to state as specified by the
 /// given knot values and looping the given number of iterations.
 /// </summary>
 /// <param name="duration">The length of the activity.</param>
 /// <param name="stepInterval">
 /// The minimum number of milliseconds that this activity should delay between steps.
 /// </param>
 /// <param name="loopCount">
 /// The number of times the activity should reschedule itself.
 /// </param>
 /// <param name="mode">
 /// The mode defines how the activity interpolates between states.
 /// </param>
 /// <param name="knots">
 /// An array of values between 0 and 1 that indicate when the state UsefulThings.WinForms.Transitions should
 /// occur.
 /// </param>
 public PPathActivity(long duration, long stepInterval, int loopCount, ActivityMode mode, float[] knots)
     : base(duration, stepInterval, loopCount, mode)
 {
     Knots = knots;
 }
		/// <summary>
		/// Constructs a new PInterpolatingActivity that will interpolate from the source
		/// state to the destination state, looping the given number of iterations.
		/// </summary>
		/// <param name="duration">The length of one loop of the activity.</param>
		/// <param name="stepInterval">
		/// The minimum number of milliseconds that this activity should delay between steps.
		/// </param>
		/// <param name="loopCount">
		/// The number of times the activity should reschedule itself.
		/// </param>
		/// <param name="mode">
		/// The mode defines how the activity interpolates between states.
		/// </param>
		public PInterpolatingActivity(long duration, long stepInterval, int loopCount, ActivityMode mode) :
			this(duration, stepInterval, PUtil.CurrentTimeMillis, loopCount, mode) {}
		/// <summary>
		/// Constructs a new PPositionPathActivity that will move the target through the given
		/// positions in the order specified by the mode, transitioning from position to position
		/// as specified by the given knot values and looping the given number of iterations.
		/// </summary>
		/// <param name="duration">The length of the activity.</param>
		/// <param name="stepInterval">
		/// The minimum number of milliseconds that this activity should delay between steps.
		/// </param>
		/// <param name="loopCount">
		/// The number of times the activity should reschedule itself.
		/// </param>
		/// <param name="mode">
		/// The mode defines how the activity interpolates between states.
		/// </param>
		/// <param name="aTarget">The object that the activity will be applied to.</param>
		/// <param name="knots">
		/// An array of values between 0 and 1 that indicate when the position transitions should
		/// occur.
		/// </param>
		/// <param name="positions">
		/// The sequence of points that this activity animates through.
		/// </param>
		public PPositionPathActivity(long duration, long stepInterval, int loopCount, ActivityMode mode, Target aTarget, float[] knots, PointF[] positions)
			: base(duration, stepInterval, loopCount, mode, knots) {
			target = aTarget;
			this.positions = positions;
		}
		/// <summary>
		/// Constructs a new PColorActivity that animate between the source and destination
		/// colors in the order specified by the mode, looping the given number of iterations.
		/// </summary>
		/// <param name="duration">The length of one loop of the activity.</param>
		/// <param name="stepInterval">
		/// The minimum number of milliseconds that this activity should delay between steps.
		/// </param>
		/// <param name="loopCount">
		/// The number of times the activity should reschedule itself.
		/// </param>
		/// <param name="mode">
		/// Defines how the activity interpolates between states.
		/// </param>
		/// <param name="aTarget">
		/// The object that the activity will be applied to and where the source state
		/// will be taken from.
		/// </param>
		/// <param name="aDestination">The destination color state.</param>
		public PColorActivity(long duration, long stepInterval, int loopCount, ActivityMode mode, Target aTarget, Color aDestination) :
			base(duration, stepInterval, loopCount, mode) {
			target = aTarget;
			destination = aDestination;
		}	
Example #19
0
 /// <summary>
 /// Constructs a new PInterpolatingActivity that will interpolate from the source
 /// state to the destination state, looping the given number of iterations.
 /// </summary>
 /// <param name="duration">The length of one loop of the activity.</param>
 /// <param name="stepInterval">
 /// The minimum number of milliseconds that this activity should delay between steps.
 /// </param>
 /// <param name="loopCount">
 /// The number of times the activity should reschedule itself.
 /// </param>
 /// <param name="mode">
 /// The mode defines how the activity interpolates between states.
 /// </param>
 public PInterpolatingActivity(long duration, long stepInterval, int loopCount, ActivityMode mode) :
     this(duration, stepInterval, PUtil.CurrentTimeMillis, loopCount, mode)
 {
 }