Is there a way to add a menu entry to each system menu in the system?
The system menu is described here.
Rationale: provide easy access to recurring logic.
Out-of-the box using regular Dynamics AX development techniques, I don't think it is possible. I also think you shouldn't, it certainly is not best practice.
Consider:
Using favorites
Overwriting the task method on a form to capture shortcuts (you could create hotkeys for your functions or launch a form with functions to perform)
Add a toolbar to your forms, similar to what workflow does, see SysSetupFormRun.init where workflow controls are added to forms.
Related
I'm working on application with some sort of CMS features. I need some pages to be editable. For instance:
you can edit a text block right in your browser
you can add and remove different modules to your page
For instance, if I have a main page I may want to edit welcome text.
If I have a sidebar I may want to add/remove new modules to the sidebar such as:
email subscription module
social network (facebook, twitter, etc) links block
text block
My application may have several pages, not only one.
I want to keep it simple and I'm looking for the right approach/examples/existing tools.
What's the best pattern / third-party solution for ASP .NET in order to implement this and keep it simple?
If you want to use ASP.NET MVC I think the best solution is to look into Orchard. It's really easy to get up and running, has a rich set of existing modules and building a module from scratch is really easy. This was actually started by a couple of Microsoft guys and then spun out into it's own open source project. http://www.orchardproject.net/
Our development team has a number of semi-technical users that act as intermediaries between our developers and domain experts. One of their tasks is building forms using a very clumsy, antiquated system that makes their job much harder than it should be.
I'd quite like to create toolbox controls similar to the standard HTML controls that simply render an MVC partial e.g.
<% Html.RenderPartial("UserProfilePartial", ViewModel.UserProfile); %>
but presented as a friendly toolbox item with an icon. This way our developers can create reusable form elements that they can simply drag and drop around in the design view. While this may sound like anathema to most developers, they're quite excited about the possibility.
Creating a custom server control does not appear to be the right approach, as it always insists upon adding a register statement to the head of the view, and it also seems to insist upon rendering controls with the <cc{0}...> prefix.
How can I create a Toolbox control that just renders arbitrary markup?
I blogged a while ago about how to write declarative ASP.NET controls for use with ASP.NET MVC. If you want a design-view experience then controls are the only option since that's the only code you get to run in the VS designer.
Having said that, Darin's two links are definitely the most MVC-friendly way to go. Some folks don't like seeing controls in their MVC view pages. Then again, it's strictly a matter of opinion, it's neither right nor wrong, nor is it even a bad practice. So if it fits your team's needs, go for it!
Is there an add-in for the VSIDE that allows you to visually construct ASP.NET MVC solutions? Back in my struts days there were a number of options that made hooking together Views/Models/Controllers easy and interactive.
There is tooling support in MVC tools for VS 2008/2010 which helps in performing common tasks, such as
Add Area,
Add Controller,
Add View,
Go To View,
etc
...
they all use current context when creating artifacts. For example, when you are using "Add View" you can choose to create strongly typed view and perform operation you want (CRUD) over Model data passed to it.
Not 100% visual in a way that you can draw diagram of controllers, views and models and hook them together.
Not sure if this answers your question but if you are familiar with the tools, it will probably be helpful to others.
What is the best way to structure a VB.NET Windows Forms application so that code can be reused and the application can be extended easily?
I used to create lots of new forms. This lead to lots of repeated code and forms which did similar things.
Now, for forms which do similar jobs, such as view/edit/delete items from a specific database table, I create a form with the required controls, have the form create an instance of a class with parameters such as a collection of the controls and a string containing the database table name. Then the individual controls call functions of the class.
Advanced forms will inherit and extend this basic form class.
Has there already been work done in this area?
Are there books / articles available which discuss the options available on this topic?
I had great success with this Passive Screen pattern.
In my opinion, the big problem of the traditional MVC architecture is that people stuff way too much into the form classes. This increases the amount of manual testing you have to do.
The more automated testing you can do after you compile, the more bugs you will catch at your desk. In a complex application, the side effects from even minor changes occur all too often.
The trick to solving this is making a controller assembly that the form assembly (or EXE) references. Every form has a corresponding class in the assembly. Clicking a button will call ThisForm.ThisButton(<args>) which will then fire objects lower in your framework. Each form implements an interface so that, if the controller class needs additional information from the form, it has a interface to retrieve it.
Then for your unit testing you simulate an operator performing complex operations by implementing dummy classes to fire events and feed information to the controller classes. The controller classes don't know any different as the dummy classes implement all the expected interfaces.
There is an important exception and that is for trivial dialogs. For dialogs that have a few check boxes I feel this organization is overkill. I use the command pattern a lot. So in the assembly where I define the Command objects, I put the SIMPLE dialog associated with that command. How simple a dialog has to be to get this treatment is up to you.
I like to structure my applications as follows.
Utility - This is an assembly that has stuff I use all the time - Math functions, file function, etc.
Objects - This has the specific objects I am using for this application.
UIFramework - This defines all form and controller interfaces.
Commands - This has all the Command objects that manipulate my application objects.
UI - Objects that implement the controller interfaces
EXE - Forms that implement the form interface and calls the controller objects.
You may want to check out a Rocky Lhotka's popular CSLA Framework. It provides a very structured way to implement business objects so you can keep the non-UI code out of your forms. Beyond just separating your business logic though, it provides built in n-level undo, validation, security, data binding support, etc.
The one complaint most commonly directed at CSLA is that it makes test driven development difficult, so that may be something to consider as well.
Something that can help a lot is the use of User Controls. With user controls you can reuse the same UI in different forms. Also, you can have many user controls on one form, so if you have a form with a tabcontrol that has 5 tabs, the content of each tab could be a user control, so instead of having hundreds of controls all mixed up in one form, each user control has its own controls and validation logic, and you end up with just six controls in the form: the tabcontrol and the 5 user controls.
This doesn't help in separating UI code from application logic, but it enables you to have small, structured entities instead of forms with thousands of lines of code.
Except for the purpose of reuse if repeating for more than one webpage, do usercontrols in this model offer any other advantage?
They offer a way to hide complexity. You can put a complex control into the user control and not worry about the nitty gritty details when your working on the page.
I think this is a huge benefit of user controls in general.
If you use them wisely, they may provide better understandability. A user control is a part of your markup. You provide a part of your model to it.
So, for e.g. if your model is a List of type A where A has a complex property B which requires a complex markup, it makes sense to use a user control U which uses A.B as its model. Your code is now simpler and if you want to change or replace ui of the B only, you just replace or modify U instead of looking for its markup in V.