Error with VB.NET

2 posts, 0 answers
  1. HSLaw
    HSLaw avatar
    153 posts
    Member since:
    Jan 2006

    Posted 22 Sep 2014 Link to this post

    Hi,

    var notification = new PushNotification();
     
                var androidNotificationPayload = new Dictionary<string, object>()
                {
                    {
                            "data",
                            new Dictionary<string, object>()
                            {
                                { "title", "title for android" },
                                { "message", "message for android" },
                                { "customData", "custom for android"},
                            }
                    }
                };
     
                notification.Android = new Telerik.Everlive.Sdk.Core.Model.System.Push.Android.AndroidNotification();
     
                foreach (KeyValuePair<string, object> pair in androidNotificationPayload)
                {
                    notification.Android.SetValue(pair.Key, pair.Value);
                }
     
                var settings = new EverliveAppSettings()
                {
                    ApiKey = "removed",
                    UseHttps = false
                };
     
                var app = new EverliveApp(settings);
                var result = app.WorkWith().Push().Notifications().Create(notification).ExecuteSync();


    After convert the code above into VB.NET with Telerik's Code Converter, I get this error:
    http://postimg.org/image/e51es70lv/

    How should I modify it?

    Thanks.




  2. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 22 Sep 2014 Link to this post

    Hi,

    Here is the correct VB code:
    Imports Telerik.Everlive.Sdk.Core.Model.System.Push
    Imports Telerik.Everlive.Sdk.Core
     
    Module Module1
     
        Sub Main()
            Dim notification = New PushNotification()
     
            Dim androidNotificationPayload = New Dictionary(Of String, Object)() From { _
                {"data", New Dictionary(Of String, Object)() From { _
                    {"title", "title for android"}, _
                    {"message", "message for android"}, _
                    {"customData", "custom for android"} _
                }} _
            }
     
            notification.Android = New Telerik.Everlive.Sdk.Core.Model.System.Push.Android.AndroidNotification()
     
            For Each pair As KeyValuePair(Of String, Object) In androidNotificationPayload
                notification.Android.SetValue(pair.Key, pair.Value)
            Next
     
            Dim settings = New EverliveAppSettings() With { _
                .ApiKey = "removed", _
                .UseHttps = False _
            }
     
            Dim app = New EverliveApp(settings)
            Dim result = app.WorkWith().Push().Notifications().Create(notification).ExecuteSync()
     
            '=======================================================
            'Service provided by Telerik (www.telerik.com)
            'Conversion powered by NRefactory.
            'Twitter: @telerik
            'Facebook: facebook.com/telerik
            '=======================================================
     
        End Sub
     
    End Module

    Seems that the converter prefixed the ApiKey and UseHttps properties with a 'Key'. Removing it corrected the error.

    Let me know if you have further questions.

    Regards,
    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
Back to Top