The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
Trial Experience Help (VB) RRS feed

  • Question

  • I have gotten my example on how to create a trial experience during debugging from this location, however, the code is all in C#, so In used this to convert the code to VB. I am not sure if the problem displayed below is a coding error or something else. Could someone please help me out?

    Visual Studio Error

    Heres the code I used for the Trial experience via App.xal.vb:

    Private Shared _licenseInfo As New LicenseInformation()
        Private Shared _isTrial As Boolean = True
    
        Public ReadOnly Property IsTrial() As Boolean
            Get
                Return _isTrial
            End Get
        End Property
    
        ''' <summary>
        ''' Check the current license information for this application
        ''' </summary>
        Private Sub CheckLicense()
    
            _isTrial = _licenseInfo.IsTrial()
            ' When debugging, we want to simulate a trial mode experience. The following conditional allows us to set the _isTrial 
            ' property to simulate trial mode being on or off. 
    #If DEBUG Then
            Dim message As String = "This sample demonstrates the implementation of a trial mode in an application." + "Press 'OK' to simulate trial mode. Press 'Cancel' to run the application in normal mode."
            MessageBox.Show(message, "Debug Trial", MessageBoxButton.OKCancel)
            If MessageBoxResult.OK Then
                _isTrial = True
            Else
                _isTrial = False
            End If
    #Else
    #End If
        End Sub

    Thanks!

    Zack


    Zack Bowling

    Tuesday, December 2, 2014 4:45 PM

Answers

  • I believe you are too early to make a call to your licenses-function. For example you may not use MessageBox.Show within the event Startup of app.

        Private Sub App_Startup(sender As Object, _
                e As StartupEventArgs) Handles Me.Startup
            MessageBox.Show("TEST1")
        End Sub

    So replace MessageBox.Show by Debug.WriteLine (...) and it will be OK.

    Tuesday, December 2, 2014 5:25 PM

All replies

  • I believe you are too early to make a call to your licenses-function. For example you may not use MessageBox.Show within the event Startup of app.

        Private Sub App_Startup(sender As Object, _
                e As StartupEventArgs) Handles Me.Startup
            MessageBox.Show("TEST1")
        End Sub

    So replace MessageBox.Show by Debug.WriteLine (...) and it will be OK.

    Tuesday, December 2, 2014 5:25 PM
  • Thank you very much my friend! This helped me, I very much appreciate this!

    Zack Bowling

    Tuesday, December 2, 2014 6:12 PM
  • If you found my answer helpful, please vote for it and mark your post as answered.

    Tuesday, December 2, 2014 6:41 PM