Example #1
0
 public UserQuestion(string content, IRxn onOk, IRxn onCancel, string title = "Please choose?")
 {
     Title   = title;
     Content = content;
     Ok      = onOk;
     Cancel  = onCancel;
 }
Example #2
0
        public void Record(IRxn rxn, TimeSpan?sinceBeginning = null)
        {
            sinceBeginning = sinceBeginning ?? _now() - _startedAt;
            Duration       = sinceBeginning.Value;

            _writer.Write("{0}{1}", _codec.ToString(new CapturedRxn(sinceBeginning.Value, rxn)), _codec.Delimiter);
        }
Example #3
0
        private IRxn FilterPlayback(IRxn e)
        {
            //when a user presses the back button in the nav bar or other mechanism to pop
            //a page without a navigation action, we need to handle this!
            if (e is PhoneNavigationOrchestrator.PoppedPage)
            {
                var alreadyPopped = _lastEvent as NavigationAction;
                if (alreadyPopped == null || alreadyPopped.IsPushing)
                {
                    return(_nav.Pop());
                }
            }

            _lastEvent = e;
            Debug.WriteLine("Saw: {0}", e.GetType());

            foreach (var filter in _automator.Filters)
            {
                e = filter.FilterPlayback(e);
                if (e == null)
                {
                    return(null);
                }
            }

            Debug.WriteLine("Playing");

            return(e);
        }
Example #4
0
 public ToastAlert(string title, string content, LogLevel level, TimeSpan?duration = null, IRxn onClick = null)
 {
     Title    = title;
     Content  = content;
     Level    = level;
     OnClick  = onClick;
     Duration = duration ?? TimeSpan.FromSeconds(5);
 }
Example #5
0
 public UserQuestion(string title, string content, string okText, IRxn onOk, string cancelText, IRxn onCancel)
 {
     Title      = title;
     Content    = content;
     OkText     = okText;
     Ok         = onOk;
     CancelText = cancelText;
     Cancel     = onCancel;
 }
Example #6
0
        public IRxn FilterPlayback(IRxn tapedEvent)
        {
            try
            {
                var assert = tapedEvent as AssertModel;
                if (assert != null)
                {
                    var currentValue = Snapshot(_appNav.Current.Model);
                    //need a better comparision, like the cmdServiceCache hashing function to be ok with datetimes etc that will always be different
                    Ensure.Equal(currentValue.ToJson(), assert.Value.ToJson(), "The model should be the same as when originally recorded");
                    return(null);
                }

                return(tapedEvent);
            }
            catch (Exception e)
            {
                return(new ToastAlert("Play inconsitancy detected", e.Message, LogLevel.Fatal));
            }
        }
Example #7
0
 public void Publish(IRxn rxn)
 {
     _rxnManager.Publish(rxn).Until();
 }
Example #8
0
 private static object PrettyPrint(IRxn obj)
 {
     return(obj.GetType().GetProperties().Select(p => "{0}:{1}".FormatWith(p.Name, p.CanRead ? p.GetValue(obj) : "(na)")).ToStringEach());
 }
Example #9
0
 public MsgWrapper(IRxn toWrap)
 {
     Msg = toWrap;
 }
Example #10
0
 public static string Wrap(IRxn @event)
 {
     return(new MsgWrapper(@event).ToJson());
 }
Example #11
0
 public Question(IServiceCommand ask, IRxn onSuccess = null, IRxn onFailure = null)
 {
     OnSuccess = onSuccess;
     Ask       = ask;
     OnFailure = onFailure;
 }
Example #12
0
 public IRxn FilterPlayback(IRxn e)
 {
     //only executed message should be played back
     return(e as UserExecuted);
 }
Example #13
0
 public void Publish(IRxn cfg)
 {
     _publish(cfg);
 }
Example #14
0
 public DialogAlert(string content, string title = null, IRxn onOk = null)
 {
     Title   = title;
     OnOk    = onOk;
     Content = content;
 }
Example #15
0
 public void Record(IRxn rxn, TimeSpan?sinceBeginning = null)
 {
     _store.Add(new CapturedRxn(TimeSpan.Zero, rxn));
 }
Example #16
0
 public CapturedRxn(TimeSpan offSet, IRxn rxn)
 {
     Offset   = offSet;
     Recorded = rxn;
 }
Example #17
0
 public IRxn FilterPlayback(IRxn tapedEvent)
 {
     return(tapedEvent as IUserAction);
 }