Monday, July 5, 2010

Updater Threading Issues and Smart Command Line Completion

The updater code worked fairly right but had some threading issues (the issue is that the download was done in background, so you will not be interrupted as long as you work, but at the final step there is needed to execute the interface in the main thread as .NET/Windows applications cannot have at least in standard Windows Forms applications updates from other threads than the main thread. Theoretically the solution is to call it via Control.Invoke method that will use locking code and will block anything to the main thread.
So as I've did not found a proper solution as the component framework (SCSF) does not provide an easy access to the main loop, to make a Producer/Consumer pattern, I found a simpler solution: I simply do not access the UI and launch the installer directly. May not be that elegant, but seems a proper solution. So if you picked to activate your updates (please take the nightly build as this is the first version that has a fix for this issue), you must close NaroCAD manually after the installer was started. If you have better knowledge or at least a way to avoid threading exceptions, please point it out, I'm eager to find a way to.
Another part is that as a milestone WPF Options do not crash as dialog, also I've fixed most issues from solver part, and when you switch the views. In this way you can work with the new options dialogs. Some features are not yet ported, mostly to apply Undo/Redo on options (it works great if you make try and error values) but I hope that very soon will be fixed.
Eventually, and the most interesting update is the Command Line updated way to work.
Previously you did not know which are the commands and even you were able to guess them, sometimes you may fail to write a letter. Let's imagine that you wanted to write: rectangle to start the rectangle command. If you're not a fast typewriter, you will most likely want to setup shortcuts. Let's imagine that you want write: rectangle. When you write: R, four options will be shown to you: r[e]ctangle, r[e]ctangle_height_constraint, r[e]ctangle_width_constraint, r[i]ght. If you will press I, the "right" word will be shown. If you press "e", all words with rectangle will be shown, and already "rectangle" world will be filled in. So if you will want to write: rectangle_width_constraint, you will have to type 4 letters: re_w and the words will fill automatically. At the end, if you have more words, if you will press enter, the first one from the list will be chosen. So if you will want to draw a rectangle, just press r and enter. Because after you press r, the "rectangle" is the first word from the list.
Another good thing is that the pre-calculation is independent of the commands, so may work with as many and as long commands are available, the way it works is made just to reduce the keystrokes you have to press. If you remember the plugin code capabilities to NaroCAD, if you will register your meta-actions, they will automatically auto-complete. If your company will start with words like: xtension_and_a_long name1, xtension_and_a_long name2, etc., typing just x, will expand to xtension_and_a_long name, and all you have to write is 1, 2, and so on.

1 comment:

Yantram BPO said...

Hi, I am Jeff D Marsh with Yantram - 3D Rendering, 3D Modeling Services Provider - a part of Yantram BPO Services Pvt. Ltd. We can serve your all kind of requirements like 3D Rendering - 3D Walkthrough, 3D Rendering, 3D Modeling, 3D Project Modeling.

Visit Us:-

I like your Ideas & tricks.

We are also provided 3d Services.