Esempio n. 1
0
 public static void addSession(int sessionNumber)
 {
     lock (staticHtmlDotnetLock)
     {
         var s = new AnyUiHtmlEventSession();
         s.sessionNumber = sessionNumber;
         sessions.Add(s);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Show MessageBoxFlyout with contents
        /// </summary>
        /// <param name="message">Message on the main screen</param>
        /// <param name="caption">Caption string (title)</param>
        /// <param name="buttons">Buttons according to WPF standard messagebox</param>
        /// <param name="image">Image according to WPF standard messagebox</param>
        /// <returns></returns>
        public override AnyUiMessageBoxResult MessageBoxFlyoutShow(
            string message, string caption, AnyUiMessageBoxButton buttons, AnyUiMessageBoxImage image)
        {
            AnyUiHtmlEventSession found = null;

            lock (htmlDotnetLock)
            {
                foreach (var s in sessions)
                {
                    if (_bi.sessionNumber == s.sessionNumber)
                    {
                        found = s;
                        break;
                    }
                }
            }

            AnyUiMessageBoxResult r = AnyUiMessageBoxResult.None;

            if (found != null)
            {
                found.htmlEventInputs.Clear();
                found.htmlEventType = "MessageBoxFlyoutShow";
                found.htmlEventInputs.Add(message);
                found.htmlEventInputs.Add(caption);
                found.htmlEventInputs.Add(buttons);
                found.htmlEventIn = true;
                Program.signalNewData(2, found.sessionNumber); // build new tree

                while (!found.htmlEventOut)
                {
                    ;
                }
                if (found.htmlEventOutputs.Count == 1)
                {
                    r = (AnyUiMessageBoxResult)found.htmlEventOutputs[0];
                }

                found.htmlEventType = "";
                found.htmlEventOutputs.Clear();
                found.htmlEventOut = false;
                found.htmlEventInputs.Clear();
                found.htmlDotnetEventIn = false;
            }

            return(r);
        }
Esempio n. 3
0
        public static AnyUiHtmlEventSession findSession(int sessionNumber)
        {
            AnyUiHtmlEventSession found = null;

            lock (staticHtmlDotnetLock)
            {
                foreach (var s in sessions)
                {
                    if (s.sessionNumber == sessionNumber)
                    {
                        found = s;
                        break;
                    }
                }
            }
            return(found);
        }
Esempio n. 4
0
 public static void deleteSession(int sessionNumber)
 {
     lock (staticHtmlDotnetLock)
     {
         AnyUiHtmlEventSession found = null;
         foreach (var s in sessions)
         {
             if (s.sessionNumber == sessionNumber)
             {
                 found = s;
                 break;
             }
         }
         if (found != null)
         {
             sessions.Remove(found);
         }
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Shows specified dialogue hardware-independent. The technology implementation will show the
        /// dialogue based on the type of provided <c>dialogueData</c>.
        /// Modal dialogue: this function will block, until user ends dialogue.
        /// </summary>
        /// <param name="dialogueData"></param>
        /// <returns>If the dialogue was end with "OK" or similar success.</returns>
        public override bool StartFlyoverModal(AnyUiDialogueDataBase dialogueData)
        {
            // access
            if (dialogueData == null)
            {
                return(false);
            }

            // make sure to reset
            dialogueData.Result = false;

            AnyUiHtmlEventSession found = null;

            lock (htmlDotnetLock)
            {
                foreach (var s in sessions)
                {
                    if (_bi.sessionNumber == s.sessionNumber)
                    {
                        found = s;
                        break;
                    }
                }
            }

            if (found != null)
            {
                found.htmlEventInputs.Clear();
                found.htmlEventType = "StartFlyoverModal";
                found.htmlEventInputs.Add(dialogueData);

                found.htmlEventIn = true;
                Program.signalNewData(2, found.sessionNumber); // build new tree

                while (!found.htmlEventOut)
                {
                    ;
                }
                if (dialogueData is AnyUiDialogueDataTextEditor ddte)
                {
                    if (found.htmlEventOutputs.Count == 2)
                    {
                        ddte.Text   = (string)found.htmlEventOutputs[0];
                        ddte.Result = (bool)found.htmlEventOutputs[1];
                    }
                }
                if (dialogueData is AnyUiDialogueDataSelectFromList ddsfl)
                {
                    ddsfl.Result = false;
                    if (found.htmlEventOutputs.Count == 1)
                    {
                        int iDdsfl = (int)found.htmlEventOutputs[0];
                        ddsfl.Result      = true;
                        ddsfl.ResultIndex = iDdsfl;
                        ddsfl.ResultItem  = ddsfl.ListOfItems[iDdsfl];
                    }
                }
                found.htmlEventType = "";
                found.htmlEventOutputs.Clear();
                found.htmlEventOut = false;
                found.htmlEventInputs.Clear();
                found.htmlDotnetEventIn = false;
            }
            // result
            return(dialogueData.Result);
        }