Tech Off Thread

1 post

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

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.  

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.