Category Archives: Uncategorized

Hip Shot Update with iPhone 5 Support Available


A new update for Hip Shot is available from the iTunes App Store. This update includes the following changes:

  • Support for the new 4″ Retina display in the iPhone 5
  • Support for the new Retina display in the 3rd generation iPad
  • The ability to specify a default injection method

While previous versions of Hip Shot work wonderfully on the iPhone 5 and the 3rd generation iPad, the new graphics in this update ensure that Hip Shot looks as gorgeous on these new devices as it does on previous generation iPhones and iPads.

These changes come thanks in no small part to Alan Sevajian, who continues to create wonderful graphics for the app. He created all new super-hi-res graphics for this update with new images consisting of up to 3 million pixels each. His work is what makes this update look super crisp on the latest devices.

Hip Shot is available from the App Store and, as always, proceeds are donated to the National Multiple Sclerosis Society.

Advertisements

Password Tote for Mac OS X Updated

Password Tote for Mac OS X 1.0.3 is now available for download. This update includes:

  • Importing from LastPass
  • Growl integration with notifications when the user should backup and when an account will expire
  • User interface enhancements, including a new icon
  • A new PKG installer

The Password Tote website is free and allows you to manage your passwords securely from any location. The desktop and mobile applications require a $2.99/mo subscription. Start your free two month trial here.

The iOS and Mac OS X versions of Password Tote use the outstanding communication libraries from RemObjects, and the Windows version’s slick visual styling comes from DevExpress’s WinForms controls.

User Owned Objects in XAF

Working on a little XAF project, I recently had the need (a common one) to support the concept of objects being owned by certain users. When a user logs in, he or she should only see the objects owned by that user. This needed to apply to both the list views and the data available in reports.

In the end, this was fairly easy to do. I thought I’d share some notes about how I accomplished this, as some of the resources online are a bit outdated, or don’t lay all of these aspects out together.

Note that there is currently a request to support this sort of scenario directly in XAF’s security system. You can track the issue here.

The first thing to do is define the business object itself (we’ll called it OwnedObject). The only thing particularly interesting here is defining a property to reference the object’s owner, and initializing that value:

public class OwnedObject : BaseObject
{
    public OwnedObject(Session session) : base(session) { }

    public override void AfterConstruction()
    {
        base.AfterConstruction();
        if (Session.IsNewObject(this))
        {
            _ObjectOwner = Session.GetObjectByKey<SimpleUser>((Guid)SecuritySystem.CurrentUserId);
        }
    }

    private SimpleUser _ObjectOwner;
    public SimpleUser ObjectOwner
    {
        get
        {
            return _ObjectOwner;
        }
        set
        {
            SetPropertyValue("ObjectOwner", ref _ObjectOwner, value);
        }
    }
}

One way to filter list views by this ObjectOwner property is discussed here. Open up the XAFML file for the platform agnostic Module project. Navigate to the OwnedObject_ListView node under Views. Set the Criteria to ObjectOwner.Oid = '@CurrentUserID'. Here, ObjectOwner is the property defined on the OwnedObject class, and @CurrentUserID is expanded at runtime to contain the current user’s ID.

Set the same Criteria property on the OwnedObject_LookupListView node as well, and run your application. Both the WinForms and ASP.NET applications should now only show the objects created by the current user, which is automatically set when the object is created. Note that you can also accomplish the same thing with a View Controller.

You can hide the ObjectOwner property at runtime by deleting its respective items under the DetailView, ListView, and LookupListView nodes in the model editor. Also note that this can easily be applied to reports as well, so that a user only sees his or her reports. Simply descend a new object from ReportData, and use your OwnedReport as the data type for the report views.

This is all pretty cool with minimal code, but one issue that needs to be addressed is the data shown in reports. If a user were to create and run a report on OwnedObjects, they’d see all objects regardless of owner. This is also fairly easy to fix, but requires two solutions, one for the WinForms project and one for the ASP.NET project.

The solution for the WinForms project is discussed here. To the WinForms module, add a new View Controller. You’ll also need to add references to ExpressApp.Reports, ExpressApp.Reports.Win, XtraReports, and XtraReports.Design. Add the following code to your controller:

protected override void OnActivated()
{
    base.OnActivated();
    XtraReport.FilterControlProperties += XtraReport_FilterControlProperties;
    Frame.GetController<WinReportServiceController>().CustomShowPreview += ViewController1_CustomShowPreview;
    Frame.GetController<WinReportServiceController>().CustomShowDesignForm += ViewController1_CustomShowDesignForm;
}

void XtraReport_FilterControlProperties(object sender, FilterControlPropertiesEventArgs e)
{
    if (e.Control is XtraReport)
    {
        e.Properties.Remove("FilterString");
    }
}

void ViewController1_CustomShowDesignForm(object sender, CustomShowDesignFormEventArgs e)
{
    e.Report.FilterString = CriteriaOperator.Parse("ObjectOwner.Oid=?", SecuritySystem.CurrentUserId).ToString();
}

void ViewController1_CustomShowPreview(object sender, CustomShowPreviewEventArgs e)
{
    e.Report.FilterString = CriteriaOperator.Parse("ObjectOwner.Oid=?", SecuritySystem.CurrentUserId).ToString();
}

protected override void OnDeactivating()
{
    base.OnDeactivating();
    Frame.GetController<WinReportServiceController>().CustomShowPreview -= ViewController1_CustomShowPreview;
    Frame.GetController<WinReportServiceController>().CustomShowDesignForm -= ViewController1_CustomShowDesignForm;
}

Basically, when the controller is activated, it will add two event handlers to the report service controller for WinForms applications – one for when a preview is shown, and one for when the report is designed. These events force a criteria that only shows objects owned by the current user. The FilterControlProperties event hides the FilterString property.

I had to figure out the ASP.NET portion on my own, but it wasn’t hard. Based on the WinForms solution above, I knew to look at the WebReportServiceController. Turns out you can simply descend from that class and override ShowPreviewCore to filter the data.

For the ASP.NET module, add a new class. Descend the class from WebReportServiceController and add the following code:

protected override void ShowPreviewCore(IReportData reportData, CriteriaOperator criteria)
{
    criteria = new BinaryOperator("ObjectOwner.Oid", SecuritySystem.CurrentUserId);

    base.ShowPreviewCore(reportData, criteria);
}

You’ll also need to add references to ExpressApp.Reports, ExpressApp.Reports.Web, XtraReports, and XtraReports.Web. This does essentially the same thing as the WinForms solution, overriding the preview of the report to force a filter on the object’s owner.

With those two changes made, you can now run both the WinForms and ASP.NET XAF applications, create and run reports, and you will only be able to see your own objects.

You can download a sample that demonstrates all this here.

New Version of Password Tote for Mac OS X Available

Version 1.0.1. of Password Tote for Mac OS X (powered by RemObjects SDK for Xcode) is now available for download. This version brings a few new features and fixes, most notably:

  • The ability to import passwords from 1Password and KeePass
  • The ability to check for new updates from within the program
  • More consistent password generation
  • Minor bug fixes

As previously stated, there’s also an update for the iOS app in the works as well. Version 1.0.1 for iOS is just going through some final testing before submitting the update to Apple for approval.

Size a Delphi Form to fit an ExpressLayout Control’s Content

Today I was faced with the need to have some MDI child forms automatically size to fit their contents. These forms all descend from a base form that has an ExpressBars bar manager and an ExpressLayout layout control. I was surprised (though I shouldn’t be at this point) at how easy this was to achieve:

procedure TDataDetailsForm.FormShow(Sender: TObject); 
begin 
  inherited;      
  SizeToRootLayoutContents; 
end;

procedure TDataDetailsForm.SizeToRootLayoutContents; 
begin 
  ClientWidth := DetailsLayoutControlGroup_Root.ViewInfo.Bounds.Right - 
    DetailsLayoutControlGroup_Root.ViewInfo.Bounds.Left + 
    (DetailsLayoutControl.LayoutLookAndFeel.Offsets.RootItemsAreaOffsetHorz * 2); 
  ClientHeight := DetailsLayoutControlGroup_Root.ViewInfo.Bounds.Bottom - 
    DetailsLayoutControlGroup_Root.ViewInfo.Bounds.Top + 
    (DetailsLayoutControl.LayoutLookAndFeel.Offsets.RootItemsAreaOffsetVert * 2) + 
    DetailsBarManagerBar1.RealDockControl.Height; 
end;

With that bit of code in place, each form now automatically size to fit its contents when shown, but can still be freely resized.

What is tide?

To call tide an application framework is, in my humble opinion, an overstatement. Even the term plugin framework seems like a bit much – after all, that’s what RemObjects Hydra is.

Perhaps scaffolding is a better term – or is that only for user interfaces generated from DB’s?

So what is tide?

The bits and pieces that make up tide will be:

  • A great starting point for many .NET applications that will make use of DevExpress WinForms controls and RemObjects Hydra
  • A sort of working tutorial on how the myriad of DevExpress controls interact at an application level
  • The completed Northwind client will serve as a nice sort of “mega-demo” for both the DevExpress WinForms controls and RemObjects Hydra for .NET

So, now, what should you expect from the completed Northwind client? My plans are to provide:

  • A working application for editing the customers and orders in Northwind, including the usual CRUD functionality
  • A functioning options plugin for setting up the Northwind connection
  • Browse and detail screens screens for viewing, searching, and filtering customers and orders
  • A sample registration plugin, written in Delphi, to illustrate incorporating software registration and using RemObjects Hydra to load plugins from Delphi

And, over time, who knows what else may creep in – scope creep is okay in demos no?

Of course, as discussed before, because this uses the tide framework (someone please give me a better word!), this all comes with “automatic” support for great controls from DevExpress, including the Ribbon from Microsoft’s Fluent Interface, live spell-checking, printing, exporting to various file formats, Visual Studio 2008-style docking, runtime layout customization, and much more.

More importantly, the demo should illustrate that all of this functionality comes (from DevExpress and RemObjects really), at very little cost in terms of source code written and maintained. Most of these features come from supporting one or two methods of an implemented interface.

More to come soon. Have a great 4th of July, if I don’t find time to post beforehand!