Ejemplo n.º 1
0
        void Application_KeyPress(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case KeyCode.Up:
                _curColor = (_curColor + colors.Length - 1) % colors.Length;
                UpdateHilight((Application)sender);
                e.Handled = true;
                break;

            case KeyCode.Down:
                _curColor = (_curColor + colors.Length + 1) % colors.Length;
                UpdateHilight((Application)sender);
                e.Handled = true;
                break;

            case KeyCode.Right:
                byte[] savedData = new byte[1];
                savedData[0] = (byte)_curColor;
                TivoTree forwardParameters = new TivoTree();
                forwardParameters.Add("entry", _curColor.ToString());
                forwardParameters.Add("depth", _depth.ToString());
                ((Application)sender).TransitionForward(BaseUri, forwardParameters, savedData);
                e.Handled = true;
                break;

            case KeyCode.Left:
                TivoTree backParameters = new TivoTree();
                backParameters.Add("return", _curColor.ToString());
                backParameters.Add("depth", (_depth - 1).ToString());
                ((Application)sender).TransitionBack(backParameters);
                e.Handled = true;
                break;
            }
        }
Ejemplo n.º 2
0
        internal static void ReadParameters(HmeReader reader, TivoTree currentLevel)
        {
            for (string value = reader.ReadString(); value.Length != 0; value = reader.ReadString())
            {
                currentLevel.AddKey(value);
                for (sbyte marker = reader.ReadSByte(); marker != endMarker; marker = reader.ReadSByte())
                {
                    switch (marker)
                    {
                    case stringMarker:
                        currentLevel.Add(value, reader.ReadString());
                        break;

                    case treeMarker:
                        TivoTree tree = new TivoTree();
                        ReadParameters(reader, tree);
                        currentLevel.Add(value, tree);
                        break;
                    }
                }
            }
        }