How to : integrate an augmented viewfinder to your application

  • Add the AugmentedViewFinder control to the view of your choice (preferably full screen, landscape mode):
xmlns:arvf="clr-namespace:ARViewFinder.Controls;assembly=ARViewFinder"

arvf:AugmentedViewFinder DataContext="{Binding AugmentedViewFinderViewModel}" />
  • Add an AugmentedViewFinderViewModel either in or as the ViewModel of this page
The AugmentedViewFinderViewModel model will hold a list of objects to displayed, grouped according to their bearing.
  • Implement the IAugmentable interface on the objects you wish to display - if you want to keep it pure MVVM these should a ViewModel.
When implementing this interface, set the Distance and Bearing field so that they can be set and read from. The framework will handle the calculation of these, no need for you to do complex calculation!
The default implementation would look like this:
private double _distance;
public double Distance
{
    get
    {
        return _distance;
    }
    set
    {
        if (_distance != value)
        {
            _distance = value;
            NotifyPropertyChanged("Distance");
        }
    }
}

private double _bearing;
public double Bearing
{
    get
    {
        return _bearing;
    }
    set
    {
        if (_bearing != value)
        { 
            _bearing = value;
            NotifyPropertyChanged("Bearing");
        }
    }
}

  • Populate the collection of IAugmentable objects inside the AugmentedViewViewModel with your data:
AugmentedViewFinderViewModel.Items = new ObservableCollection<ARViewFinder.IAugmentable>(
                        from feed in ViewModel.FeedsAroundHere
                        select new FeedViewModel()
                        {
                            Feed = feed
                        } as ARViewFinder.IAugmentable
);
  • you're done for the basics!
  • Want more? you can implement the AugmentedItemSelected event. This will allow your user to select an element directly on the Augmented view and return it to you so you can do whatever you want with it (refresh, navigate to a details page...)

Last edited Jan 23, 2012 at 9:34 AM by pierreca, version 6

Comments

No comments yet.