コード例 #1
0
        private void HandleChild(ParseResult result, XElement child)
        {
            if (child.IsType("visual"))
            {
                if (Visual != null)
                {
                    result.AddWarning("A visual element was already provided. Only the first one will be used.", GetErrorPositionInfo(child));
                    return;
                }

                Visual visual = new Visual(NotificationType.Cortana, SupportedFeatures);
                visual.Parse(result, child);

                Visual = visual;
            }

            else if (child.IsType("actionDefinitions"))
            {
                if (ActionDefinitions != null)
                {
                    result.AddWarning("An actionDefinitions element was already provided. Only the first one will be used.", GetErrorPositionInfo(child));
                    return;
                }

                ActionDefinitions actions = new ActionDefinitions(NotificationType.Cortana, SupportedFeatures);
                actions.Parse(result, child);

                ActionDefinitions = actions;
            }

            else
            {
                result.AddError($"Invalid child {child.Name.LocalName} under toast element.", GetErrorPositionInfo(child));
            }
        }
コード例 #2
0
        public void ProcessInput(InputState input)
        {
            ConsoleAction action;

            if (ActionDefinitions.TryGetAction(input, out action))
            {
                ProcessAction(action);
            }
            else
            {
                for (int i = 0; i < input.PressedKeys.Count; i++)
                {
                    Keys   key = input.PressedKeys[i];
                    Symbol symbol;
                    if (SymbolMappings.TryGetValue(key, out symbol))
                    {
                        ProcessSymbol(symbol);
                    }
                }
            }
        }