public static void specialActionContextMenuHtml(AnyUiUIElement el, AnyUiSpecialActionContextMenu cntlcm)
        {
            var dc = (el.DisplayData as AnyUiDisplayDataHtml)?._context;

            if (dc != null)
            {
                var sessionNumber = dc._bi.sessionNumber;
                var found         = findSession(sessionNumber);
                if (found != null)
                {
                    lock (dc.htmlDotnetLock)
                    {
                        while (found.htmlDotnetEventIn)
                        {
                            ;
                        }
                        found.htmlEventInputs.Clear();
                        found.htmlDotnetEventType = "contextMenu";
                        found.htmlDotnetEventInputs.Add(el);
                        found.htmlDotnetEventInputs.Add(cntlcm);
                        found.htmlDotnetEventIn = true;
                    }
                }
            }
        }
Exemple #2
0
 public static void specialActionContextMenuHtml(AnyUiUIElement el, AnyUiSpecialActionContextMenu cntlcm)
 {
     lock (htmlDotnetLock)
     {
         while (htmlDotnetEventIn)
         {
             ;
         }
         htmlDotnetEventType = "contextMenu";
         htmlDotnetEventInputs.Add(el);
         htmlDotnetEventInputs.Add(cntlcm);
         htmlDotnetEventIn = true;
     }
 }
        public static void htmlDotnetLoop()
        {
            AnyUiUIElement el;

            while (true)
            {
                // ReSharper disable InconsistentlySynchronizedField
                int i = 0;
                while (i < sessions.Count)
                {
                    var s = sessions[i];
                    if (s.htmlDotnetEventIn)
                    {
                        switch (s.htmlDotnetEventType)
                        {
                        case "setValueLambda":
                            el = (AnyUiUIElement)s.htmlDotnetEventInputs[0];
                            object o = s.htmlDotnetEventInputs[1];
                            s.htmlDotnetEventIn = false;
                            s.htmlDotnetEventInputs.Clear();
                            AnyUiLambdaActionBase ret = el.setValueLambda?.Invoke(o);
                            break;

                        case "contextMenu":
                            el = (AnyUiUIElement)s.htmlDotnetEventInputs[0];
                            AnyUiSpecialActionContextMenu cntlcm = (AnyUiSpecialActionContextMenu)
                                                                   s.htmlDotnetEventInputs[1];
                            s.htmlEventType = "contextMenu";
                            s.htmlEventInputs.Add(el);
                            s.htmlEventInputs.Add(cntlcm);
                            s.htmlDotnetEventIn = false;
                            s.htmlDotnetEventInputs.Clear();
                            s.htmlEventIn = true;
                            Program.signalNewData(1, s.sessionNumber);     // same tree, but structure may change

                            while (!s.htmlEventOut)
                            {
                                ;
                            }
                            int bufferedI = 0;
                            if (s.htmlEventOutputs.Count == 1)
                            {
                                bufferedI = (int)s.htmlEventOutputs[0];
                                var action2 = cntlcm.MenuItemLambda?.Invoke(bufferedI);
                            }
                            s.htmlEventOutputs.Clear();
                            s.htmlEventType = "";
                            s.htmlEventOut  = false;
                            //// AnyUiLambdaActionBase ret = el.setValueLambda?.Invoke(o);
                            break;
                        }
                        while (s.htmlDotnetEventOut)
                        {
                            ;
                        }
                        Program.signalNewData(2, s.sessionNumber); // build new tree
                    }
                    i++;
                }
                // ReSharper enable InconsistentlySynchronizedField
                Thread.Sleep(100);
            }
        }
Exemple #4
0
        private static void htmlDotnetLoop()
        {
            AnyUiUIElement el;

            bool newData = false;

            while (true)
            {
                lock (htmlDotnetLock)
                {
                    if (htmlDotnetEventIn)
                    {
                        switch (htmlDotnetEventType)
                        {
                        case "setValueLambda":
                            el = (AnyUiUIElement)htmlDotnetEventInputs[0];
                            object o = htmlDotnetEventInputs[1];
                            htmlDotnetEventInputs.Clear();
                            AnyUiLambdaActionBase ret = el.setValueLambda?.Invoke(o);
                            break;

                        case "contextMenu":
                            el = (AnyUiUIElement)htmlDotnetEventInputs[0];
                            AnyUiSpecialActionContextMenu cntlcm = (AnyUiSpecialActionContextMenu)
                                                                   htmlDotnetEventInputs[1];
                            htmlEventType = "contextMenu";
                            htmlEventInputs.Add(el);
                            htmlEventInputs.Add(cntlcm);
                            htmlEventIn = true;
                            Program.signalNewData(1);     // same tree, but structure may change

                            while (!htmlEventOut)
                            {
                                ;
                            }
                            int bufferedI = 0;
                            if (htmlEventOutputs.Count == 1)
                            {
                                bufferedI = (int)htmlEventOutputs[0];
                                var action2 = cntlcm.MenuItemLambda?.Invoke(bufferedI);
                            }
                            htmlEventOutputs.Clear();
                            htmlEventType     = "";
                            htmlEventOut      = false;
                            htmlDotnetEventIn = false;

                            htmlDotnetEventInputs.Clear();
                            //// AnyUiLambdaActionBase ret = el.setValueLambda?.Invoke(o);
                            break;
                        }
                        while (htmlDotnetEventOut)
                        {
                            ;
                        }
                        htmlDotnetEventIn = false;
                        newData           = true;
                    }
                }
                if (newData)
                {
                    newData = false;
                    Program.signalNewData(2); // build new tree
                }
                Thread.Sleep(100);
            }
        }