public static string TimeSelectorToString(TimeSpanPicker timeselector) { string result = timeselector.ValueString.Substring(0, 2) + timeselector.ValueString.Substring(3, 2) + timeselector.ValueString.Substring(6, 2); return(result); }
public void Connect(Button btnStart, TimeSpanPicker timePicker, TimerControl ctrlTimer) { this.btnStart = btnStart; btnStart.Click -= btnStartTimer_Click; btnStart.Click += btnStartTimer_Click; this.ctrlTimer = ctrlTimer; this.timePicker = timePicker; }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.TimePicker> e) { base.OnElementChanged(e); if (Control != null && e.OldElement == null && Element != null && e.NewElement is TimeSpanPicker) { _control = (TimeSpanPicker)e.NewElement; Control.SetBackground(Context.GetDrawable(Resource.Drawable.EntryBorder)); Control.SetPadding(10, 10, 10, 10); Control.TextSize = Convert.ToSingle(Device.GetNamedSize(NamedSize.Medium, _control)); Control.SetOnClickListener(this); } }
private void ApplicationBarAddButton_Click(object sender, EventArgs e) { PivotItem pItem = new PivotItem(); pItem.Header = "cycle " + App.ViewModel.CycleCounter++; TimeSpanPicker picker = new TimeSpanPicker(); picker.Value = new TimeSpan(0); picker.Step = new TimeSpan(0, 0, 1); picker.ValueStringFormat = "{0:hh:mm:ss.fff}"; picker.Template = (ControlTemplate)Application.Current.Resources["TimeSpanCustomStyle"]; pItem.Content = picker; cyclePivot.Items.Add(pItem); dateTimeEndCycles.Add(new DateTime()); dateTimeRunningCycles.Add(new DateTime()); }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.TimePicker> e) { base.OnElementChanged(e); if (Control != null && e.OldElement == null && Element != null && e.NewElement is TimeSpanPicker) { _control = (TimeSpanPicker)e.NewElement; _control.HorizontalOptions = LayoutOptions.Start; if (_control.Is24Hour) { Control.ClockIdentifier = "24HourClock"; } } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); _dgTrendPens = GetTemplateChild("dgTrendPens") as DataGrid; if (_dgTrendPens != null) { UpdateDgPensColumnsVisibility(); } _gTrendPresenters = (Grid) GetTemplateChild("gTrendPresenters"); if (_gTrendPresenters != null) { _gTrendPresenters.MouseLeftButtonDown += GTrendPresentersMouseLeftButtonDown; _gTrendPresenters.MouseLeftButtonUp += GTrendPresentersMouseLeftButtonUp; _gTrendPresenters.MouseMove += GTrendPresentersMouseMove; } _gVerticalAxes = (Grid)GetTemplateChild("gVerticalAxes"); _cVerticalAxes = (Canvas)GetTemplateChild("cVerticalAxes"); if (_cVerticalAxes != null) { _cVerticalAxes.SizeChanged += CVerticalAxesSizeChanged; } _cHorizontalAxes = (Canvas)GetTemplateChild("cHorizontalAxes"); if (_cHorizontalAxes != null) { _cHorizontalAxes.SizeChanged += CHorizontalAxesSizeChanged; } _spHorisontalAxes = (StackPanel)GetTemplateChild("spHorisontalAxes"); #region Slider _slSlider = GetTemplateChild("slSlider") as Slider; if (_slSlider != null) { var sliderBinding = new Binding("CursorPosition") { Source = this, Mode = BindingMode.TwoWay }; _slSlider.SetBinding(RangeBase.ValueProperty, sliderBinding); } _cdSliderOffset = (ColumnDefinition)GetTemplateChild("cdSliderOffset"); _gSlider = (Grid)GetTemplateChild("gSlider"); if (_gSlider != null) _gSlider.SizeChanged += GSliderSizeChanged; _cSlider = (Canvas)GetTemplateChild("cSlider"); if (_cSlider != null) { var presentersVisibilityBinding = new Binding("ShowCursorPresenters") { Source = this, Converter = new BooleanToVisibilityConverter() }; _cSlider.SetBinding(VisibilityProperty, presentersVisibilityBinding); _cSlider.SizeChanged += CSliderSizeChanged; } _spSlider = (Panel)GetTemplateChild("spSlider"); UpdateSliderVisibility(); #endregion #region SetPeriod _popupPeriod = GetTemplateChild("popupPeriod") as Popup; _tspSetPeriod = GetTemplateChild("tspSetPeriod") as TimeSpanPicker; if (_popupPeriod != null && _tspSetPeriod != null) { _popupPeriod.Opened += PopupPeriodOpened; _tspSetPeriod.KeyUp += TspSetPeriodKeyUp; var bSetPeriod = GetTemplateChild("bSetPeriod") as Button; if (bSetPeriod != null) bSetPeriod.Click += BSetPeriodClick; } #endregion #region SetTime _popupTime = GetTemplateChild("popupTime") as Popup; _dtpSetTime = GetTemplateChild("dtpSetTime") as DateTimePicker; if (_popupTime != null && _dtpSetTime != null) { _popupTime.Opened += PopupTimeOpened; _dtpSetTime.KeyUp += DtpSetTimeKeyUp; var bSetTime = GetTemplateChild("bSetTime") as Button; if (bSetTime != null) { bSetTime.Click += BSetTimeClick; } } #endregion }