Beispiel #1
0
        public static void BackgroundAction(object target, Action backgroundAction, Action befoe, Action callback, EndMode endMode, TaskImplMode taskMode)
        {
            var context = new BackgroundActionContext(endMode, () => { backgroundAction(); return null; });
            var container = target == null ? backgroundAction.Target.As<IExtendedPresenter>() : target.As<IExtendedPresenter>();
            var task = container.GetMetadata<IBackgroundThreadTask>();
            if (task == null)
            {
                task = TaskImplFactory.CreateTask(taskMode);
                if (taskMode != TaskImplMode.UIThread)
                {
                    container.WasShutdown += (s, e) => task.Dispose();
                    container.AddMetadata(task);
                }
            }

            //Before
            if (!befoe.IsNull())
                befoe();

            //Action
            task.Enqueue(context);

            //After
            if (!callback.IsNull())
                Application.Current.Dispatcher.BeginInvoke(callback, DispatcherPriority.ContextIdle);
        }
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_duration = br.ReadSingle();
     m_toGeneratorStartTimeFraction = br.ReadSingle();
     m_flags         = br.ReadUInt16();
     m_endMode       = (EndMode)br.ReadSByte();
     m_blendCurve    = (BlendCurve)br.ReadSByte();
     m_alignmentBone = br.ReadInt16();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt16();
 }
Beispiel #3
0
        public async Task <NextTeam> GetNextTeam(int gameId, EndMode endMode)
        {
            switch (endMode)
            {
            case EndMode.SuddenDeath:
                return(await gameTeamRepository.GetNextTeam(gameId));

            default:
                throw new NotImplementedException("Not yet implemented");
            }
        }
Beispiel #4
0
        public void OnSuccess(MethodExecutionArgs eventArgs)
        {
            if (IsNoopConversationalMarkerActive)
            {
                return;
            }
            if (eventArgs.MethodExecutionTag == NestedMethodMarker)
            {
                return;
            }
            IConversationsContainerAccessor cca = ConversationsContainerAccessor;
            IConversation c = cca.Container.Get(GetConversationIdMethod.Invoke());

            EndMode endMode = GetMethodEndMode(eventArgs.Method);

            switch (endMode)
            {
            case EndMode.End:
                c.End();
                c.Dispose();
                break;

            case EndMode.Abort:
                c.Abort();
                c.Dispose();
                break;

            case EndMode.CommitAndContinue:
                c.FlushAndPause();
                break;

            default:
                c.Pause();
                break;
            }
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BackgroundActionContext"/> class.
 /// </summary>
 /// <param name="endMode">The end mode.</param>
 /// <param name="task">The task.</param>
 public BackgroundActionContext(EndMode endMode, Func <object> task)
 {
     BackgourndEndMode = endMode;
     Task = task;
 }
Beispiel #6
0
 public static void BackgroundAction(Action backgroundAction, Action callback, EndMode endMode, TaskImplMode taskMode)
 {
     BackgroundAction(null, backgroundAction, default(Action), callback, endMode, taskMode);
 }
Beispiel #7
0
 public static void BackgroundAction(Action backgroundAction, EndMode endMode)
 {
     BackgroundAction(backgroundAction, endMode, TaskImplMode.UIThread);
 }
Beispiel #8
0
 public static void BackgroundAction(Action backgroundAction, EndMode endMode, TaskImplMode taskMode)
 {
     BackgroundAction(backgroundAction, default(Action), endMode, taskMode);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BackgroundActionContext"/> class.
 /// </summary>
 /// <param name="endMode">The end mode.</param>
 /// <param name="task">The task.</param>
 public BackgroundActionContext(EndMode endMode, Func<object> task)
 {
     BackgourndEndMode = endMode;
     Task = task;
 }
Beispiel #10
0
        public static void BackgroundAction(object target, Action backgroundAction, Action befoe, Action callback, EndMode endMode, TaskImplMode taskMode)
        {
            var context   = new BackgroundActionContext(endMode, () => { backgroundAction(); return(null); });
            var container = target == null?backgroundAction.Target.As <IExtendedPresenter>() : target.As <IExtendedPresenter>();

            var task = container.GetMetadata <IBackgroundThreadTask>();

            if (task == null)
            {
                task = TaskImplFactory.CreateTask(taskMode);
                if (taskMode != TaskImplMode.UIThread)
                {
                    container.WasShutdown += (s, e) => task.Dispose();
                    container.AddMetadata(task);
                }
            }

            //Before
            if (!befoe.IsNull())
            {
                befoe();
            }

            //Action
            task.Enqueue(context);

            //After
            if (!callback.IsNull())
            {
                Application.Current.Dispatcher.BeginInvoke(callback, DispatcherPriority.ContextIdle);
            }
        }
Beispiel #11
0
 public static void BackgroundAction(Action backgroundAction, Action callback, EndMode endMode, TaskImplMode taskMode)
 {
     BackgroundAction(null, backgroundAction, default(Action), callback, endMode, taskMode);
 }
Beispiel #12
0
 public static void BackgroundAction(Action backgroundAction, EndMode endMode, TaskImplMode taskMode)
 {
     BackgroundAction(backgroundAction, default(Action), endMode, taskMode);
 }
Beispiel #13
0
 public static void BackgroundAction(Action backgroundAction, EndMode endMode)
 {
     BackgroundAction(backgroundAction, endMode, TaskImplMode.UIThread);
 }