//****************************************************************************************************** // MenuDataItem.cs - Gbtc // // Copyright © 2012, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may // not use this file except in compliance with the License. You may obtain a copy of the License at: // // http://www.opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 03/28/2011 - Mehulbhai P Thakkar // Generated original version of source code. // 12/20/2012 - Starlynn Danyelle Gilliam // Modified Header. // //****************************************************************************************************** using System.Collections.ObjectModel; using System.Windows.Input; using System.Xml.Serialization; using GSF.TimeSeries.UI.Commands; namespace GSF.TimeSeries.UI { /// /// Represents a menu item in a WPF Menu control. /// public class MenuDataItem { #region [ Members ] // Fields private string m_icon; private string m_menuText; private string m_description; private string m_roles; private string m_userControlAssembly; private string m_userControlPath; private MenuCommand m_command; private ObservableCollection m_subMenuItems; #endregion #region [ Properties ] /// /// Gets or sets path image icon. /// [XmlAttribute] public string Icon { get { return m_icon; } set { m_icon = value; } } /// /// Gets or sets text of to be displayed in menu. /// [XmlAttribute] public string MenuText { get { return m_menuText; } set { m_menuText = value; } } /// /// Gets or sets description of the . /// [XmlAttribute] public string Description { get { return m_description; } set { m_description = value; } } /// /// Gets or sets comma seperated list of roles with access to this . /// [XmlAttribute] public string Roles { get { return m_roles; } set { m_roles = value; } } /// /// Gets or sets the assembly name where user control is defined. /// [XmlAttribute] public string UserControlAssembly { get { return m_userControlAssembly; } set { m_userControlAssembly = value; } } /// /// Gets or sets path for the user control to be loaded when is clicked. /// [XmlAttribute] public string UserControlPath { get { return m_userControlPath; } set { m_userControlPath = value; } } /// /// Gets or sets the commnad to execute when is clicked. /// [XmlIgnore] public ICommand Command { get { if ((object)m_command == null) m_command = new MenuCommand(); m_command.Roles = Roles; m_command.UserControlAssembly = UserControlAssembly; m_command.UserControlPath = UserControlPath; m_command.Description = Description; return m_command; } } /// /// Gets or sets sub menu items for . /// public ObservableCollection SubMenuItems { get { return m_subMenuItems; } set { m_subMenuItems = value; } } #endregion } }