Exemple #1
0
/// <summary>
/// Process queued command
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void Timer_Tick(object sender, EventArgs e)
        {
            string arg;
            int    i1;

            Timer.Stop();

            string cmd = CommandToExecute;

            if (String.IsNullOrEmpty(cmd))
            {
                return;
            }

            else if (MoleculeGridControl.IsShowContextMenuCommand(cmd, "ShowContextMenu:TargetContextMenu", out arg))
            {
                SelectedTarget = arg;
                Point ptCursor = Cursor.Position;
                ptCursor = PointToClient(ptCursor);
                TargetContextMenu.Show(ParentControl, ptCursor);                 // show on panel since events lost if on WebBrowser control
            }

            else if ((i1 = Lex.IndexOf(cmd, "ClickFunction")) >= 0)
            {
                cmd = cmd.Substring(i1 + "ClickFunction".Length + 1);                 // get function name
                ClickFunctions.Process(cmd, null);
            }

            else
            {
                CommandExec.ExecuteCommandAsynch(cmd);
            }

            return;
        }
Exemple #2
0
        public bool ProcessInternal(
            WebBrowserNavigatingEventArgs e,
            Control parentControl)
        {
            string url, arg;

            url = e.Url.ToString();

            ParentControl = parentControl;             // panel to attach menu to

            if (!Lex.Contains(url, "mobius/command"))
            {
                return(false);
            }

            int i1 = url.IndexOf("?");

            if (i1 < 0)
            {
                return(false);
            }
            string cmd = url.Substring(i1 + 1);

            cmd = cmd.Replace("%20", " ");             // todo: more complete translation
            Lex lex = new Lex();

            lex.OpenString(cmd);

            if (MoleculeGridControl.IsShowContextMenuCommand(cmd, "ShowContextMenu:MetaTableLabelContextMenu", out arg))
            {
                SetupTableHeaderPopup(cmd, menuShowDescription, out ShowDescriptionArg,
                                      menuAddToQuery, out AddToQueryArg);
                Point ptCursor = Cursor.Position;
                ptCursor = parentControl.PointToClient(ptCursor);
                MetaTableLabelContextMenu.Show(parentControl, ptCursor);                       // show on panel since events lost if on WebBrowser control

                while (MetaTableLabelContextMenu != null && MetaTableLabelContextMenu.Visible) // keep this visible as long as popup is visible
                {
                    System.Threading.Thread.Sleep(250);
                    Application.DoEvents();
                }
            }

            else if (MoleculeGridControl.IsShowContextMenuCommand(cmd, "ShowContextMenu:CompoundIdContextMenu", out arg))
            {
                SelectedCid = arg;
                Point ptCursor = Cursor.Position;
                ptCursor = parentControl.PointToClient(ptCursor);
                CidContextMenu.Show(parentControl, ptCursor);                 // show on panel since events lost if on WebBrowser control

                while (CidContextMenu != null && CidContextMenu.Visible)      // keep this visible as long as popup is visible
                {
                    System.Threading.Thread.Sleep(250);
                    Application.DoEvents();
                }
            }

            else             // queue the command to execute after exiting this event
            {
                CommandToExecute = cmd;
                Timer_Tick(null, null);                 // just call directly for now, may need to fixup later to do after exiting the event
                //Timer.Start();
            }

            e.Cancel = true;             // we've taken care of it

            return(true);
        }