why not add a "Buy the App" button ?

Jan 30, 2012 at 4:09 AM

The review button is easy to use.  I think it's better to add a "buy" button.  If my app supports trial mode, it's easy to bring the user to the application in the Windows Phone Marketplace so that the user can buy the application.

Thanks a lot!  8-)

Jan 30, 2012 at 4:38 AM

OK...I make it myself. I can not wait, 8-) .

ApplicationInfoView.xaml:

add:

<Button HorizontalAlignment="Center"
                    Visibility="{Binding MainItemData.AppBuyButtonContent, Converter={StaticResource StringToVisibilityConverter}}"
                    Margin="0 15 0 0"
                    Tag="Buy"
                    Content="{Binding MainItemData.AppBuyButtonContent}"
                    Command="{Binding ReviewCommand}" />

AboutViewModel.cs:

add this code after "public RelayCommand ReviewCommand"

public RelayCommand BuyCommand
        {
            get;
            private set;
        }

edit:

public AboutViewModel()
        {
            LoadManifestData();
            LoadAboutData();

            ReviewCommand = new RelayCommand(Review);
            
            BuyCommand = new RelayCommand(Buy);
        }

add this code after "private void Review()"

private void Buy()
        {
            try
            {
                var task = new MarketplaceDetailTask();
                task.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occurred while opening the marketplace: " + ex.Message);
            }
        }

add this code after "private const string AttributeUri = "Uri";"

private const string AttributeAppBuyButtonContent = "AppBuyButtonContent";


edit:

        private void LoadMainItemData(XElement itemElement)
        {
            MainItemData = new MainItemData();

            // get data
            MainItemData.Title = GetAttributeValue(itemElement, AttributeTitle, "about");
            MainItemData.AppAuthorLabel = GetAttributeValue(itemElement, AttributeAppAuthorLabel, "by");
            MainItemData.AppPublisherLabel = GetAttributeValue(itemElement, AttributeAppPublisherLabel, "Publisher:");
            MainItemData.AppDescriptionLabel = GetAttributeValue(itemElement, AttributeAppDescriptionLabel, "Description:");
            MainItemData.AppVersionLabel = GetAttributeValue(itemElement, AttributeAppVersionLabel, "Version:");
            MainItemData.AppAdditionalNotesLabel = GetAttributeValue(itemElement, AttributeAppAdditionalNotesLabel, "Additional notes:");
            MainItemData.AppReviewButtonContent = GetAttributeValue(itemElement, AttributeAppReviewButtonContent, "Review this app!");
            
            MainItemData.AppBuyButtonContent = GetAttributeValue(itemElement, AttributeAppBuyButtonContent, "Buy this app!");
            // load all links
            var linkElements = itemElement.Descendants(ElementLink);
            foreach (var linkElement in linkElements)
            {
                var link = LoadLinkData(linkElement);
                Links.Add(link);
            }
        }


MainItemData.cs:

add this code after "public string AppReviewButtonContent":

public string AppBuyButtonContent
        {
            get;
            set;
        }

It works fine.

Thanks! The source code is easy to read.

Coordinator
Feb 1, 2012 at 4:46 AM

Hi Yan,

thanks again for your input. I'll see if this can be added to the next release.

Some additional work may be required (e.g. a check whether the button makes sense/if the app is in trial mode), but your code still looks fine.

Thanks,
Peter 

Feb 1, 2012 at 5:14 AM

You're right. It needs a option for the buy button. 

I hope you do better!

Thank you for your work!

Feb 9, 2012 at 9:20 AM

Sweet, I was looking for an option to add a Buy button. Nice that it's being looked into. Any idea when you might get it included in a release?

Coordinator
Feb 9, 2012 at 9:57 AM

I'll relese the new version with that feature and fixes this weekend.

Feb 9, 2012 at 12:47 PM

Nice, thanks.

I've been looking at using Trial mode, but I've decided to go with a free Lite app and a paid app, and I have two questions based on this use case:

Will there be a way for me to tell it to show the Buy button other that using LicenseInformation.IsTrial? I want to use the same code base, but toggle which to build using compiler directives and build configurations. It would be great if I could:

#if FREE_VERSION
    //Enable Buy button
#else
    //Do not show Buy button

Can I override which app it will open in Marketplace via the Buy button? Since I want this in my free lite version, I want it to go to my full version in Marketplace.

Coordinator
Feb 9, 2012 at 2:27 PM

Yes, it will be flexible enough to decide or override yourself when to show the button, and what app id it points to. I've just not settled on how the exact handling will look like yet.

Coordinator
Feb 13, 2012 at 6:30 AM

This is now part of version 1.4. Take a look at the documentation (section "Trial Mode") for details.

Feb 13, 2012 at 6:35 AM

Sweet!

Took a brief look at the documentation now and it looks great. Will have a look at getting it in my app later today.

Keep up the good work, it's much appreciated!

Feb 13, 2012 at 10:27 AM

Thanks!8-)

Feb 14, 2012 at 2:15 PM

In the same line of thinking, it would be really cool to add a list of other apps.  http://channel9.msdn.com/coding4fun/articles/Let-your-apps-sell-themselves

Coordinator
Feb 16, 2012 at 9:35 PM

Hi wekempf. Something like this can easily be integrated as-is. The documentation (in particular the part on "Additional items" and "Local and remote Xaml") shows how to integrate such custom pages/user controls.

Feb 20, 2012 at 2:20 PM

Yes, I know you can extend the dialog in this manner, I just thought this would be a common enough extension to make sense to include directly within the framework.

Mar 18, 2012 at 4:51 PM

I don't agree adding it directly to the framework. The dialog pages are very flexible and should remain so IMHO. If you want a list of apps, its easy to provide a local or remote snippet of xaml for this. Force it into the framework means if I don't want it then I have something extra to remove.