Search This Blog

Friday, September 30, 2016

How to find and deactivate a problematic Controller "on the fly" via an application UI for troubleshooting purposes

I wanted to repost a troubleshooting tip our old XAFer and MVP Dave Hesketh has kindly provided in the Support Center today. BTW, Dave also provides XAF training and custom development services, based out of Ontario, Canada, so this may be not the last thing you would want to learn from him and his website

So, let me focus on the problem and solution he described at https://www.devexpress.com/kb=T433881 and also also quickly show it all in action with one of the XAF demos:

"I have come across a few scenarios where something seems to be slowing down an XAF solution and it is tough to determine where the issue exists. This can then lead to hours of tearing out controllers to try and determine if one is problematic.

To make this process easier, I have created a module that you can add to an XAF solution to Enable and Disable controllers on the fly.

Once you add this module to your solution, you will find the "Show Controller Settings" action in the Tools menu. In the dialog that appears, you can enable or disable any controllers you wish, or click the "Disable Custom Controllers" to disable non-DevExpress controllers (A good starting place). 

Please note: Once you enable or disable controllers, you must re-open a view for the change to take effect. 
This solution has been tested on existing Win Applications only."





I remember a couple of similar requests from other guys, and indeed, this dynamic exclusion of Controllers without recompiling and restarting the whole app can be helpful when researching certain complex problems like performance or behavioral/visual side effects. For many other cases, the built-in Diagnostic Actionapplication log files, and performance profilers would suffice pretty well. 

Anyway, let's check how to use Dave's module with our MainDemo.Win app. Consider the following steps:

Monday, September 26, 2016

How to skip the logon dialog when debugging or testing an XAF app with the security system enabled

Sometimes during active development, you may find yourself in front of the logon form entering user credentials again and again, and it may eventually become boring. This simple to implement tip will not only save you development time, but also irritation. I wanted to highlight this technique for everyone here after assisting my colleague in this SC ticket + because another customer also found this solution helpful. Since, I also remembered that we have been using a similar thing internally for the installation tests of our demos, I think it is definitely time to let the rest of the world know about this as well.



Steps to implement


1. The instructions below imply that you have already created an XAF WinForms or Web app with the Security module, and its SecurityStrategyComplex and AuthenticationStandard components either using the Solution Wizard or manually. You likely also created predefined users and roles in code or using the application UI at runtime. Consult with the XAF online documentation for more details.

Thursday, September 15, 2016

Simplifying customization of Action controls - YOUR FEEDBACK IS NEEDED!

As you know, XAF provides abstractions for common UI elements like list and detail forms, their editors, main and navigation menus, etc. that enable XAF developers to accomplish common tasks for several supported platforms with less effort. Today I want to take a moment of your time and focus on popular customization tasks related to Actions - typically abstract UI elements that allow you to perform specific operations in response to end-user manipulations.



For instance, the ActionBase class, which is the super class for all Action types provides many useful members like Caption, ToolTip, Shortcut, PaintStyle, Enabled, Active, etc. that help you care less of technical implementation details for each specific platform or situation, at least for the popular tasks these members were designed for. It is also super easy to manage these properties and events in code or via the visual designers like the Visual Studio component designer for Controller or our own Model Editor.




Current approaches for customizing Action controls

The above looks very well (and many XAFers expressed this is one of the things they love the product for) and we have always been trying to keep this promise when designing our framework:
common and simple tasks can be done easily, while any specific or complex tasks are technically possible

But what about the second part of this promise with regard to Actions in practice? To answer this, it is best to evaluate it yourself for various tasks. Our documentation and support knowledge base contains many code examples for customizing Action controls in various places of an XAF application, and I grouped them below for your review.

How to provide a specific View layout for users of certain security roles

I would like to quickly promote a recent update to our old Code Example in the support database: https://www.devexpress.com/example=E274
I hope you find this solution helpful. Let me know in case of any questions, suggestions or share your experience with other XAFers on how you are doing a similar task at the moment. Thanks!

Scenario:
This example demonstrates how to show a custom View against a role of the currently logged user. Custom Views were created and customized through the Model Editor for each role separately. For more convenience, custom Views have a name of a role in the Id attribute. For instance: Contact_ListView_Administrators, Contact_DetailView_Administrators, Contact_ListView_Users, Contact_DetailView_Users, etc. You may consider a specific naming convention, for example, to add a role name to the end of the view name. Use User and Admin user names with empty password to login into the application.



Implementation details:
There is E274.Module\Controllers\CustomizeViewAgainstRoleMainWindowController that tracks View showing using theXafApplication.ViewCreating event and replaces the default View's Id with a custom Id found in the Application Model by the role name. 

Monday, September 12, 2016

Why can a DetailView be not editable or display empty values?

This small thing may hit even experienced XAFers, so I want to post this tip here for the future. In fact, I created a corresponding KB article a few months ago, but forgot to promote it in my blog. So, here we go: https://www.devexpress.com/kb=T382896

SYMPTOMS
1. You are creating a new detail form via the XafApplication.CreateDetailView API in a Web application, but it does not allow users to enter any information; e.g., they can't write/select anything into/from lookups. The View controls also look "readonly" or disabled. The same code produces an editable DetailView in WinForms, though.
2. Same readonly View editors as in the previous point, but the controls do not display any values either + the code does not work in both WinForms and ASP.NET apps.
3. You are opening a DetailView of an object that was deleted by another user. This way, this behavior is normal and expected as removed data can no longer be edited.



SOLUTIONS
1. Make sure you have set the DetailView.ViewEditMode property to the DevExpress.ExpressApp.Editors.ViewEditMode.Edit value. For example, check the snippet from this KB Article:

Monday, September 5, 2016

About searching freelancers, programmers, consultants with the DevExpress expertise and XAF in particular


I have recently come back from a 3 week vacation on Crete and I feel in a good mood for blogging. BTW, in my first-time experience, this place has a plethora of sights for both active and cultural holidays, crystal clean sea, tasty traditional and sea food, fruits plus Greeks being very nice people all with a funny Tolis-like accent:-) - it will be the reason for my pleasant memories again and again.

Today, I want to cover a question which I periodically receive privately or in the Support Center:

"Can you recommend anyone that might be interested in working as a consultant/programmer to help us develop our XAF app?"


Well, there are surely many developers that can qualify for this, and the first and probably the best way of locating XAF freelancers (as well as freelancers for any other technology) is using specialized services like https://www.upwork.com and https://www.freelancer.com. I just picked the two ones from the top of my head, so there may be alternatives and you must learn more on them first. For instance, check these example queries:

Thursday, September 1, 2016

Minor usability improvement - Nullable values support for boolean property editors

In short, this feature was already supported by the underlying WinForms CheckEdit and ASP.NET ASPxCheckBox controls, but it required writing some custom code in XAF apps. Now this coding is no longer required for XAF users if they need a Nullable<bool> property.

Starting with v16.1.6, the two built-in XAF editors support boolean Nullable properties. In the UI, when the check box is used, nullable properties will be displayed using a third 'grayed' state. When a drop-down editor is used, an empty 'null text' item will be available. Technically, the PropertyEditor.AllowNull must return True for the aforementioned UI transformations to take effect.

Please see the following code examples and screenshots for more details:

        public bool? ThreeStateCheckBox {
            get;set;
        }
        [CaptionsForBoolValues("Checked", "Unchecked")]
        public bool? ThreeStateDropDown {
            get;set;
        }


Web

Windows


Simplifying the migration from SecuritySystemUser to the new PermissionPolicyUser API

We have recently prepared a KB article on the subject: How to use the new Allow/Deny permissions policy in the existing project and hope to hear your feedback on it and this new Allow/Deny security feature in particular. If you have not yet heard about it and its possible benefits for your project, I recommend you review the Concepts > Security System > New Security System > Permission Policies documentation along with a short overview video on our YouTube channel.



As a side note, a quite popular How to hide individual navigation items and groups for certain users example was updated to use the new PermissionPolicyRole class.

As always, our team is more than happy to learn more on how our security module can help your business better or assist in case of any difficulties. Feel free to contact us via the Support Center: https://www.devexpress.com/Support/Center/Question/Create  or in comments here.

UPDATED:
See also this post from our old customer http://www.codeproject.com/Articles/1153095/How-to-migrate-DevExpress-XAF-SecuritySystemUser-t  for an alternative migration procedure.