Exemplo n.º 1
0
        //=====================================================================

        /// <summary>
        /// Add a new token to the collection
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void cmdAddItem_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if(tokens != null)
            {
                Token t = new Token { TokenValue = "Add token content here" };
                tokens.Add(t);

                t.IsSelected = true;
                lbTokens.ScrollIntoView(t);

                txtTokenName.SelectAll();
                txtTokenValue.SelectAll();
                txtTokenName.Focus();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add a new token
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Token t = new Token("New Token", "Token value");
            TreeNode node = tvTokens.Nodes.Add(t.TokenName);
            node.Tag = t;
            tokens.Add(t);
            tvTokens.SelectedNode = node;

            if(tokens.Count == 1)
                txtTokenID.Enabled = editor.Enabled = btnDelete.Enabled = true;

            txtTokenID.Focus();
        }