Пример #1
0
        public override void OnSave(ConfigNode node)
        {
            ConfigNode contextNode = new ConfigNode("context");

            // Save variables
            if (Variables.Count > 0)
            {
                ConfigNode varNode = new ConfigNode("variables");

                foreach (var kvp in Variables)
                {
                    if (!(kvp.Value is BoundVariable))
                    {
                        varNode.AddValue(kvp.Key, File.EncodeLine(kvp.Value.Value.ToString()));
                    }
                }

                contextNode.AddNode(varNode);
            }

            if (ChildContext != null)
            {
                ChildContext.OnSave(contextNode);
            }

            node.AddNode(contextNode);
        }
Пример #2
0
        public virtual bool Type(char c)
        {
            if (ChildContext != null)
            {
                return(ChildContext.Type(c));
            }

            return(false);
        }
Пример #3
0
        public virtual bool SpecialKey(kOSKeys key)
        {
            if (ChildContext != null)
            {
                return(ChildContext.SpecialKey(key));
            }

            return(false);
        }
 public override void Initialize(TElement[] elements)
 {
     if (ChildContext != null)
     {
         ChildContext.Initialize(elements);
     }
     _keys = new TKey[elements.Length];
     for (var i = 0; i < _keys.Length; i++)
     {
         _keys[i] = _selector(elements[i]);
     }
 }
Пример #5
0
        public virtual void OnSave(ConfigNode node)
        {
            var contextNode = new ConfigNode("context");

            contextNode.AddValue("context-type", GetType().ToString());

            if (ChildContext != null)
            {
                ChildContext.OnSave(contextNode);
            }

            node.AddNode(contextNode);
        }
Пример #6
0
        //[ConfigureAwait(false)]
        internal override async Task Initialize(TElement[] elements)
        {
            if (ChildContext != null)
            {
                await ChildContext.Initialize(elements).ConfigureAwait(false);
            }

            keys = new TKey[elements.Length];

            for (var i = 0; i < keys.Length; i++)
            {
                keys[i] = await keySelector(elements[i]).ConfigureAwait(false);
            }
        }
        public override int Compare(int firstIndex, int secondIndex)
        {
            var comparison = _comparer.Compare(_keys[firstIndex], _keys[secondIndex]);

            if (comparison == 0)
            {
                if (ChildContext != null)
                {
                    return(ChildContext.Compare(firstIndex, secondIndex));
                }
                comparison = Direction == SortDirection.Descending
                             ? secondIndex - firstIndex
                             : firstIndex - secondIndex;
            }
            return(Direction == SortDirection.Descending ? -comparison : comparison);
        }
Пример #8
0
        internal override int Compare(int firstIndex, int secondIndex)
        {
            int comparison = comparer.Compare(keys[firstIndex], keys[secondIndex]);

            if (comparison == 0)
            {
                if (ChildContext != null)
                {
                    return(ChildContext.Compare(firstIndex, secondIndex));
                }

                comparison = descending ? secondIndex - firstIndex : firstIndex - secondIndex;
            }

            return(descending ? -comparison : comparison);
        }
Пример #9
0
        public virtual IContext GetContext()
        {
            var context = _contextLifetimeManager.Find(DefaultContextKey) as IContext;

            if (context == null)
            {
                context = new TopContext();
                _contextLifetimeManager.Store(DefaultContextKey, context);
                _logger.Debug("Top context created and stored.");
            }
            else
            {
                context = new ChildContext(context);
                _logger.Debug("Child context created.");
            }

            return(context);
        }
        public virtual IContext GetContext()
        {
            var context = _contextLifetimeManager.Find(DefaultContextKey) as IContext;

            if (context == null)
            {
                context = new TopContext();
                _contextLifetimeManager.Store(DefaultContextKey, context);
                _logger.Debug("Top context created and stored.");
            }
            else
            {
                context = new ChildContext(context);
                _logger.Debug("Child context created.");
            }

            return context;
        }
Пример #11
0
        public virtual void Update(float time)
        {
            // Process Command locks
            foreach (var command in new List <ICommand>(CommandLocks))
            {
                command.Update(time);
            }

            if (ChildContext != null)
            {
                if (ChildContext.State == ExecutionState.DONE)
                {
                    ChildContext = null;
                }
                else
                {
                    ChildContext.Update(time);
                }
            }
        }
Пример #12
0
 public ConfirmationModel(ChildContext context)
 {
     _context = context;
 }
Пример #13
0
 public override int GetCursorX()
 {
     return(ChildContext != null?ChildContext.GetCursorX() : cursorX);
 }
Пример #14
0
 public ListChildModel(ChildContext context)
 {
     _context = context;
 }
 public DeleteChildModel(ChildContext db)
 {
     _db = db;
 }
Пример #16
0
 public ThankYouModel(ChildContext db)
 {
     _db = db;
 }
Пример #17
0
 public virtual int GetCursorY()
 {
     return(ChildContext != null?ChildContext.GetCursorY() : -1);
 }
Пример #18
0
 public EditChildModel(ChildContext db)
 {
     _db = db;
 }
Пример #19
0
 public CreateApplicationModel(ChildContext db)
 {
     _db = db;
 }
Пример #20
0
 public IExecutionContext GetDeepestChildContext()
 {
     return(ChildContext == null ? this : ChildContext.GetDeepestChildContext());
 }
Пример #21
0
 public CreateChildModel(ChildContext db)
 {
     _db = db;
 }
Пример #22
0
 public override int GetCursorY()
 {
     return(ChildContext != null?ChildContext.GetCursorY() : CursorY);
 }
Пример #23
0
 public ChildrenController(ChildContext context)
 {
     _context = context;
 }
Пример #24
0
 public bool KeyInput(char c)
 {
     return(ChildContext != null?ChildContext.Type(c) : Type(c));
 }
Пример #25
0
 public ChildController(ChildContext context, ILogger <ChildController> logger)
 {
     _context = context;
     _logger  = logger;
 }
Пример #26
0
        public override char[,] GetBuffer()
        {
            var childBuffer = (ChildContext != null) ? ChildContext.GetBuffer() : null;

            return(childBuffer != null ? childBuffer : buffer);
        }
Пример #27
0
 public virtual char[,] GetBuffer()
 {
     return((ChildContext != null) ? ChildContext.GetBuffer() : null);
 }
 public SearchApplicationModel(ChildContext db)
 {
     _db = db;
 }
 public ListChildrenModel(ChildContext db)
 {
     _db = db;
 }