Tech Off Thread

1 post

Call Javascript from C# on separate thread/Task

Back to Forum: Tech Off
  • User profile image
    c_str

    Currently I have the code that is called from a Task that is causing performance issues.  

    var jsBoardInfo = Board.ConvertToJS((Board)pathItem);
    Tuple<Board, CurrentPiece> returnItem = (Tuple<Board, CurrentPiece>)realInfo.form.Invoke(
        new Func<object, Tuple<Board, CurrentPiece>>((jsBoardObj) =>
            {
            var jsBoard = (int[])jsBoardObj;
            javaScriptCon.updateBoard(jsBoard);
            var newBoard = javaScriptCon.getBoard();
            var newPiece = javaScriptCon.getCurrentPeice();
            return new Tuple<Board, CurrentPiece>(newBoard, newPiece);
            }), jsBoardInfo);

     

    What javaScriptCon is doing is using an the HTMLDocument.InvokeScript function to make calls to javascript functions.   However it's causing the program to to be unresponsive, and I'm looking for an alternative solution, that does not require ASP.net.  

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.