This is a migrated thread and some comments may be shown as answers.

Error with VB.NET

1 Answer 64 Views
.NET SDK
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
HSLaw
Top achievements
Rank 1
HSLaw asked on 22 Sep 2014, 08:39 AM
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.




1 Answer, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 22 Sep 2014, 11:07 AM
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.
 
Tags
.NET SDK
Asked by
HSLaw
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
Share this question
or