Posted 21 years ago
by Steven Liu
As my syntax definition gets more complicated, it takes longer to load a document. Currently it takes about 2 - 3 seconds.
This is understandable since SyntaxEditor is doing a lot of processing. Is there a way to load the document in async mode? That way the UI is kept responsive and showing a progress bar, giving better user perception.
I guess I cannot simply launch an async delegate on SyntaxEditor.LoadFile method, since it interacts with UI elemnts.
My suggestion is to split LoadFile into 2 methods: ParseFile and RenderFile. ParseFile reads the file and parse it into internal data structure, RenderFile draws the document text. That way I can call ParseFile with async delegate, then in the callback, call RenderFile on UI thread.
LoadFile will encapsulate ParseFile and RenderFile, and still can be used in sync mode.
This solution is based on the assumption that parsing takes considerably longer than rendering.
Steven Liu
This is understandable since SyntaxEditor is doing a lot of processing. Is there a way to load the document in async mode? That way the UI is kept responsive and showing a progress bar, giving better user perception.
I guess I cannot simply launch an async delegate on SyntaxEditor.LoadFile method, since it interacts with UI elemnts.
My suggestion is to split LoadFile into 2 methods: ParseFile and RenderFile. ParseFile reads the file and parse it into internal data structure, RenderFile draws the document text. That way I can call ParseFile with async delegate, then in the callback, call RenderFile on UI thread.
LoadFile will encapsulate ParseFile and RenderFile, and still can be used in sync mode.
This solution is based on the assumption that parsing takes considerably longer than rendering.
Steven Liu