Skip to content

Instantly share code, notes, and snippets.

View guntidheerajkumar's full-sized avatar
💭
Happy

Dheeraj Kumar Gunti guntidheerajkumar

💭
Happy
View GitHub Profile
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef" : "EntityFramework.Commands"
},
public static NSDate DateTimeToNSDate(this DateTime date)
{
DateTime reference = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(2001, 1, 1, 0, 0, 0) );
return NSDate.FromTimeIntervalSinceReferenceDate( (date - reference).TotalSeconds);
}
public static DateTime NSDateToDateTime(this NSDate date)
{
DateTime reference = TimeZone.CurrentTimeZone.ToLocalTime( new DateTime(2001, 1, 1, 0, 0, 0) );
return reference.AddSeconds(date.SecondsSinceReferenceDate);
}
public override void ReceivedLocalNotification(UIApplication application, UILocalNotification notification)
{
new UIAlertView(notification.AlertAction, notification.AlertBody, null, "OK", null).Show();
// reset our badge
UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
notification.SoundName = UILocalNotification.DefaultSoundName;
}
UILocalNotification notification = new UILocalNotification();
notification.FireDate = NSDate.Now.AddSeconds(60);
notification.AlertAction = "New Notification";
notification.AlertBody = "Hoorrayyy.... New Notification";
UIApplication.SharedApplication.ScheduleLocalNotification(notification);
Countries.SouthAfrica.GetDescription()
public static enum Countries
{
[EnumDescription(DisplayName= "South Africa")]
SouthAfrica,
[EnumDescription(DisplayName = "United States Of America")]
UnitedStatesOfAmerica
}
public class HomeScreenAdapter : BaseAdapter<List<Countries>>
{
List<Countries> items;
Activity context;
public HomeScreenAdapter(Activity context, List<Countries> items) : base()
{
this.context = context;
this.items = items;
}
public override long GetItemId(int position)
public class MainActivity : Activity
{
CountriesViewModel viewModel;
List<Countries> countries = new List<Countries>();
protected async override void OnCreate(Bundle bundle)
{
viewModel = new CountriesViewModel();
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
var listView = FindViewById<ListView>(Resource.Id.CountriesListView);
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/CountriesListView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>