public override void ViewDidLoad() { base.ViewDidLoad (); this.CalendarView = new TKCalendar (this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.CalendarView.Delegate = new CalendarDelegate (this); this.CalendarView.SelectionMode = TKCalendarSelectionMode.Range; this.View.AddSubview (this.CalendarView); NSDateComponents components = new NSDateComponents (); components.Day = 1; NSDate date = NSDate.Now; this.UnselectableDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0); components.Day = 3; NSDate startDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0); components.Day = 6; NSDate endDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0); components.Year = -5; this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0); components.Year = 5; this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0); this.CalendarView.SelectedDatesRange = new TKDateRange (startDate, endDate); }
public PatientDetailView() { this.BackgroundColor = UIColor.White; this.image = new UIImageView(); this.nameField = this.CreateEditableTextField(); var datePickerPopover = new DatePickerPopover(this); datePickerPopover.DatePicker.Mode = UIDatePickerMode.Date; datePickerPopover.DatePicker.ValueChanged += (s, e) => { this.editingDateOfBirth = (s as UIDatePicker).Date; this.UpdateDateOfBirthLabel(this.editingDateOfBirth); }; this.dateOfBirthLabel = CreateLabel(text: "date of birth:"); this.dateOfBirthField = CreateLabel(tapGestureRecognizer: new UITapGestureRecognizer( recognizer => { if (!this.Editable) { return; } datePickerPopover.DatePicker.Date = this.patient.DateOfBirth; datePickerPopover.Show(this.dateOfBirthField); })); this.AddSubview(this.nameField); this.AddSubview(this.dateOfBirthLabel); this.AddSubview(this.dateOfBirthField); this.AddSubview(this.image); }
public static DateTime NSDateToDateTime(NSDate date) { DateTime reference = new DateTime(2001, 1, 1, 0, 0, 0); DateTime currentDate = reference.AddSeconds(date.SecondsSinceReferenceDate); DateTime localDate = currentDate.ToLocalTime (); return localDate; }
public LotteryEntry(NSDate iDate, DateTime cDate) { entryDate = iDate; EntryDate = cDate; firstNumber = _random.Next(1, 101); secondNumber = _random.Next(1, 101); }
public void setDateTime (NSDate date) { this.datePicker.SetDate (date, false); this.timePicker.SetDate (date, false); DateTime dtNow = CoreSystem.Utils.getDateTimeNow (MApplication.getInstance().timezoneName); this.datePicker.MinimumDate = MUtils.DateTimeToNSDate (dtNow); }
/// <summary> /// Updates the date time and gives the dummy control focus /// </summary> /// <param name="date">Date.</param> public void UpdateDateTime(NSDate date) { this.Text = DateTime.SpecifyKind(Utilities.NSDateToDateTime( date), DateTimeKind.Unspecified).ToString("dd.MM.yyyy"); if (TxtDummy == null) return; TxtDummy.BecomeFirstResponder(); TxtDummy.ResignFirstResponder(); }
private void displayTimerResults() { UIApplication.SharedApplication.IdleTimerDisabled = false; NSDate endTime = new NSDate(); double interval = endTime.SecondsSinceReferenceDate - startTime.SecondsSinceReferenceDate; NSNumber timeNumber = new NSNumber(interval); NSNumberFormatter formatter = new NSNumberFormatter(); formatter.MaximumFractionDigits = 5; string formattedTime = formatter.StringFromNumber(timeNumber); this.timeLabel.Text = formattedTime; }
public TimerTriggerCreator (HMTrigger trigger, HMHome home) : base (trigger, home) { SelectedRecurrenceIndex = -1; RawFireDate = new NSDate (); var timerTrigger = TimerTrigger; if (timerTrigger != null) { RawFireDate = timerTrigger.FireDate; SelectedRecurrenceIndex = RecurrenceIndexFromDateComponents (timerTrigger.Recurrence); } }
public static MotionActivityQuery FromDate (NSDate date, int offset) { NSCalendar currentCalendar = NSCalendar.CurrentCalendar; NSDateComponents timeComponents = currentCalendar.Components ( NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, date); timeComponents.Hour = 0; timeComponents.Day = timeComponents.Day + offset; NSDate queryStart = currentCalendar.DateFromComponents (timeComponents); timeComponents.Day = timeComponents.Day + 1; NSDate queryEnd = currentCalendar.DateFromComponents (timeComponents); return new MotionActivityQuery (queryStart, queryEnd, offset == 0); }
public static string nsDateToString (NSDate date, string format) { string strDate = ""; NSLocale gbLocale = NSLocale.FromLocaleIdentifier ("en_GB"); NSDateFormatter dateFormatter = new NSDateFormatter (); dateFormatter.DateFormat = format; dateFormatter.Locale = gbLocale; try { strDate = dateFormatter.StringFor (date).ToUpper (); } catch (Exception ex) { Console.Out.WriteLine (ex.Message); } return strDate; }
public static DateTime NSDateToDateTime1(NSDate date) { NSDate sourceDate = date; NSTimeZone sourceTimeZone = new NSTimeZone ("UTC"); NSTimeZone destinationTimeZone = NSTimeZone.LocalTimeZone; int sourceGMTOffset =(int) sourceTimeZone.SecondsFromGMT (sourceDate); int destinationGMTOffset =(int) destinationTimeZone.SecondsFromGMT (sourceDate); int interval = destinationGMTOffset - sourceGMTOffset; var destinationDate = sourceDate.AddSeconds (interval); var dateTime = new DateTime(2001, 1, 1, 0, 0,0).AddSeconds(destinationDate.SecondsSinceReferenceDate); return dateTime; }
public override void ViewDidLoad () { base.ViewDidLoad (); TKChart chart = new TKChart (this.View.Bounds); chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview (chart); NSCalendar calendar = new NSCalendar (NSCalendarType.Gregorian); NSDateComponents dateTimeComponents = new NSDateComponents (); dateTimeComponents.Year = 2013; dateTimeComponents.Day = 1; Random r = new Random (); List<TKChartDataPoint> list = new List<TKChartDataPoint> (); for (int i = 1; i <= 6; i++) { dateTimeComponents.Month = i; list.Add(new TKChartDataPoint(calendar.DateFromComponents(dateTimeComponents), new NSNumber(r.Next() % 100))); } TKChartSplineAreaSeries series = new TKChartSplineAreaSeries (list.ToArray()); series.SelectionMode = TKChartSeriesSelectionMode.Series; dateTimeComponents.Month = 1; NSDate minDate = new NSDate (); NSDate maxDate = new NSDate (); minDate = calendar.DateFromComponents (dateTimeComponents); dateTimeComponents.Month = 6; maxDate = calendar.DateFromComponents (dateTimeComponents); TKChartDateTimeAxis xAxis = new TKChartDateTimeAxis (minDate, maxDate); xAxis.MajorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Months; xAxis.MajorTickInterval = 1; chart.XAxis = xAxis; chart.AddSeries (series); }
public override void DidSelectDate(TKCalendar calendar, NSDate date) { Console.WriteLine (String.Format ("{0}", date)); }
public override void RangeChanged(SFDateTimeRangeNavigator rangeNavigator, NSDate startDate, NSDate endDate) { primaryAxis.Minimum = startDate; primaryAxis.Maximum = endDate; }
public static DateTime ToDateTime(this NSDate date) { DateTime reference = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(2001, 1, 1, 0, 0, 0)); return(reference.AddSeconds(date.SecondsSinceReferenceDate)); }
public string DateToString(NSDate date, double value, NChartValueAxis axis) { return(null); }
static DateTime NSDateToDateTimeUtc(NSDate date) { var reference = new DateTime(2001, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); return(reference.AddSeconds(date?.SecondsSinceReferenceDate ?? 0)); }
public override void ViewDidLoad() { base.ViewDidLoad(); var chart = new TKChart(this.View.Bounds); chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.Add(chart); string url = "http://www.telerik.com/docs/default-source/ui-for-ios/weather.json?sfvrsn=2"; dataSource.LoadDataFromURL(url, TKDataSourceDataFormat.JSON, "dayList", (NSError err) => { if (err != null) { Console.WriteLine("Can't connect with the server!"); return; } dataSource.Settings.Chart.CreateSeries((TKDataSourceGroup group) => { TKChartSeries series = null; if (group.ValueKey == "clouds") { series = new TKChartColumnSeries(); series.YAxis = new TKChartNumericAxis(NSObject.FromObject(0), NSObject.FromObject(100)); series.YAxis.Title = "clouds"; series.YAxis.Style.TitleStyle.RotationAngle = (float)Math.PI / 2.0f; } else { series = new TKChartLineSeries(); series.YAxis = new TKChartNumericAxis(NSObject.FromObject(-10), NSObject.FromObject(30)); if (group.ValueKey == "temp.min") { series.YAxis.Position = TKChartAxisPosition.Right; series.YAxis.Title = "temperature"; series.YAxis.Style.TitleStyle.RotationAngle = (float)Math.PI / 2.0f; chart.AddAxis(series.YAxis); } } return(series); }); dataSource.Map((NSObject item) => { double interval = ((NSNumber)item.ValueForKey(new NSString("dateTime"))).DoubleValue; NSDate date = NSDate.FromTimeIntervalSince1970(interval); item.SetValueForKey(date, new NSString("dateTime")); return(item); }); NSObject[] items = this.dataSource.Items; NSMutableArray newItems = new NSMutableArray(); newItems.Add(new TKDataSourceGroup(items, "clouds", "dateTime")); newItems.Add(new TKDataSourceGroup(items, "temp.min", "dateTime")); newItems.Add(new TKDataSourceGroup(items, "temp.max", "dateTime")); dataSource.ItemSource = newItems; chart.DataSource = dataSource; var formatter = new NSDateFormatter(); formatter.DateFormat = "dd"; TKChartDateTimeAxis xAxis = (TKChartDateTimeAxis)chart.XAxis; xAxis.MajorTickInterval = 1; xAxis.PlotMode = TKChartAxisPlotMode.BetweenTicks; xAxis.LabelFormatter = formatter; xAxis.Title = "date"; xAxis.MinorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Days; }); }
public static DateTime ToDateTimeUtc(this NSDate date) { return((ReferenceNSDateTime).AddSeconds(date.SecondsSinceReferenceDate)); }
public static NSDate ToNsDate(this DateTimeOffset dateTimeOffset) { return(NSDate.FromTimeIntervalSinceReferenceDate((dateTimeOffset - ReferenceNsDateTime).TotalSeconds)); }
public Order(int quantity, MenuItem menuItem, NSMutableSet <MenuItemOption> menuItemOptions, NSDate date = null, NSUuid identifier = null) { Date = date ?? new NSDate(); Identifier = identifier ?? new NSUuid(); Quantity = quantity; MenuItem = menuItem; MenuItemOptions = menuItemOptions; }
public static NSDate ToNSDate(this DateTime date) { DateTime reference = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(2001, 1, 1, 0, 0, 0)); return(NSDate.FromTimeIntervalSinceReferenceDate((date - reference).TotalSeconds)); }
/// <summary> /// Converts input <see cref="T:Foundation.NSDate"/> to C# <see cref="T:System.DateTime"/>. /// </summary> /// <param name="date"><see cref="T:Foundation.NSDate"/> object to convert.</param> /// <returns> /// <see cref="T:System.DateTime"/> representation of the specified <see cref="T:Foundation.NSDate"/> /// whose <see cref="P:System.DateTime.Kind"/> property is <see cref="F:System.DateTimeKind.Local"/> /// and whose value is the local time equivalent to the specified <see cref="T:Foundation.NSDate"/>. /// </returns> public static DateTime ToLocalDateTime(this NSDate date) { return(((DateTime)date).ToLocalTime()); }
/// <summary> /// Converts input <see cref="T:Foundation.NSDate"/> to C# <see cref="T:System.DateTime"/>. /// </summary> /// <param name="date"><see cref="T:Foundation.NSDate"/> object to convert.</param> /// <returns> /// <see cref="T:System.DateTime"/> representation of the specified date in UTC. /// No conversion is made since <see cref="T:Foundation.NSDate"/> always represents date in UTC. /// </returns> public static DateTime ToUtcDateTime(this NSDate date) { return((DateTime)date); }
public void IDictionary2Test() { var value1 = NSDate.FromTimeIntervalSinceNow(1); var value2 = NSDate.FromTimeIntervalSinceNow(2); var value3 = NSDate.FromTimeIntervalSinceNow(3); var key1 = new NSString("key1"); var key2 = new NSString("key2"); var key3 = new NSString("key3"); var dictobj = new NSDictionary <NSString, NSDate> ( new NSString [] { key1, key2 }, new NSDate[] { value1, value1 } ); var dict = (IDictionary <NSString, NSDate>)dictobj; // Add Assert.Throws <NotSupportedException> (() => dict.Add(new KeyValuePair <NSString, NSDate> (null, null)), "Add"); // Clear Assert.Throws <NotSupportedException> (() => dict.Clear(), "Clear"); // Contains Assert.IsTrue(dict.Contains(new KeyValuePair <NSString, NSDate> (key1, value1)), "Contains 1"); // both key and value matches Assert.IsFalse(dict.Contains(new KeyValuePair <NSString, NSDate> (key1, value2)), "Contains 2"); // found key, wrong value Assert.IsFalse(dict.Contains(new KeyValuePair <NSString, NSDate> (key3, value2)), "Contains 3"); // wrong key // ContainsKey Assert.IsTrue(dict.ContainsKey(key1), "ContainsKey 1"); Assert.IsFalse(dict.ContainsKey(key3), "ContainsKey 2"); // CopyTo var kvp_array = new KeyValuePair <NSString, NSDate> [1]; Assert.Throws <ArgumentNullException> (() => dict.CopyTo(null, 0), "CopyTo ANE"); Assert.Throws <ArgumentOutOfRangeException> (() => dict.CopyTo(kvp_array, -1), "CopyTo AOORE"); Assert.Throws <ArgumentException> (() => dict.CopyTo(kvp_array, kvp_array.Length), "CopyTo AE 2"); Assert.Throws <ArgumentException> (() => dict.CopyTo(kvp_array, 0), "CopyTo AE 3"); kvp_array = new KeyValuePair <NSString, NSDate> [dictobj.Count]; Assert.Throws <ArgumentException> (() => dict.CopyTo(kvp_array, 1), "CopyTo AE 4"); dict.CopyTo(kvp_array, 0); Assert.That(key1, Is.SameAs(kvp_array [0].Key).Or.SameAs(kvp_array [1].Key), "CopyTo K1"); Assert.AreSame(value1, kvp_array [0].Value, "CopyTo V1"); Assert.That(key2, Is.SameAs(kvp_array [0].Key).Or.SameAs(kvp_array [1].Key), "CopyTo K2"); Assert.AreSame(value1, kvp_array [1].Value, "CopyTo V2"); // Count Assert.AreEqual(2, dict.Count, "Count"); // GetEnumerator var enumerated = Enumerable.ToArray(dict); Assert.AreEqual(2, enumerated.Length, "Enumerator Count"); // IsReadOnly Assert.IsTrue(dict.IsReadOnly, "IsReadOnly"); // Keys Assert.AreEqual(2, dict.Keys.Count, "Keys Count"); // Remove Assert.Throws <NotSupportedException> (() => dict.Remove(null), "Remove NSE"); // TryGetValue NSDate value; Assert.Throws <ArgumentNullException> (() => dict.TryGetValue(null, out value), "TryGetValue ANE"); Assert.IsTrue(dict.TryGetValue(key1, out value), "TryGetValue K1"); Assert.AreSame(value1, value, "TryGetValue V1"); Assert.IsFalse(dict.TryGetValue(key3, out value), "TryGetValue K2"); // Values Assert.AreEqual(2, dict.Values.Count, "Values Count"); // Indexer Assert.AreSame(value1, dict [key1], "this [1]"); Assert.IsNull(dict [key3], "this [2]"); Assert.Throws <ArgumentNullException> (() => GC.KeepAlive(dict [null]), "this [null]"); Assert.Throws <NotSupportedException> (() => dict [key3] = value3, "this [1] = 1"); }
public static NSDate ToNSDate(this DateTime date) { return(NSDate.FromTimeIntervalSinceReferenceDate((date - (ReferenceNSDateTime)).TotalSeconds)); }
public static NSDate ToNSDate(this DateTime dt) { return(NSDate.FromTimeIntervalSinceReferenceDate(dt.SecondsSinceNSRefenceDate())); }
public ChartDataModel(NSDate xValue, double yValue) { Date = xValue; YValue = yValue; }
public void ICollection2Test() { var value1 = NSDate.FromTimeIntervalSinceNow(1); var value2 = NSDate.FromTimeIntervalSinceNow(2); var value3 = NSDate.FromTimeIntervalSinceNow(3); var key1 = new NSString("key1"); var key2 = new NSString("key2"); var key3 = new NSString("key3"); var dictobj = new NSMutableDictionary <NSString, NSDate> ( new NSString [] { key1, key2 }, new NSDate[] { value1, value1 } ); var dict = (ICollection <KeyValuePair <NSString, NSDate> >)dictobj; // Add Assert.Throws <ArgumentNullException> (() => dict.Add(new KeyValuePair <NSString, NSDate> (null, value1)), "Add ANE 1"); Assert.Throws <ArgumentNullException> (() => dict.Add(new KeyValuePair <NSString, NSDate> (key1, null)), "Add ANE 2"); dict.Add(new KeyValuePair <NSString, NSDate> (key3, value3)); Assert.AreSame(value3, dictobj [key3], "Add 1"); Assert.AreEqual(3, dict.Count, "Add Count"); dictobj.Remove(key3); // restore state. // Clear dict.Clear(); Assert.AreEqual(0, dict.Count, "Clear Count"); dictobj.Add(key1, value1); // restore state dictobj.Add(key2, value1); // restore state // Contains Assert.IsTrue(dict.Contains(new KeyValuePair <NSString, NSDate> (key1, value1)), "Contains 1"); // both key and value matches Assert.IsFalse(dict.Contains(new KeyValuePair <NSString, NSDate> (key1, value2)), "Contains 2"); // found key, wrong value Assert.IsFalse(dict.Contains(new KeyValuePair <NSString, NSDate> (key3, value2)), "Contains 3"); // wrong key // CopyTo var kvp_array = new KeyValuePair <NSString, NSDate> [1]; Assert.Throws <ArgumentNullException> (() => dict.CopyTo(null, 0), "CopyTo ANE"); Assert.Throws <ArgumentOutOfRangeException> (() => dict.CopyTo(kvp_array, -1), "CopyTo AOORE"); Assert.Throws <ArgumentException> (() => dict.CopyTo(kvp_array, kvp_array.Length), "CopyTo AE 2"); Assert.Throws <ArgumentException> (() => dict.CopyTo(kvp_array, 0), "CopyTo AE 3"); kvp_array = new KeyValuePair <NSString, NSDate> [dictobj.Count]; Assert.Throws <ArgumentException> (() => dict.CopyTo(kvp_array, 1), "CopyTo AE 4"); dict.CopyTo(kvp_array, 0); Assert.That(key1, Is.SameAs(kvp_array [0].Key).Or.SameAs(kvp_array [1].Key), "CopyTo K1"); Assert.AreSame(value1, kvp_array [0].Value, "CopyTo V1"); Assert.That(key2, Is.SameAs(kvp_array [0].Key).Or.SameAs(kvp_array [1].Key), "CopyTo K2"); Assert.AreSame(value1, kvp_array [1].Value, "CopyTo V2"); // Count Assert.AreEqual(2, dict.Count, "Count"); // GetEnumerator var enumerated = Enumerable.ToArray(dict); Assert.AreEqual(2, enumerated.Length, "Enumerator Count"); // IsReadOnly Assert.IsFalse(dict.IsReadOnly, "IsReadOnly"); // Remove Assert.Throws <ArgumentNullException> (() => dict.Remove(new KeyValuePair <NSString, NSDate> (null, value3)), "Remove ANE 1"); Assert.Throws <ArgumentNullException> (() => dict.Remove(new KeyValuePair <NSString, NSDate> (key3, null)), "Remove ANE 2"); Assert.IsFalse(dict.Remove(new KeyValuePair <NSString, NSDate> (key3, value3)), "Remove 1"); // inexistent key Assert.AreEqual(2, dict.Count, "Remove 1 Count"); Assert.IsFalse(dict.Remove(new KeyValuePair <NSString, NSDate> (key1, value2)), "Remove 2"); // existing key, wrong value Assert.AreEqual(2, dict.Count, "Remove 2 Count"); Assert.IsTrue(dict.Remove(new KeyValuePair <NSString, NSDate> (key1, value1)), "Remove 3"); // existing key,value pair Assert.AreEqual(1, dict.Count, "Remove 3 Count"); dictobj.Add(key1, value1); // restore state }
public override void ViewDidLoad() { base.ViewDidLoad(); // imgLogo.Image //txtFeet.Text = "6"; //txtInches.Text = "0"; //txtLbs.Text = "150"; //txtSleep.Text = "8"; //txtCigarettes.Text = "0"; pickBDay.MaximumDate = NSDate.Now; imgLogo.Image = UIImage.FromBundle("Images/life.png"); //pickBDay.ValueChanged += delegate { // UIAlertView MessageBox = new UIAlertView("Date",DateTime.SpecifyKind (pickBDay.Date, DateTimeKind.Utc).ToLocalTime().ToString() ,null,"Ok"); // MessageBox.Show(); // }; txtFeet.ShouldReturn = delegate { txtFeet.ResignFirstResponder(); return(true); }; txtInches.ShouldReturn = delegate { txtInches.ResignFirstResponder(); return(true); }; txtLbs.ShouldReturn = delegate { txtLbs.ResignFirstResponder(); return(true); }; txtSleep.ShouldReturn = delegate { txtSleep.ResignFirstResponder(); return(true); }; txtCigarettes.ShouldReturn = delegate { txtCigarettes.ResignFirstResponder(); return(true); }; // Perform any additional setup after loading the view, typically from a nib. btnCalculate.TouchUpInside += delegate { _UserBday = pickBDay.Date; double dFeet = -1; double dInches = -1; double dLbs = -1; double dSleep = -1; double dCigarettes = -1; if (double.TryParse(txtFeet.Text, out dFeet)) { if (double.TryParse(txtInches.Text, out dInches)) { if (double.TryParse(txtLbs.Text, out dLbs)) { if (double.TryParse(txtSleep.Text, out dSleep)) { if (double.TryParse(txtCigarettes.Text, out dCigarettes)) { _User.HrsSleep = dSleep; _User.CigPerDay = dCigarettes; //openlifestyleView _User.BirthDate = DateTime.SpecifyKind(pickBDay.Date, DateTimeKind.Unspecified); _User.Height = (12.0 * dFeet) + dInches; _User.Weight = dLbs; if (segGender.SelectedSegment == 0) { _User.Sex = eGender.male; } else { _User.Sex = eGender.female; } _ResultsiPadVC = new cResultsiPadVC(_User); NavigationController.PushViewController(_ResultsiPadVC, true); } } } } } if ((dFeet == -1) || (dInches == -1) || (dLbs == -1) || (dSleep == -1) || (dCigarettes == -1)) { UIAlertView alert = new UIAlertView("Error", "Please input a number into all fields", null, "OK", null); alert.Show(); } // Perform any additional setup after loading the view, typically from a nib. }; }
public static DateTime ToDateTime(this NSDate date) { return(reference.AddSeconds(date.SecondsSinceReferenceDate).ToLocalTime()); }
public override void GetNextRequestedUpdateDate(Action<NSDate> handler) { Console.WriteLine ("GetNextRequestedUpdateDate"); var nextUpdateDate = new NSDate (); nextUpdateDate.AddSeconds (10); handler (nextUpdateDate); }
private ObservableCollection <ScheduleAppointment> CreateAppointments() { NSDate today = new NSDate(); ObservableCollection <ScheduleAppointment> appCollection = new ObservableCollection <ScheduleAppointment>(); NSCalendar calendar = NSCalendar.CurrentCalendar; //Client Meeting recusive appointments // Get the year, month, day from the date NSDateComponents components = calendar.Components( NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second components.Hour = 10; components.Minute = 0; components.Second = 0; // Get the year, month, day from the date NSDateComponents endDateComponents = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second endDateComponents.Hour = 12; endDateComponents.Minute = 0; endDateComponents.Second = 0; NSDate startDate = calendar.DateFromComponents(components); NSDate endDate = calendar.DateFromComponents(endDateComponents); ScheduleAppointment clientMeetingRecurrence = new ScheduleAppointment(); clientMeetingRecurrence.StartTime = startDate; clientMeetingRecurrence.EndTime = endDate; clientMeetingRecurrence.Subject = (NSString)@"Occurs on Every 1 week"; //assigning RFC standard recurring rule. clientMeetingRecurrence.RecurrenceRule = (NSString)@"FREQ=WEEKLY;INTERVAL=1;BYDAY=FR;COUNT=10"; clientMeetingRecurrence.AppointmentBackground = UIColor.FromRGB(0xD8, 0x00, 0x73); appCollection.Add(clientMeetingRecurrence); // Get the year, month, day from the date NSDateComponents components1 = calendar.Components( NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second components1.Hour = 12; components1.Minute = 0; components1.Second = 0; // Get the year, month, day from the date NSDateComponents endDateComponents1 = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second endDateComponents1.Hour = 13; endDateComponents1.Minute = 0; endDateComponents1.Second = 0; NSDate startDate1 = calendar.DateFromComponents(components1); NSDate endDate1 = calendar.DateFromComponents(endDateComponents1); ScheduleAppointment generalMeetingRecurrence = new ScheduleAppointment(); generalMeetingRecurrence.StartTime = startDate1; generalMeetingRecurrence.EndTime = endDate1; generalMeetingRecurrence.Subject = (NSString)@"Occurs on Every 2 days"; //assinging RFC stardard recurring rule. generalMeetingRecurrence.RecurrenceRule = (NSString)@"FREQ=DAILY;INTERVAL=2;COUNT=25"; generalMeetingRecurrence.AppointmentBackground = UIColor.FromRGB(0xA2, 0xC1, 0x39); appCollection.Add(generalMeetingRecurrence); return(appCollection); }
public override void DidPickStartDate(MSFDateTimePicker dateTimePicker, NSDate startDate, NSDate endDate) { _renderer.Control.Text = startDate.ToDateTime().ToString(); }
public virtual bool SendBefore(NSDate date) { throw new NotSupportedException(); }
/// <summary> /// Purpose: Fill the Sperrdatum control /// Example: FillDateTime("12/2/2013") /// </summary> /// <param name="date">The date for Sperrdatum.</param> public void UpdateDateTime(NSDate date) { TxtDatum.Text = DateTime.SpecifyKind(Utilities.NSDateToDateTime( date), DateTimeKind.Unspecified).ToString("dd.MM.yyyy"); TxtDatumBestand.BecomeFirstResponder(); TxtDatumBestand.ResignFirstResponder(); TxtDatumBestand.Text = BusinessLayer.Artikel.GetArtikelBestandDatum(_artikel.ID, _artikel.Version, TxtDatum.Text, Application._user) + " " + _artikel.Einheit; TxtDummy.BecomeFirstResponder(); TxtDummy.ResignFirstResponder(); }
public void UpdateChart(NSDate startDate, NSDate endDate) { primaryAxis.Minimum = startDate; primaryAxis.Maximum = endDate; }
public DateTime NSDateToDateTime(NSDate date) { // NSDate has a wider range than DateTime, so clip // the converted date to DateTime.Min|MaxValue. double secs = date.SecondsSinceReferenceDate; if (secs < -63113904000) return DateTime.MinValue; if (secs > 252423993599) return DateTime.MaxValue; return (DateTime)date; }
public override void Draw(System.Drawing.RectangleF rect) { base.Draw(rect); // drawing a path if (null != _path) { //System.Diagnostics.Debug.WriteLine("\tupdating path."); // we're going to draw into an image using our checkerboard mask UIGraphics.BeginImageContext(this.Bounds.Size); var context = UIGraphics.GetCurrentContext(); context.ClipToMask(this.Bounds, _maskImage); // do your drawing here context.SetLineWidth(2); context.SetStrokeColorWithColor(UIColor.Green.CGColor); context.AddPath(_path); context.StrokePath(); var imageToDraw = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); // now do the actual drawing of the image var drawContext = UIGraphics.GetCurrentContext(); drawContext.TranslateCTM(0f, Bounds.Size.Height); drawContext.ScaleCTM(1.0f, -1.0f); // very important to switch these off - we don't wnat our grid pattern to be disturbed in any way drawContext.InterpolationQuality = CGInterpolationQuality.None; drawContext.SetAllowsAntialiasing(false); drawContext.DrawImage(Frame, imageToDraw.CGImage); // stash the results of our drawing so we can remove them later _drawnImage.Draw(imageToDraw.CGImage); imageToDraw.Dispose(); _path.Dispose(); _path = null; _fps++; if (_fps >= 10) { _end = NSDate.Now; if(null != _start && null != _end) { var secs = _end.SecondsSinceReferenceDate - _start.SecondsSinceReferenceDate; var fps =10 / secs; System.Diagnostics.Debug.WriteLine("FPS: " + fps.ToString("00.0")); } if(null != _start) _start.Dispose(); _start = _end; _fps = 0; } } }
public static DateTimeOffset FromNSDate(NSDate date) { if (date == NSDate.DistantPast) { return DateTimeOffset.MinValue; } else if (date == NSDate.DistantFuture) { return DateTimeOffset.MaxValue; } return NSDateReferenceDate.AddSeconds(date.SecondsSinceReferenceDate); }
public override bool ShouldSelectDate(TKCalendar calendar, NSDate date) { Console.WriteLine (String.Format ("Trying to select the unselectable {0}", date)); return !TKCalendar.IsDate (main.UnselectableDate, date, NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, main.CalendarView.Calendar); }
public override TKCalendarEventProtocol[] EventsForDate(TKCalendar calendar, NSDate date) { NSDateComponents components = calendar.Calendar.Components (NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, date); components.Hour = 23; components.Minute = 59; components.Second = 59; NSDate endDate = calendar.Calendar.DateFromComponents (components); List<TKCalendarEventProtocol> filteredEvents = new List<TKCalendarEventProtocol> (); for (int i = 0; i < this.owner.Events.Length; i++) { TKCalendarEvent ev = (TKCalendarEvent)this.owner.Events [i]; if (ev.StartDate.SecondsSinceReferenceDate <= endDate.SecondsSinceReferenceDate && ev.EndDate.SecondsSinceReferenceDate >= date.SecondsSinceReferenceDate) { filteredEvents.Add (ev); } } return filteredEvents.ToArray (); }
public void AddEventWithStartTime (NSDate startDate) { // Create a new EKEvent and then set the properties on it. var e = EKEvent.FromStore (EventStore); e.Title = DefaultEventTitle; e.TimeZone = NSTimeZone.LocalTimeZone; e.StartDate = startDate; e.EndDate = startDate.AddSeconds (60 * 60); // 1 hour e.Calendar = SelectedCalendar; // Save our new EKEvent NSError err; bool success = EventStore.SaveEvent (e, EKSpan.FutureEvents, true, out err); if (!success) Console.WriteLine ("There was an error saving a new event: " + err); }
public static void LogInAsync(string facebookId, string accessToken, NSDate expirationDate, NSAction callback) { var d = new NSActionDispatcher (callback); LogInAsync (facebookId, accessToken, expirationDate, d, NSActionDispatcher.Selector); }
public MotionActivityQuery (NSDate startDate, NSDate endDate, bool today) { StartDate = startDate; EndDate = endDate; IsToday = today; }
/// <summary> /// Purpose: Fill the Sperrdatum control /// Example: FillDateTime("12/2/2013") /// </summary> /// <param name="date">The date for Sperrdatum.</param> public void UpdateDateTime(NSDate date) { TxtGeneralSperrdatum.Text = DateTime.SpecifyKind(Utilities.NSDateToDateTime( date), DateTimeKind.Unspecified).ToString("dd.MM.yyyy"); TxtGeneralSperrGrund.BecomeFirstResponder(); TxtGeneralSperrGrund.ResignFirstResponder(); }
public override bool ShouldEndPickingStartDate(MSFDateTimePicker dateTimePicker, NSDate startDate, NSDate endDate) { if (startDate.Compare(_renderer.Element.MinimumDate.ToNSDate()) == NSComparisonResult.Ascending) { return(false); } if (endDate.Compare(_renderer.Element.MaximumDate.ToNSDate()) == NSComparisonResult.Descending) { return(false); } return(true); }
public virtual void SetDate(NSDate date) { throw new PlatformNotSupportedException(Constants.WatchKitRemoved); }
public override void DidSelectDate(TKCalendar calendar, NSDate date) { main.EventsForDate = calendar.EventsForDate (date); main.TableView.ReloadData (); }
void UpdateMaximumDate() => _endDate = Element.MaximumDate.ToNSDate();
private static DateTime NSDateToDateTime(NSDate date) { DateTime reference = TimeZone.CurrentTimeZone.ToLocalTime( new DateTime(2001, 1, 1, 0, 0, 0)); return reference.AddSeconds(date.SecondsSinceReferenceDate); }
void UpdateMinimumDate() => _startDate = Element.MinimumDate.ToNSDate();
/// <summary> /// Handles the send button pressed event. We send the message to the user or users on the conversation. /// </summary> /// <param name="button">Button.</param> /// <param name="text">Text.</param> /// <param name="senderId">Sender identifier.</param> /// <param name="senderDisplayName">Sender display name.</param> /// <param name="date">Date.</param> public override async void PressedSendButton (UIButton button, string text, string senderId, string senderDisplayName, NSDate date) { await SendMessage (text); }
private void Updater(nint stepCount, NSDate date, NSError error) { NSDate sMidnight = Helpers.DateHelpers.DateTimeToNSDate(_resetTime); _stepCounter.QueryStepCount(sMidnight, NSDate.Now, _queue, DailyStepQueryHandler); }
public static void LinkUserAsync(ParseUser user, string facebookId, string accessToken, NSDate expirationDate, NSAction callback) { var d = new NSActionDispatcher (callback); LinkUserAsync (user, facebookId, accessToken, expirationDate, d, NSActionDispatcher.Selector); }
public DigitalGauge() { NSDate date = new NSDate(); NSString currentDateandTime = (NSString)date.ToString(); //SevenSegmentGauge segmentSevenGauge = new SFDigitalGauge(); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { segmentSevenGauge.CharacterHeight = 48; segmentSevenGauge.CharacterWidth = 24; segmentSevenGauge.VerticalPadding = 20; } else { segmentSevenGauge.CharacterHeight = 36; segmentSevenGauge.CharacterWidth = 18; segmentSevenGauge.VerticalPadding = 10; } segmentSevenGauge.SegmentWidth = 3; segmentSevenGauge.CharacterType = SFDigitalGaugeCharacterType.SFDigitalGaugeCharacterTypeSegmentSeven; segmentSevenGauge.StrokeType = SFDigitalGaugeStrokeType.SFDigitalGaugeStrokeTypeTriangleEdge; segmentSevenGauge.Value = currentDateandTime; segmentSevenGauge.DimmedSegmentAlpha = 0.11f; segmentSevenGauge.BackgroundColor = UIColor.FromRGB(248, 248, 248); segmentSevenGauge.CharacterColor = UIColor.FromRGB(20, 108, 237); segmentSevenGauge.DimmedSegmentColor = UIColor.FromRGB(20, 108, 237); //FourteenSegmentGauge segmentFourteenGauge = new SFDigitalGauge(); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { segmentFourteenGauge.CharacterHeight = 48; segmentFourteenGauge.CharacterWidth = 24; segmentFourteenGauge.VerticalPadding = 20; } else { segmentFourteenGauge.CharacterHeight = 36; segmentFourteenGauge.CharacterWidth = 18; segmentFourteenGauge.VerticalPadding = 10; } segmentFourteenGauge.SegmentWidth = 3; segmentFourteenGauge.CharacterType = SFDigitalGaugeCharacterType.SFDigitalGaugeCharacterTypeSegmentFourteen; segmentFourteenGauge.StrokeType = SFDigitalGaugeStrokeType.SFDigitalGaugeStrokeTypeTriangleEdge; segmentFourteenGauge.Value = currentDateandTime; segmentFourteenGauge.DimmedSegmentAlpha = 0.11f; segmentFourteenGauge.BackgroundColor = UIColor.FromRGB(248, 248, 248); segmentFourteenGauge.CharacterColor = UIColor.FromRGB(2, 186, 94); segmentFourteenGauge.DimmedSegmentColor = UIColor.FromRGB(2, 186, 94); //SixteenSegmentGauge segmentSixteenGauge = new SFDigitalGauge(); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { segmentSixteenGauge.CharacterHeight = 48; segmentSixteenGauge.CharacterWidth = 24; segmentSixteenGauge.VerticalPadding = 20; } else { segmentSixteenGauge.CharacterHeight = 36; segmentSixteenGauge.CharacterWidth = 18; segmentSixteenGauge.VerticalPadding = 10; } segmentSixteenGauge.SegmentWidth = 3; segmentSixteenGauge.CharacterType = SFDigitalGaugeCharacterType.SFDigitalGaugeCharacterTypeSegmentSixteen; segmentSixteenGauge.StrokeType = SFDigitalGaugeStrokeType.SFDigitalGaugeStrokeTypeTriangleEdge; segmentSixteenGauge.Value = currentDateandTime; segmentSixteenGauge.DimmedSegmentAlpha = 0.11f; segmentSixteenGauge.BackgroundColor = UIColor.FromRGB(248, 248, 248); segmentSixteenGauge.CharacterColor = UIColor.FromRGB(219, 153, 7); segmentSixteenGauge.DimmedSegmentColor = UIColor.FromRGB(219, 153, 7); //8*8 MatrixSegmentGauge segmentMatrixGauge = new SFDigitalGauge(); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { segmentMatrixGauge.CharacterHeight = 48; segmentMatrixGauge.CharacterWidth = 22; segmentMatrixGauge.VerticalPadding = 20; } else { segmentMatrixGauge.CharacterHeight = 36; segmentMatrixGauge.CharacterWidth = 17; segmentMatrixGauge.VerticalPadding = 10; } segmentMatrixGauge.SegmentWidth = 3; segmentMatrixGauge.CharacterType = SFDigitalGaugeCharacterType.SFDigitalGaugeCharacterTypeEightCrossEightDotMatrix; segmentMatrixGauge.StrokeType = SFDigitalGaugeStrokeType.SFDigitalGaugeStrokeTypeTriangleEdge; segmentMatrixGauge.Value = currentDateandTime; segmentMatrixGauge.DimmedSegmentAlpha = 0.11f; segmentMatrixGauge.BackgroundColor = UIColor.FromRGB(248, 248, 248); segmentMatrixGauge.CharacterColor = UIColor.FromRGB(249, 66, 53); segmentMatrixGauge.DimmedSegmentColor = UIColor.FromRGB(249, 66, 53); //adding to View this.AddSubview(segmentSevenGauge); this.AddSubview(segmentFourteenGauge); this.AddSubview(segmentSixteenGauge); this.AddSubview(segmentMatrixGauge); mainPageDesign(); }
protected override void OnRenderFrame(FrameEventArgs e) { base.OnRenderFrame (e); var sz = new Size((int)Frame.Width, (int)Frame.Height); if (sz.Width != Size.Width) { Size = sz; } MakeCurrent (); // // Initialize drawables // foreach (var d in _drawablesNeedingLoad) { d.LoadContent (); } _drawablesNeedingLoad.Clear (); // // Determine the current sim time // var t = new NSDate().SecondsSinceReferenceDate; var wallNow = DateTime.UtcNow; var time = new SimTime() { Time = wallNow, WallTime = wallNow, TimeElapsed = t - _lastT, WallTimeElapsed = t - _lastT }; _lastT = t; //Console.WriteLine ("FPS {0:0}", 1.0 / time.WallTimeElapsed); GL.Viewport (0, 0, Size.Width, Size.Height); GL.ClearColor (158/255.0f, 207/255.0f, 237/255.0f, 1.0f); GL.Clear((int)(All.DepthBufferBit | All.ColorBufferBit)); // // Set the common OpenGL state // GL.Enable(All.Blend); GL.BlendFunc(All.SrcAlpha, All.OneMinusSrcAlpha); GL.Enable(All.DepthTest); GL.EnableClientState(All.VertexArray); // // Render the background // _background.Render(); // // Setup the 3D camera // Camera.SetViewport(Size.Width, Size.Height); CameraMan.Update(time); Camera.Execute(CameraMan); // // Enable the sun // if (ShowSun) { GL.Enable(All.Lighting); GL.Enable(All.ColorMaterial); GL.Enable(All.Light0); var sp = _sunLoc.ToPositionAboveSeaLevel(150000000); GL.Light(All.Light0, All.Position, new float[]{sp.X,sp.Y,sp.Z,1}); } // // Draw all the layers // foreach (var d in _drawables) { d.Draw(Camera, time); } if (ShowSun) { GL.Disable(All.Lighting); GL.Disable(All.ColorMaterial); } SwapBuffers(); frameCount++; }
internal ObservableCollection <ScheduleAppointment> CreateAppointments() { NSDate today = new NSDate(); SetColors(); SetSubjects(); ObservableCollection <ScheduleAppointment> appCollection = new ObservableCollection <ScheduleAppointment>(); NSCalendar calendar = NSCalendar.CurrentCalendar; // Get the year, month, day from the date NSDateComponents components = calendar.Components( NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second components.Hour = 10; components.Minute = 0; components.Second = 0; // Get the year, month, day from the date NSDateComponents endDateComponents = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second endDateComponents.Hour = 12; endDateComponents.Minute = 0; endDateComponents.Second = 0; Random randomNumber = new Random(); for (int i = 0; i < 10; i++) { components.Hour = randomNumber.Next(10, 16); endDateComponents.Hour = components.Hour + randomNumber.Next(1, 3); NSDate startDate = calendar.DateFromComponents(components); NSDate endDate = calendar.DateFromComponents(endDateComponents); ScheduleAppointment appointment = new ScheduleAppointment(); appointment.StartTime = startDate; appointment.EndTime = endDate; components.Day = components.Day + 1; endDateComponents.Day = endDateComponents.Day + 1; appointment.Subject = (NSString)subjectCollection[i]; appointment.AppointmentBackground = colorCollection[i]; if (i == 2 || i == 4) { appointment.IsAllDay = true; } appCollection.Add(appointment); } NSDateComponents startDateComponents = calendar.Components( NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); startDateComponents.Minute = 0; startDateComponents.Second = 0; // Minimum Height Appointments for (int i = 0; i < 5; i++) { startDateComponents.Hour = randomNumber.Next(9, 18); NSDate startDate = calendar.DateFromComponents(startDateComponents); ScheduleAppointment appointment = new ScheduleAppointment(); appointment.StartTime = startDate; appointment.EndTime = startDate; startDateComponents.Day = startDateComponents.Day + 1; appointment.Subject = (NSString)minTimeSubjectCollection[i]; appointment.AppointmentBackground = colorCollection[randomNumber.Next(0, 14)]; // Setting Mininmum Appointment Height for Schedule Appointments appointment.MinHeight = 25; appCollection.Add(appointment); } return(appCollection); }
public static NSDate ToNSDate(this DateTime datetime) { return(NSDate.FromTimeIntervalSinceReferenceDate((datetime.ToUniversalTime() - reference).TotalSeconds)); }