Example #1
0
        /// <summary>
        /// Event raised  the menu control is opening.
        ///  Handles the opening of the AFTreeView ContextMenuStrip to override visibility of menu items.
        ///  TODO: could vary between admin and non-admin users.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void afmenu_Opening(object sender, CancelEventArgs e)
        {
            // Get the AF menu.
            AFMenu afmenu = sender as AFMenu;

            if (afmenu != null)
            {
                bool visible = true;
                foreach (ToolStripItem item in afmenu.Items)
                {
                    if (visible)
                    {
                        ToolStripSeparator separatorItem = item as ToolStripSeparator;
                        if (separatorItem != null)
                        {
                            visible = false;
                        }
                        ToolStripMenuItem menu = item as ToolStripMenuItem;
                        if (menu != null)
                        {
                            foreach (ToolStripItem mItem in menu.DropDownItems)
                            {
                                if (mItem.Text != "Chi&ldren..." && mItem.Text != "Event &Frames...")
                                {
                                    mItem.Visible = false;
                                }
                                else
                                {
                                    mItem.Visible = true;
                                    // mItem.Click += new EventHandler(afmenu_clicked);
                                }
                            }
                        }
                    }
                    item.Visible = visible;
                }
            }
        }
Example #2
0
        // Load and Closing
        private void PItoMatlabForm_Load(object sender, EventArgs e)
        {
            startDTP.Text = "*-2h";
            endDTP.Text = "*";

            // Log System Initialization
            logForm = new LogDialog(control,this);

            // Initialize AFViewControllers
            AFNamedCollectionList<AFAttribute> atts = new AFNamedCollectionList<AFAttribute>();
            AFNamedCollectionList<AFEventFrame> frames = new AFNamedCollectionList<AFEventFrame>();
            avcAttributes.AFSetObject(atts, null, null, null);
            avcAttributes.ContextMenuStrip = null;
            avcEventAttributes.AFSetObject(atts, null, null, null);
            avcEventFrames.AFSetObject(frames, null, null, null);

            //Initialize Data Preference Dialog
            dataPrefDialog = new DataPreferences(this);

            //Control AfTreeView1.ContextMenuSTrip
            afmenu = afTreeViewElements.ContextMenuStrip as AFMenu;
            if (afmenu != null)
            {
                // Event raised when the menu control is opening.
                afmenu.Opening += new CancelEventHandler(afmenu_Opening);
            }

            //Connect the Database Picker to the System Picker
            afDatabasePicker1.SystemPicker = afServerPicker;

            //Initialize Connection
            initializeAfServerPicker();

            Status("Loaded from the AF System " + _curServer);
        }