예제 #1
0
        /// <summary>
        /// Load and overwrite items from a default profile
        /// </summary>
        /// <param name="defaultProfile">The default profile ID</param>
        public void LoadDefaultProfile(DProfile defaultProfile)
        {
            var dp = DefaultProfiles.GetDefaultProfile(defaultProfile);

            if (dp == null)
            {
                return;             // sanity, defaultProfile does not exist
            }
            LoadDefaultProfile(dp); // use default Bar props
        }
예제 #2
0
        // A default profile is clicked
        private void ctxDP_Click(object sender, EventArgs e)
        {
            var    tsi  = (sender as ToolStripItem);
            object item = tsi.Owner;

            // backup the menu tree
            while (!(item is ContextMenuStrip))
            {
                if (item is ToolStripDropDownMenu)
                {
                    item = (item as ToolStripDropDownMenu).OwnerItem;
                }
                else if (item is ToolStripMenuItem)
                {
                    item = (item as ToolStripMenuItem).Owner;
                }
                else
                {
                    return; // not an expected menu tree
                }
            }
            var ctx = item as ContextMenuStrip;
            // col is the profile index assuming Col 0..4 carry the profiles...
            var col = tlp.GetColumn(ctx.SourceControl);

            if (col > c_NumProfiles)
            {
                return;                  // sanity
            }
            var dp = DefaultProfiles.GetDefaultProfile(tsi.Text);

            if (dp != null)
            {
                m_flpHandler[col].LoadDefaultProfile(dp);
                m_flpHandler[col].LoadFlp(HudBarRef);
                m_pName[col].Text = dp.Name;
            }
        }