public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RadCalendarView calendarView = new RadCalendarView(Activity); Calendar calendar = Java.Util.Calendar.Instance; long start = calendar.TimeInMillis; calendar.Add(CalendarField.Hour, 3); long end = calendar.TimeInMillis; Event newEvent = new Event("Enjoy Life", start, end); calendar.Add(CalendarField.Hour, 1); start = calendar.TimeInMillis; calendar.Add(CalendarField.Hour, 1); end = calendar.TimeInMillis; Event newEvent2 = new Event("Walk to work", start, end); newEvent2.EventColor = Android.Graphics.Color.Green; IList <Event> events = new List <Event> (); events.Add(newEvent); events.Add(newEvent2); calendarView.EventAdapter.Events = events; return(calendarView); }
public void TestMethod1() { //For Jan Calendar janMonth = new Calendar("Jan2020_Controls"); janMonth.Add(new DateBox("1-Jan")); janMonth.Add(new DateBox("2-Jan")); janMonth.Add(new DateBox("31-Jan")); janMonth.Add(new Scroller("Vertical Scroll Bar")); janMonth.Add(new Scroller("Horizontal Scroll Bar")); //For Feb Calendar febMonth = new Calendar("Feb2020_Controls"); febMonth.Add(new DateBox("1-Feb")); febMonth.Add(new DateBox("2-Feb")); febMonth.Add(new DateBox("28-Feb")); febMonth.Add(new Scroller("Vertical Scroll Bar")); febMonth.Add(new Scroller("Horizontal Scroll Bar")); Calendar calendar2020 = new Calendar("Calendar-2020"); calendar2020.Add(janMonth); calendar2020.Add(febMonth); var displayTree = calendar2020.Display(1); }
private void LoadData() { for (var i = 0; i < 2; i++) { data.Add(new ChartDataPoint(calendar.Time, random.Next(0, 100))); calendar.Add(CalendarField.Millisecond, 500); count++; } count = data.Size(); }
public void AddMonthTest() { Calendar calendar = new Calendar(); calendar = calendar.Add(1); calendar.Month.ShouldBe(2); calendar = calendar.Add(13); calendar.Month.ShouldBe(3); }
public static List <Models.Dialog> GetDialogs() { List <Models.Dialog> chats = new List <Models.Dialog>(); for (int i = 0; i < 20; i++) { Calendar calendar = Calendar.Instance; calendar.Add(Calendar.DayOfMonth, -(i * i)); calendar.Add(Calendar.Minute, -(i * i)); chats.Add(GetDialog(i, calendar.Time)); } return(chats); }
/// <summary> /// Executes the actions of the loadCalendarEntry command /// </summary> /// <returns>the task</returns> async Task ExecuteLoadCalendarCommand() { if (IsBusy) { return; } IsBusy = true; try { await CalendarDataStore.InitializeDataStore(); Calendar.Clear(); var calendar = await CalendarDataStore.GetItemsAsync(true); foreach (var entry in calendar) { Calendar.Add(entry); } } catch (Exception ex) { Log.Error("DB", " exception : " + ex.Message); } finally { IsBusy = false; } }
public static List <ChatKitQs.Src.Common.Data.Models.Message> GetMessages(Date startDate) { List <ChatKitQs.Src.Common.Data.Models.Message> messages = new List <ChatKitQs.Src.Common.Data.Models.Message>(); for (int i = 0; i < 10 /*days count*/; i++) { int countPerDay = rnd.NextInt(5) + 1; for (int j = 0; j < countPerDay; j++) { ChatKitQs.Src.Common.Data.Models.Message message; if (i % 2 == 0 && j % 3 == 0) { message = GetImageMessage(); } else { message = GetTextMessage(); } Calendar calendar = Calendar.Instance; if (startDate != null) { calendar.Time = startDate; } calendar.Add(Calendar.DayOfMonth, -(i * i + 1)); message.CreatedAt = calendar.Time; messages.Add(message); } } return(messages); }
public void FoodProductionTest() { Harvest harvest = new Harvest(); Calendar calendar = new Calendar(); Province province = new Province(); Population startPopulation = new Population().Add(1000); Food food = harvest.FoodProduction(calendar, province); food.Rice.ShouldBe(0); province = province.Add(startPopulation); calendar.Month.ShouldBe(1); food = harvest.FoodProduction(calendar, province); food.Rice.ShouldBe(0); calendar = calendar.Add(4); food = harvest.FoodProduction(calendar, province); food.Rice.ShouldBeGreaterThan(0); calendar = new Calendar(); calendar.Month.ShouldBe(1); food = new Food(); food.Rice.ShouldBe(0); for (int month = 0; month < 12; month++) { food = food.Add(harvest.FoodProduction(calendar, province)); calendar = calendar.Add(1); } food.Rice.ShouldBeGreaterThan(12 * province.Population.Adults); }
/// <exception cref="System.Exception"></exception> public virtual void TestEncodeDecodeCookie() { PersistentCookieStore cookieStore = new PersistentCookieStore(database); string cookieName = "foo"; string cookieVal = "bar"; bool isSecure = false; bool httpOnly = false; string cookiePath = "baz"; string cookieDomain = "foo.com"; // expiration date - 1 day from now Calendar cal = Calendar.GetInstance(); cal.SetTime(new DateTime()); int numDaysToAdd = 1; cal.Add(Calendar.Date, numDaysToAdd); DateTime expirationDate = cal.GetTime(); BasicClientCookie cookie = new BasicClientCookie(cookieName, cookieVal); cookie.SetExpiryDate(expirationDate); cookie.SetSecure(isSecure); cookie.SetDomain(cookieDomain); cookie.SetPath(cookiePath); string encodedCookie = cookieStore.EncodeCookie(new SerializableCookie(cookie)); Apache.Http.Cookie.Cookie fetchedCookie = cookieStore.DecodeCookie(encodedCookie); NUnit.Framework.Assert.AreEqual(cookieName, fetchedCookie.GetName()); NUnit.Framework.Assert.AreEqual(cookieVal, fetchedCookie.GetValue()); NUnit.Framework.Assert.AreEqual(expirationDate, fetchedCookie.GetExpiryDate()); NUnit.Framework.Assert.AreEqual(cookiePath, fetchedCookie.GetPath()); NUnit.Framework.Assert.AreEqual(cookieDomain, fetchedCookie.GetDomain()); }
/// <summary> /// Enable the time and timezone spinner while slecte the non all day appointment. /// </summary> private void EnableChid() { if (SelectedAppointment != null) { endTimeName.Text = timeFormat.Format(SelectedAppointment.EndTime.Time); startTimeName.Text = timeFormat.Format(SelectedAppointment.StartTime.Time); } else if (selectedDate != null) { startTimeName.Text = timeFormat.Format(selectedDate.Time) + " "; Calendar endTime = (Calendar)selectedDate.Clone(); endTime.Add(CalendarField.Hour, 1); endTimeName.Text = timeFormat.Format(endTime.Time) + " "; } startTimeName.SetTextColor(Color.Black); endTimeName.SetTextColor(Color.Black); startTimeName.Enabled = true; startTimeName.Clickable = true; endTimeName.Enabled = true; endTimeName.Clickable = true; startTimeZonePicker.Enabled = true; startTimeZonePicker.Clickable = true; endTimeZonePicker.Enabled = true; endTimeZonePicker.Clickable = true; }
public void onSingleTapConfirmed(MotionEvent e) { //Don't handle single tap the calendar is scrolling and is not stationary if (Java.Lang.Math.Abs(accumulatedScrollOffset.X) != Java.Lang.Math.Abs(width * monthsScrolledSoFar)) { return; } int dayColumn = Java.Lang.Math.Round((paddingLeft + e.RawX - paddingWidth - paddingRight) / widthPerDay); int dayRow = Java.Lang.Math.Round((e.RawY - paddingHeight) / heightPerDay); setCalenderToFirstDayOfMonth(calendarWithFirstDayOfMonth, currentDate, -monthsScrolledSoFar, 0); //Start Monday as day 1 and Sunday as day 7. Not Sunday as day 1 and Monday as day 2 int firstDayOfMonth = getDayOfWeek(calendarWithFirstDayOfMonth); int dayOfMonth = ((dayRow - 1) * 7 + dayColumn + 1) - firstDayOfMonth; if (dayOfMonth < calendarWithFirstDayOfMonth.GetActualMaximum(CalendarField.DayOfMonth) && dayOfMonth >= 0) { calendarWithFirstDayOfMonth.Add(CalendarField.Date, dayOfMonth); currentCalender.TimeInMillis = calendarWithFirstDayOfMonth.TimeInMillis; performOnDayClickCallback(currentCalender.Time); } }
public void UpdateEditor(ScheduleAppointment appointment, Calendar date) { SelectedAppointment = appointment; if (appointment != null) { subjectInput.Text = appointment.Subject.ToString(); locationInput.Text = appointment.Location; startDateName.Text = dateFormat.Format(appointment.StartTime.Time); startTimeName.Text = timeFormat.Format(appointment.StartTime.Time); endDateName.Text = dateFormat.Format(appointment.EndTime.Time); endTimeName.Text = timeFormat.Format(appointment.EndTime.Time); StartTime = appointment.StartTime; EndTime = appointment.EndTime; } else { subjectInput.Text = ""; startDateName.Text = dateFormat.Format(date.Time); startTimeName.Text = timeFormat.Format(date.Time) + ""; Calendar _endTime = (Calendar)date.Clone(); _endTime.Add(CalendarField.Hour, 1); endDateName.Text = dateFormat.Format(_endTime.Time); endTimeName.Text = timeFormat.Format(_endTime.Time) + ""; StartTime = date; EndTime = _endTime; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.one_day_picker_activity); MV.CalendarView calendarView = (MV.CalendarView)FindViewById(Resource.Id.calendarView); Calendar min = Calendar.Instance; min.Add(CalendarField.Month, -2); Calendar max = Calendar.Instance; max.Add(CalendarField.Month, 2); calendarView.SetMinimumDate(min); calendarView.SetMaximumDate(max); Button getDateButton = (Button)FindViewById(Resource.Id.getDateButton); getDateButton.Click += (sender, e) => { calendarView.SelectedDates.ToList().ForEach(d => Toast.MakeText(this, d.Time.ToString(), ToastLength.Short).Show()); }; }
public static Date addDays(Date date, int days) { Calendar cal = Calendar.GetInstance(new Locale("En", "ZA")); cal.Time = date; cal.Add(Calendar.Date, days); return(cal.Time); }
private void setMonthOffset(Calendar calendarWithFirstDayOfMonth, Date currentDate, int scrollOffset, int monthOffset) { calendarWithFirstDayOfMonth.Time = currentDate; calendarWithFirstDayOfMonth.Add(CalendarField.Month, scrollOffset + monthOffset); calendarWithFirstDayOfMonth.Set(CalendarField.HourOfDay, 0); calendarWithFirstDayOfMonth.Set(CalendarField.Minute, 0); calendarWithFirstDayOfMonth.Set(CalendarField.Second, 0); calendarWithFirstDayOfMonth.Set(CalendarField.Millisecond, 0); }
private static NoteInfo GetRandomDate(Context context) { Calendar cal = Calendar.GetInstance(Java.Util.TimeZone.Default); cal.Add(Calendar.Date, (int)(Java.Lang.Math.Random() * DATE_RANGE)); String date = DateFormat.GetMediumDateFormat(context).Format(cal.Time); return(new NoteInfo(date, Resource.Drawable.ic_event_white_24dp)); }
public void AddMonthYearTest() { Calendar calendar = new Calendar(); calendar = calendar.Add(1, 0); calendar.Month.ShouldBe(2); calendar.Year.ShouldBe(1); calendar = calendar.Add(0, 1); calendar.Month.ShouldBe(2); calendar.Year.ShouldBe(2); calendar = calendar.Add(2, 3); calendar.Month.ShouldBe(4); calendar.Year.ShouldBe(5); }
public static string formatMillis(long time) { Calendar calendar = Calendar.Instance; calendar.Clear(); calendar.Add(Calendar.Millisecond, (int)time); String pattern = time / Constants.hourMillis > 0 ? "kk:mm:ss" : "mm:ss"; return(DateFormat.Format(pattern, calendar)); }
private Calendar GetRandomCalendar() { Random random = new Random(); Calendar calendar = Calendar.Instance; calendar.Add(CalendarField.Month, random.NextInt(99)); return(calendar); }
/** * Returns Subscription end date * Date returned by this method is kept as the current date plus 3 years. */ private String CreateSubscriptionEndDate() { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.GetInstance(Locale.Default); c.Add(CalendarField.Year, 3); Date future = c.Time; String dateInISOFormat = df.Format(future); return(dateInISOFormat); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { calendarView = new RadCalendarView(Activity); Calendar calendar = Java.Util.Calendar.Instance; calendar.Set(CalendarField.DayOfMonth, 5); calendarView.MinDate = calendar.TimeInMillis; calendar.Add(CalendarField.Month, 1); calendar.Set(CalendarField.DayOfMonth, 15); calendarView.MaxDate = calendar.TimeInMillis; return(calendarView); }
/// <summary> /// Process test cases for <c>add</c> and <c>roll</c> methods. /// Each test case is an array of integers, as follows: /// <ul> /// <li>0: input year /// <li>1: month (zero-based) /// <li>2: day /// <li>3: field to roll or add to /// <li>4: amount to roll or add /// <li>5: result year /// <li>6: month (zero-based) /// <li>7: day /// </ul> /// For example: /// <pre> /// // input add by output /// // year month day field amount year month day /// { 5759, HESHVAN, 2, MONTH, 1, 5759, KISLEV, 2 }, /// </pre> /// </summary> /// /// <param name="roll"><c>true</c> or <c>ROLL</c> to test the<c>roll</c> method; <c>false</c> or<c>ADD</c> to test the <code>add</code method</param> public void DoRollAdd(bool roll, Calendar cal, int[][] tests) { String name = (roll) ? "rolling" : "adding"; for (int i = 0; i < tests.Length; i++) { int[] test = tests[i]; cal.Clear(); if (cal is ChineseCalendar) { cal.Set(IBM.ICU.Util.Calendar.EXTENDED_YEAR, test[0]); cal.Set(IBM.ICU.Util.Calendar.MONTH, test[1]); cal.Set(IBM.ICU.Util.Calendar.DAY_OF_MONTH, test[2]); } else { cal.Set(test[0], test[1], test[2]); } double day0 = GetJulianDay(cal); if (roll) { cal.Roll(test[3], test[4]); } else { cal.Add(test[3], test[4]); } int y = cal .Get((cal is ChineseCalendar) ? IBM.ICU.Util.Calendar.EXTENDED_YEAR : YEAR); if (y != test[5] || cal.Get(MONTH) != test[6] || cal.Get(DATE) != test[7]) { Errln("Fail: " + name + " " + YmdToString(test[0], test[1], test[2]) + " (" + day0 + ")" + " " + FIELD_NAME[test[3]] + " by " + test[4] + ": expected " + YmdToString(test[5], test[6], test[7]) + ", got " + YmdToString(cal)); } else if (IsVerbose()) { Logln("OK: " + name + " " + YmdToString(test[0], test[1], test[2]) + " (" + day0 + ")" + " " + FIELD_NAME[test[3]] + " by " + test[4] + ": got " + YmdToString(cal)); } } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RadCalendarView calendarView = new RadCalendarView(Activity); // Setting the events display mode calendarView.SelectionMode = CalendarSelectionMode.Single; calendarView.EventsDisplayMode = EventsDisplayMode.Inline; // Creating some events List <Event> events = new List <Event>(); Calendar calendar = Calendar.Instance; long start = calendar.TimeInMillis; calendar.Add(CalendarField.Hour, 1); long end = calendar.TimeInMillis; events.Add(new Event("Test1", start, end)); calendar.Add(CalendarField.Date, 1); calendar.Add(CalendarField.Hour, -1); start = calendar.TimeInMillis; calendar.Add(CalendarField.Hour, 3); end = calendar.TimeInMillis; events.Add(new Event("Test2", start, end)); calendarView.EventAdapter.Events = events; // Customization calendarView.Adapter.InlineEventsBackgroundColor = Color.Black; calendarView.Adapter.InlineEventTimeStartTextColor = Color.White; calendarView.Adapter.InlineEventTimeEndTextColor = Color.White; calendarView.Adapter.InlineEventTitleTextSize = 42.0F; return(calendarView); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RadCalendarView calendarView = new RadCalendarView(Activity); // Setting the events display mode calendarView.SelectionMode = CalendarSelectionMode.Single; calendarView.EventsDisplayMode = EventsDisplayMode.Inline; // Creating some events List <Event> events = new List <Event>(); Calendar calendar = Calendar.Instance; long start = calendar.TimeInMillis; calendar.Add(CalendarField.Hour, 1); long end = calendar.TimeInMillis; events.Add(new Event("Test1", start, end)); calendar.Add(CalendarField.Date, 1); calendar.Add(CalendarField.Hour, -1); start = calendar.TimeInMillis; calendar.Add(CalendarField.Hour, 3); end = calendar.TimeInMillis; events.Add(new Event("Test2", start, end)); calendarView.EventAdapter.Events = events; // >> calendar-custom-inline-events-adapter-init MyInlineEventsAdapter adapter = new MyInlineEventsAdapter(Context); calendarView.EventsManager().Adapter = adapter; // << calendar-custom-inline-events-adapter-init return(calendarView); }
List <WeatherData> GetData() { List <WeatherData> list = new List <WeatherData>(); SimpleDateFormat dateformat = new SimpleDateFormat("EEEE, MMMM dd "); SimpleDateFormat dateformat1 = new SimpleDateFormat("EEEE"); Calendar cal = Calendar.GetInstance(Java.Util.TimeZone.Default); String strDate = dateformat.Format(cal.Time); String strDay = dateformat1.Format(cal.Time); Calendar cal1 = Calendar.GetInstance(Java.Util.TimeZone.Default); cal1.Add(CalendarField.Date, +1); String strDate1 = dateformat.Format(cal1.Time); String strDay1 = dateformat1.Format(cal1.Time); Calendar cal2 = Calendar.GetInstance(Java.Util.TimeZone.Default); cal2.Add(CalendarField.Date, +2); String strDate2 = dateformat.Format(cal2.Time); String strDay2 = dateformat1.Format(cal2.Time); Calendar cal3 = Calendar.GetInstance(Java.Util.TimeZone.Default); cal3.Add(CalendarField.Date, +3); String strDate3 = dateformat.Format(cal3.Time); String strDay3 = dateformat1.Format(cal3.Time); Calendar cal4 = Calendar.GetInstance(Java.Util.TimeZone.Default); cal4.Add(CalendarField.Date, +4); String strDate4 = dateformat.Format(cal4.Time); String strDay4 = dateformat1.Format(cal4.Time); Calendar cal5 = Calendar.GetInstance(Java.Util.TimeZone.Default); cal5.Add(CalendarField.Date, +5); String strDate5 = dateformat.Format(cal5.Time); String strDay5 = dateformat1.Format(cal5.Time); Calendar cal6 = Calendar.GetInstance(Java.Util.TimeZone.Default); cal6.Add(CalendarField.Date, +6); String strDate6 = dateformat.Format(cal6.Time); String strDay6 = dateformat1.Format(cal6.Time); list.Add(new WeatherData(strDay, strDate, 21, Resource.Drawable.humid, Resource.Drawable.humidselected)); list.Add(new WeatherData(strDay1, strDate1, 24, Resource.Drawable.cloudy, Resource.Drawable.cloudyselected)); list.Add(new WeatherData(strDay2, strDate2, 26, Resource.Drawable.humid, Resource.Drawable.humidselected)); list.Add(new WeatherData(strDay3, strDate3, 23, Resource.Drawable.rainy, Resource.Drawable.rainyselected)); list.Add(new WeatherData(strDay4, strDate4, 32, Resource.Drawable.warm, Resource.Drawable.warmselected)); list.Add(new WeatherData(strDay5, strDate5, 12, Resource.Drawable.windy, Resource.Drawable.windyselected)); list.Add(new WeatherData(strDay6, strDate6, 30, Resource.Drawable.cloudy, Resource.Drawable.cloudyselected)); return(list); }
private static void ScheduleMidnightUpdate(Context context) { var refreshIntent = new Intent(context, typeof(AlarmClockChangedReceiver)); PendingIntent pendingRefreshIntent = PendingIntent.GetBroadcast(context, 0, refreshIntent, PendingIntentFlags.UpdateCurrent); Calendar calendar = Calendar.GetInstance(Locale.Default); calendar.TimeInMillis = JavaSystem.CurrentTimeMillis(); calendar.Set(CalendarField.HourOfDay, 0); calendar.Set(CalendarField.Minute, 0); calendar.Add(CalendarField.DayOfYear, 1); AlarmManager alarmManager = (AlarmManager)context.GetSystemService(Context.AlarmService); alarmManager.Set(AlarmType.Rtc, calendar.TimeInMillis, pendingRefreshIntent); }
private void DateButton_Click(object sender, System.EventArgs e) { Calendar now = Calendar.Instance; var dpd = new MaterialdDatePicker.DatePickerDialog(); dpd.Initialize( this, now.Get(CalendarField.Year), now.Get(CalendarField.Month), now.Get(CalendarField.DayOfMonth) ); dpd.SetThemeDark(modeDarkDate.Checked); dpd.Vibrate(vibrateDate.Checked); dpd.DismissOnPause(dismissDate.Checked); dpd.ShowYearPickerFirst(showYearFirst.Checked); dpd.SetVersion(showVersion2.Checked ? MaterialdDatePicker.DatePickerDialog.Version.Version2 : MaterialdDatePicker.DatePickerDialog.Version.Version1); if (modeCustomAccentDate.Checked) { dpd.AccentColor = Color.ParseColor("#9C27B0"); } if (titleDate.Checked) { dpd.SetTitle("DatePicker Title"); } if (highlightDays.Checked) { Calendar date1 = Calendar.Instance; Calendar date2 = Calendar.Instance; date2.Add(CalendarField.WeekOfMonth, -1); Calendar date3 = Calendar.Instance; date3.Add(CalendarField.WeekOfMonth, 1); Calendar[] days = { date1, date2, date3 }; dpd.SetHighlightedDays(days); } if (limitSelectableDays.Checked) { var days = new Calendar[13]; for (int i = -6; i < 7; i++) { Calendar day = Calendar.Instance; day.Add(CalendarField.DayOfMonth, i * 2); days[i + 6] = day; } dpd.SetSelectableDays(days); } dpd.Show(FragmentManager, "Datepickerdialog"); }
public void FoodConsumptionTest() { Granary granary = new Granary(); Calendar calendar = new Calendar(); Province province = new Province(); Population startPopulation = new Population().Add(1000); Food foodStock = new Food(); foodStock = foodStock.Add(500); Food foodConsumption = granary.FoodConsumption(calendar, province); foodConsumption.Rice.ShouldBe(0); province = province.Add(startPopulation); province = province.Add(foodStock); calendar.Month.ShouldBe(1); foodConsumption = granary.FoodConsumption(calendar, province); foodConsumption.Rice.ShouldNotBe(0); foodConsumption.Rice.ShouldBeLessThanOrEqualTo(province.Food.Rice); calendar.Add(4); foodConsumption = granary.FoodConsumption(calendar, province); foodConsumption.Rice.ShouldBeGreaterThan(0); foodConsumption.Rice.ShouldBeLessThanOrEqualTo(province.Food.Rice); calendar = new Calendar(); calendar.Month.ShouldBe(1); foodConsumption = new Food(); foodConsumption.Rice.ShouldBe(0); foodStock = foodStock.Add(50000); province = province.Add(foodStock); for (int month = 0; month < 12; month++) { foodConsumption = foodConsumption.Add(granary.FoodConsumption(calendar, province)); calendar.Add(1); } foodConsumption.Rice.ShouldBeGreaterThan(12 * province.Population.Adults); foodConsumption.Rice.ShouldBeLessThanOrEqualTo(province.Food.Rice); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RadCalendarView calendarView = new RadCalendarView(Activity); Calendar calendar = Calendar.Instance; long start = calendar.TimeInMillis; calendar.Add(CalendarField.Hour, 3); long end = calendar.TimeInMillis; Event newEvent1 = new Event("Event 1", start, end); newEvent1.EventColor = Color.Cyan; Event newEvent2 = new Event("Event 2", start, end); newEvent2.EventColor = Color.Magenta; Event newEvent3 = new Event("Event 3", start, end); newEvent3.EventColor = Color.Red; Event newEvent4 = new Event("Event 4", start, end); newEvent4.EventColor = Color.Green; Event newEvent5 = new Event("Event 5", start, end); newEvent5.EventColor = Color.Blue; IList <Event> events = new List <Event>(); events.Add(newEvent1); events.Add(newEvent2); events.Add(newEvent3); events.Add(newEvent4); events.Add(newEvent5); calendarView.EventAdapter.Events = events; // >> calendar-custom-event-renderer-init MyEventRenderer eventRenderer = new MyEventRenderer(Context); calendarView.EventAdapter.Renderer = eventRenderer; // << calendar-custom-event-renderer-init calendarView.SelectionMode = CalendarSelectionMode.Single; calendarView.EventsDisplayMode = EventsDisplayMode.Inline; return(calendarView); }
private void setupLocalCloudAnchor(AnchorVisual visual) { CloudSpatialAnchor cloudAnchor = new CloudSpatialAnchor(); cloudAnchor.LocalAnchor = visual.LocalAnchor; visual.SetCloudAnchor(cloudAnchor); // In this sample app we delete the cloud anchor explicitly, but you can also set it to expire automatically Date now = new Date(); Calendar cal = Calendar.Instance; cal.Time = now; cal.Add(CalendarField.Date, 7); Date oneWeekFromNow = cal.Time; cloudAnchor.Expiration = oneWeekFromNow; }
static void AddDate(Calendar calendar) { calendar.Add(Java.Util.CalendarField.Date, 1); }