Beispiel #1
0
        public void Setup(CompositeDisposable cd, IEngine engine, SceneStack sceneStack)
        {
            Dialog.Setup(cd, engine, sceneStack);

            engine.Worker(cd, Dep.On(Status, Trigger), () =>
            {
                if (Trigger && Status)
                {
                    Dialog.Open.Fire(Empty.Instance);
                }
            });
            engine.Worker(cd, Dep.On(Status, Trigger, Yes, No), () =>
            {
                T value;
                if (!Status || Yes || No)
                {
                    Current.Write(default(T));
                }
                else if (Trigger.TryRead(out value))
                {
                    Current.Write(value);
                }
            });
            engine.Worker(cd, Dep.On(Status, Trigger), () =>
            {
                T value;
                if (Trigger.TryRead(out value) && !Status)
                {
                    Rejected.Fire(value);
                }
            });
            engine.Worker(cd, Dep.On(Status, Dialog.State, Yes, No), () =>
            {
                if (!Status && Dialog.State == SceneState.Opened)
                {
                    Dialog.Close.Fire(Empty.Instance);
                }
                else if (Yes || No)
                {
                    Dialog.Close.Fire(Empty.Instance);
                }
            });

            engine.Worker(cd, Dep.On(Status, Yes), () =>
            {
                if (Yes && !Status)
                {
                    throw new InvalidOperationException();
                }
            });
        }