Ejemplo n.º 1
0
        /// <summary>
        /// Handles the <see cref="Selector.SelectionChanged"/> event for the "Command" <see
        /// cref="ListView"/>.</summary>
        /// <param name="sender">
        /// The <see cref="Object"/> where the event handler is attached.</param>
        /// <param name="args">
        /// A <see cref="SelectionChangedEventArgs"/> object containing event data.</param>
        /// <remarks>
        /// <b>OnCommandSelected</b> updates the text box to reflect the selected command.</remarks>

        private void OnCommandSelected(object sender, SelectionChangedEventArgs args)
        {
            // clear command text box
            CommandInfo.Text = "";

            // retrieve selected command, if any
            CommandListItem item = CommandList.SelectedItem as CommandListItem;

            if (item == null)
            {
                return;
            }

            // show command text
            CommandInfo.Text = item.Command.ToString();
            CommandInfo.AppendText(Environment.NewLine);

            // show message events but suppress dialogs
            foreach (Instruction instruction in item.Command.Program)
            {
                MessageInstruction message = instruction as MessageInstruction;
                if (message != null)
                {
                    SessionExecutor.ShowMessageEvent(message, CommandInfo, false);
                }
            }
        }