//// MSDN code ////DateTime centuryBegin = new DateTime(2001, 1, 1); ////DateTime currentDate = DateTime.Now; ////long elapsedTicks = currentDate.Ticks - centuryBegin.Ticks; ////TimeSpan elapsedSpan = new TimeSpan(elapsedTicks); protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.PersonalAlarms_OldVersion); // wire up controls for Set Alarm via seconds timeTxt = FindViewById<EditText>(Resource.Id.timeTxt); startBtn = FindViewById<Button>(Resource.Id.startBtn); txtOffSetTime = FindViewById<TextView>(Resource.Id.txtOffSetTime); startBtn.Click += StartBtn_Click; // wire up controls for set alarms by time btnSetTime = FindViewById<Button>(Resource.Id.btnSetTime); btnSetDate = FindViewById<Button>(Resource.Id.btnSetDate); txtDate = FindViewById<TextView>(Resource.Id.txtDate); txtTime = FindViewById<TextView>(Resource.Id.txtTime); btnSetPersonalAlert = FindViewById<Button>(Resource.Id.btnSetPersonalAlert); btnSetPersonalAlert.Click += BtnSetPersonalAlert_Click; btnSetTime.Click += BtnSetTime_Click; btnSetDate.Click += BtnSetDate_Click; if (myResultNewsObject != null) { Toast.MakeText(this, "PERSONAL ALARMS\n" + myResultNewsObject.ToString(), ToastLength.Long).Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.NewsObject_CustomeAdapter_Test_Layout); //Toast.MakeText(this, "Hello and welcome to TestActivity!\n" + myResultStringMain, ToastLength.Long).Show(); if (myResultNewsObject != null) { Toast.MakeText(this, "Hello and welcome to Gord TestActivity!\n" + myResultNewsObject.ToString(), ToastLength.Long).Show(); } DisplayListOBJECT = DataAccessHelpers.GetAllNewsObjectDataFromDatabase(); var newsObjectListView = FindViewById <ListView>(Resource.Id.listViewTestActivityCurrency); newsObjectListView.Adapter = new NewsObject_CustomAdapter(this, DisplayListOBJECT); newsObjectListView.ItemClick += NewsObjectListView_ItemClick; //--------------------------------------------------------------------------------------------- string dateString = "04-15-2018"; string timeString = "10:45am"; DateTime dateTime = DataAccessHelpers.Convert_Strings_DateAndTime_To_SingleDateTimeObject(dateString, timeString, cultureInfo); Log.Debug("DEBUG", "DateTime from my method: " + dateTime.ToString("dd/MM/yyyy HH:mm:ss")); long ticksTime_1 = dateTime.Ticks; Log.Debug("DEBUG", "No of ticks: " + ticksTime_1); string dateString2 = "04-15-2018"; string timeString2 = "10:45pm"; DateTime dateTime2 = DataAccessHelpers.Convert_Strings_DateAndTime_To_SingleDateTimeObject(dateString2, timeString2, cultureInfo); Log.Debug("DEBUG", "DateTime from my method: " + dateTime2.ToString("dd/MM/yyyy HH:mm:ss")); long ticksTime_2 = dateTime2.Ticks; Log.Debug("DEBUG", "No of ticks: " + ticksTime_2); long timeDifference = ticksTime_2 - ticksTime_1; Log.Debug("DEBUG", "Time difference in ticks: " + timeDifference); TimeSpan elapsedSpan = new TimeSpan(timeDifference); Log.Debug("DEBUG", "Elapsed time: " + elapsedSpan.TotalHours); DateTime dateTime3 = new DateTime(2018, 03, 19, 23, 59, 00); long myNum = dateTime3.Ticks; Log.Debug("DEBUG", "No of ticks: " + myNum); DateTime dateTime4 = new DateTime(myNum); Log.Debug("DEBUG", "Re-converted dateTime: " + dateTime4.ToString("dd/MM/yyyy HH:mm:ss")); // CultureInfo.InvariantCulture // tt - gives am/pm // hh - 12 hour clock // HH = 24 hour clock }// end OnCreate