Пример #1
0
            /// <summary>
            /// Gets an action with the specified name.
            /// Name cannot be null or empty string.
            /// Side effects: If the name is not found in the table, a new
            /// row is created.
            /// </summary>
            /// <param name="actionName">The name to search for.</param>
            /// <returns>The ActionsRow containing the specified action name.</returns>
            public ActionsRow GetAction(string actionName)
            {
                if (actionName == null)
                {
                    throw new ArgumentNullException("actionName");
                }

                if (actionName == string.Empty)
                {
                    throw new ArgumentOutOfRangeException("actionName", "Name cannot be empty.");
                }

                // Get the row for the action name
                ActionsRow action = FindByActionName(actionName);

                if (action == null)
                {
                    // Ensure we don't get fully lower-case entries
                    if (actionName == actionName.ToLower())
                    {
                        string firstChar = actionName.Substring(0, 1);
                        firstChar  = firstChar.ToUpper();
                        actionName = firstChar + actionName.Substring(1);
                    }

                    action = AddActionsRow(actionName);
                }

                return(action);
            }
Пример #2
0
 private void FillActionsRow()
 {
     if (UnreadButton != null)
     {
         ActionsRow.Add(UnreadButton);
     }
     if (SpamButton != null)
     {
         ActionsRow.Add(SpamButton);
     }
     if (TrashButton != null)
     {
         ActionsRow.Add(TrashButton);
     }
     if (ArchiveButton != null)
     {
         ActionsRow.Add(ArchiveButton);
     }
     if (NotifyButton != null)
     {
         ActionsRow.Add(NotifyButton);
     }
 }