vb.net hello world. - frustrated, head banging

Nov 20, 2013 at 2:22 PM
Edited Nov 20, 2013 at 2:35 PM
does anyone have a simple wp8 hello world sample for vb.net - I've coded in vb for 15 years and cant get on with c#

I cant get anything to work in my experiments, mainly errors with the name/tag bootstrapper does not exist, or initializecomponent is not declared....

I've converted the most basic sample from http://wp.qmatteoq.com/first-steps-with-caliburn-micro-in-windows-phone-8-the-first-project/

but the app wont even build!


sorry for being thick but Im at a loss... which is very frustrating as I have apps I would like to see if I could migrate to use the framework.




App.XAML
<Application
x:Class="glp2.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:caliburnMicro="clr-namespace:CaliburnMicro">

<!--Application Resources-->
<Application.Resources>
    <caliburnMicro:Bootstrapper x:Key="bootstrapper" />
</Application.Resources>

<Application.ApplicationLifetimeObjects>
    <!--Required object that handles lifetime events for the application-->
</Application.ApplicationLifetimeObjects>
</Application>


app.vb
Imports System.Diagnostics
Imports System.Resources
Imports System.Windows.Markup

Partial Public Class App
Inherits Application

''' <summary>
''' Provides easy access to the root frame of the Phone Application.
''' </summary>
''' <returns>The root frame of the Phone Application.</returns>
Public Shared Property RootFrame As PhoneApplicationFrame

''' <summary>
''' Constructor for the Application object.
''' </summary>
Public Sub New()
    ' Standard XAML initialization
    InitializeComponent()

    ' Phone-specific initialization
    '   InitializePhoneApplication()

    ' Language display initialization
    '    InitializeLanguage()

    ' Show graphics profiling information while debugging.
    If Debugger.IsAttached Then
        ' Display the current frame rate counters.
        Application.Current.Host.Settings.EnableFrameRateCounter = True

        ' Show the areas of the app that are being redrawn in each frame.
        'Application.Current.Host.Settings.EnableRedrawRegions = True

        ' Enable non-production analysis visualization mode,
        ' which shows areas of a page that are handed off to GPU with a colored overlay.
        'Application.Current.Host.Settings.EnableCacheVisualization = True


        ' Prevent the screen from turning off while under the debugger by disabling
        ' the application's idle detection.
        ' Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
        ' and consume battery power when the user is not using the phone.
        PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled
    End If
End Sub
End Class

bootstrapper.vb


Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports Caliburn.Micro
Imports CaliburnMicro.ViewModels

Namespace CaliburnMicro
Public Class Bootstrapper
    Inherits PhoneBootstrapper
    Private container As PhoneContainer

    Protected Overrides Sub Configure()
        If Execute.InDesignMode Then Return

        container = New PhoneContainer()

        container.RegisterPhoneServices(RootFrame)
        container.PerRequest(Of MainPageViewModel)()
        AddCustomConventions()
    End Sub

    Private Shared Sub AddCustomConventions()
        'ellided  
    End Sub

    Protected Overrides Function GetInstance(service As Type, key As String) As Object
        Return container.GetInstance(service, key)
    End Function

    Protected Overrides Function GetAllInstances(service As Type) As IEnumerable(Of Object)
        Return container.GetAllInstances(service)
    End Function

    Protected Overrides Sub BuildUp(instance As Object)
        container.BuildUp(instance)
    End Sub
End Class
End Namespace
Nov 21, 2013 at 1:31 AM
I also work in VB and have converted and built several of the various CM examples in a VB version. (Un-fortunately none of the Windows 8 or phone apps yet). The screens example modeled on the Billy Hollis presentation is nothing short of marvelous and yes it works great in VB. I would be happy to share these examples with anyone who would send me their eMail address. Most of the C# to VB converters have trouble with the lambda expressions as used in CM and struggle with more advanced C# to VB conversion, so it can be a hassle to get started in CM with VB. The good news is that all you need to do is make your way through the conversion once and from then on its clear sailing (and well worth the trouble).