/// <summary> /// Constructor /// </summary> /// <param name="label"></param> /// <param name="property"></param> public DateTimeEditor(PropertyLabel label, PropertyItem property) : base(property) { currentValue = property.Value; property.PropertyChanged += property_PropertyChanged; property.ValueError += property_ValueError; contentPanel = new StackPanel(); this.Content = contentPanel; datePicker = new DatePicker { Visibility = Visibility.Visible, Margin = new Thickness(0), VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Stretch }; datePicker.CalendarOpened += dtp_CalendarOpened; datePicker.CalendarClosed += dtp_CalendarClosed; datePicker.LostFocus += dtp_LostFocus; contentPanel.Children.Add(datePicker); datePicker.Focus(); this.ShowTextBox(); }
public void DatePickerTest() { _isDatePickerLoaded = false; DatePicker datePicker = new DatePicker(); datePicker.Loaded += new RoutedEventHandler(DatePicker_Loaded); TestPanel.Children.Add(datePicker); EnqueueConditional(IsDatePickerLoaded); DateTimeFormatInfo dtfi = DateTimeHelper.GetCurrentDateFormat(); EnqueueCallback(delegate { datePicker.Text = DateTime.Today.ToString(CultureInfo.CurrentCulture); }); EnqueueCallback(delegate { Assert.IsTrue(DateTime.Compare(datePicker.SelectedDate.Value, DateTime.Today) == 0); }); EnqueueCallback(delegate { Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, DateTime.Today.ToString(dtfi.ShortDatePattern, dtfi)), datePicker.Text); datePicker.IsDropDownOpen = true; datePicker.IsDropDownOpen = false; }); EnqueueTestComplete(); }
public void DPCheckDefaultValues() { DatePicker datePicker = new DatePicker(); Assert.IsTrue(CompareDates(datePicker.DisplayDate, DateTime.Today)); Assert.IsNull(datePicker.DisplayDateStart); Assert.IsNull(datePicker.DisplayDateEnd); Assert.AreEqual(datePicker.FirstDayOfWeek, CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek); Assert.IsFalse(datePicker.IsDropDownOpen); Assert.IsTrue(datePicker.IsTodayHighlighted); Assert.IsNull(datePicker.SelectedDate); Assert.AreEqual(datePicker.SelectedDateFormat, DatePickerFormat.Short); Assert.IsTrue(datePicker.BlackoutDates.Count == 0); Assert.AreEqual(datePicker.Text, string.Empty); DateTime d = (DateTime)datePicker.GetValue(DatePicker.DisplayDateProperty); Assert.IsTrue(CompareDates(d, DateTime.Today)); Assert.IsNull((CalendarDateRange)datePicker.GetValue(DatePicker.DisplayDateEndProperty)); Assert.IsNull((CalendarDateRange)datePicker.GetValue(DatePicker.DisplayDateStartProperty)); Assert.AreEqual((DayOfWeek)datePicker.GetValue(DatePicker.FirstDayOfWeekProperty), DayOfWeek.Sunday); Assert.IsFalse((bool)datePicker.GetValue(DatePicker.IsDropDownOpenProperty)); Assert.IsTrue((bool)datePicker.GetValue(DatePicker.IsTodayHighlightedProperty)); Assert.IsNull((DateTime?)datePicker.GetValue(DatePicker.SelectedDateProperty)); Assert.AreEqual((DatePickerFormat)datePicker.GetValue(DatePicker.SelectedDateFormatProperty), DatePickerFormat.Short); Assert.AreEqual((string)datePicker.GetValue(DatePicker.TextProperty), string.Empty); }
public async void Add(object sender, DatePicker startDate, TimePicker startTime, TextBox subject, TextBox location, TextBox details, ComboBox duration, CheckBox allDay) { FrameworkElement element = (FrameworkElement)sender; GeneralTransform transform = element.TransformToVisual(null); Point point = transform.TransformPoint(new Point()); Rect rect = new Rect(point, new Size(element.ActualWidth, element.ActualHeight)); DateTimeOffset date = startDate.Date; TimeSpan time = startTime.Time; int minutes = int.Parse((string)((ComboBoxItem)duration.SelectedItem).Tag); Appointment appointment = new Appointment() { StartTime = new DateTimeOffset(date.Year, date.Month, date.Day, time.Hours, time.Minutes, 0, TimeZoneInfo.Local.GetUtcOffset(DateTime.Now)), Subject = subject.Text, Location = location.Text, Details = details.Text, Duration = TimeSpan.FromMinutes(minutes), AllDay = (bool)allDay.IsChecked }; string id = await AppointmentManager.ShowAddAppointmentAsync(appointment, rect, Placement.Default); if (string.IsNullOrEmpty(id)) { Show("Appointment not Added", "Appointment App"); } else { Show(string.Format("Appointment {0} Added", id), "Appointment App"); } }
public void basic_datepicker_render() { var html = new DatePicker("foo").ToString(); html.ShouldHaveHtmlNode("foo") .ShouldBeNamed(HtmlTag.Input) .ShouldHaveAttribute(HtmlAttribute.Type).WithValue(HtmlInputType.Date); }
public Issue2292 () { var datePicker = new DatePicker (); var datePickerBtn = new Button { Text = "Click me to call .Focus on DatePicker" }; datePickerBtn.Clicked += (sender, args) => { datePicker.Focus (); }; var datePickerBtn2 = new Button { Text = "Click me to call .Unfocus on DatePicker" }; datePickerBtn2.Clicked += (sender, args) => { datePicker.Unfocus (); }; Content = new StackLayout { Children = { datePickerBtn, datePickerBtn2, datePicker, } }; }
public DatePickerHtmlBuilderTests() { date = new DateTime(2009, 12, 3); datePicker = DatePickerTestHelper.CreateDatePicker(null, null); datePicker.Name = "DatePicker"; renderer = new DatePickerHtmlBuilder(datePicker); }
public AddMusicianViewModel() { CheckData = new RelayCommand(AddMusician,validateData); CheckTitle = new RelayCommand(AddTitleRelay, validateTitle); CheckConcert = new RelayCommand(AddConcertRelay, validateConcert); addMusicianDA = new AddMusicianDataAccess(); addBirthdate = new DatePicker(); }
public async Task<String> signup(String username, String email, String password, ComboBox gender, DatePicker birthdate, ProgressBar progressBar) { HttpResponseMessage response = null; String responseString = null; _progressBar = progressBar; try { String formatted_gender = ""; if (gender.SelectedIndex != -1) { formatted_gender = ((ComboBoxItem)gender.SelectedItem).Content.ToString(); } if (password != "") { password = h.sha512(password); } String year = birthdate.Date.Year.ToString(); String month = birthdate.Date.Month.ToString().PadLeft(2, '0'); String day = birthdate.Date.Day.ToString().PadLeft(2, '0'); String formatted_birthdate = year + "-" + month + "-" + day; var values = new Dictionary<string, string> { { "username", username }, { "email", email }, { "password", password }, { "gender", formatted_gender }, { "birthdate", formatted_birthdate } }; HttpFormUrlEncodedContent formContent = new HttpFormUrlEncodedContent(values); IProgress<HttpProgress> progress = new Progress<HttpProgress>(ProgressHandler); _progressBar.Visibility = Windows.UI.Xaml.Visibility.Visible; response = await httpClient.PostAsync(new Uri(settings.API + "/register/"), formContent).AsTask(cts.Token, progress); responseString = await response.Content.ReadAsStringAsync(); Debug.WriteLine("register | responseString: " + responseString); } catch (TaskCanceledException) { Debug.WriteLine("register | Canceled"); } catch (Exception ex) { Debug.WriteLine("register | Error: " + ex.StackTrace); } finally { Debug.WriteLine("register | Completed"); resetProgressBar(); } return responseString; }
public void New(DatePicker startDate, TimePicker startTime, TextBox subject, TextBox location, TextBox details, ComboBox duration, CheckBox allDay) { startDate.Date = DateTime.Now; startTime.Time = DateTime.Now.TimeOfDay; subject.Text = string.Empty; location.Text = string.Empty; details.Text = string.Empty; duration.SelectedIndex = 0; allDay.IsChecked = false; }
private void OnClick(object o, EventArgs e) { if (birthDateListItem.Selected) { DatePicker datePicker = new DatePicker(this); datePicker.Title.Text = "Enter your birthdate"; datePicker.Value = calculator.BirthDate; if (datePicker.ShowDialog() == System.Windows.Forms.DialogResult.OK) calculator.BirthDate = datePicker.Value; datePicker.Dispose(); } }
void setdayClick(object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = true; DatePicker datePicker = new DatePicker(owner); datePicker.Title.Text = "Enter date"; datePicker.Value = calculator.CurrentDate; if (datePicker.ShowDialog() == System.Windows.Forms.DialogResult.OK) calculator.CurrentDate = datePicker.Value; datePicker.Dispose(); this.Hide(); }
public void CreateInXaml() { object result = XamlReader.Load("<toolkit:DatePicker SelectedDate=\"04/30/2008\" DisplayDateStart=\"04/30/2020\" DisplayDateEnd=\"04/30/2010\" DisplayDate=\"02/02/2000\" xmlns='http://schemas.microsoft.com/client/2007'" + " xmlns:toolkit=\"clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls\" />"); Assert.IsInstanceOfType(result, typeof(DatePicker)); _elementToCleanUp = (DatePicker)result; ((DatePicker)result).Loaded += new RoutedEventHandler(_elementToCleanUp_Loaded); TestPanel.Children.Add(_elementToCleanUp); EnqueueConditional(IsLoaded); EnqueueCallback(() => VerifyXamlValues()); EnqueueTestComplete(); }
public VenuesPage() { InitializeComponent(); (App.Current as App).inverted = IsLightTheme; if ((App.Current as App).inverted) { LayoutRoot.Background = new SolidColorBrush(Colors.White); textBlock1.Foreground = new SolidColorBrush(Colors.Black); PgTitle.Foreground = new SolidColorBrush(Colors.Black); meal.Foreground = new SolidColorBrush(Colors.Black); date.Foreground = new SolidColorBrush(Colors.Black); listBox.Foreground = new SolidColorBrush(Colors.Black); } else { LayoutRoot.Background = new SolidColorBrush(Colors.Black); textBlock1.Foreground = new SolidColorBrush(Colors.White); PgTitle.Foreground = new SolidColorBrush(Colors.White); meal.Foreground = new SolidColorBrush(Colors.White); date.Foreground = new SolidColorBrush(Colors.White); listBox.Foreground = new SolidColorBrush(Colors.White); } mealChange.IsOpen = false; textBlock1.Visibility = Visibility.Visible; textBlock1.Text = "Loading menu, please wait."; ApplicationBar = new ApplicationBar(); ApplicationBarIconButton settings = new ApplicationBarIconButton(); settings.IconUri = new Uri("/Images/settings.png", UriKind.Relative); settings.Text = "Settings"; settings.Click += new EventHandler(settings_Click); ApplicationBarIconButton changeMeal = new ApplicationBarIconButton(); changeMeal.IconUri = new Uri("/Images/change.png", UriKind.Relative); changeMeal.Text = "Change"; changeMeal.Click += new EventHandler(changeMeal_Click); ApplicationBar.Buttons.Add(changeMeal); ApplicationBar.Buttons.Add(settings); dPicker = (App.Current as App).datePick; dPicker.ValueStringFormat = "{0:D}"; date.Text = dPicker.ValueString; meal.Text = (App.Current as App).mealString; if (appsettings.Contains("vegan")) { (App.Current as App).ovoFilter = (bool)appsettings["ovolacto"]; (App.Current as App).veganFilter = (bool)appsettings["vegan"]; } }
public DatePickerRenderingTests() { viewContext = TestHelper.CreateViewContext(); textWriter = new Mock<TextWriter>(); tagBuilder = new Mock<IDatePickerHtmlBuilder>(); rootTag = new Mock<IHtmlNode>(); rootTag.SetupGet(t => t.Children).Returns(() => new List<IHtmlNode>()); tagBuilder.Setup(t => t.Build()).Returns(rootTag.Object); datePicker = DatePickerTestHelper.CreateDatePicker(tagBuilder.Object, viewContext); datePicker.Name = "DatePicker"; }
private void MainForm_Load(object sender, EventArgs e) { tabView.SelectedIndex = 0; standardGraphView.Show(); tabView.Show(); if (calculator.BirthDate == DateTime.MinValue) { DatePicker datePicker = new DatePicker(tabView); datePicker.Title.Text = "Enter your birthdate"; datePicker.Value = calculator.BirthDate; if (datePicker.ShowDialog() == System.Windows.Forms.DialogResult.OK) calculator.BirthDate = datePicker.Value; datePicker.Dispose(); } }
/**************************************************************** * Constructors **/ public DateAndTimeScreen() { InitializeComponent(); // Temp Value m_bIsOn = true; m_dateAndTime = this.grou_date_and_time; m_txtSwitch = this.txt_switch; m_toggleButton = this.ts_toggle; m_datePicker = this.dp_picker_date; m_datePicker.DataContext = this; m_timePicker = this.tp_picler_time; m_timePicker.DataContext = this; // set date and time to on this.UpdateSwitch(); }
public static DatePicker CreateDatePicker(IDatePickerHtmlBuilder renderer, ViewContext viewContext) { Mock<HttpContextBase> httpContext = TestHelper.CreateMockedHttpContext(); httpContext.Setup(c => c.Request.Browser.CreateHtmlTextWriter(It.IsAny<TextWriter>())).Returns(new HtmlTextWriter(TextWriter.Null)); Mock<IClientSideObjectWriterFactory> clientSideObjectWriterFactory = new Mock<IClientSideObjectWriterFactory>(); clientSideObjectWriter = new Mock<IClientSideObjectWriter>(); viewContext = viewContext ?? TestHelper.CreateViewContext(); clientSideObjectWriterFactory.Setup(c => c.Create(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<TextWriter>())).Returns(clientSideObjectWriter.Object); DatePicker datepicker = new DatePicker(viewContext, clientSideObjectWriterFactory.Object); renderer = renderer ?? new DatePickerHtmlBuilder(datepicker); return datepicker; }
public IEnumerable<object> Render(PanelItem panelItem) { var validator = PanelValidator.Create(panelItem.GetPropertyName()); string cssClass = (panelItem.Editable) ? string.Empty : "ui-state-disabled "; DatePicker datePicker = new DatePicker { ID = panelItem.GetId(), Enabled = panelItem.Editable, Width = new Unit(panelItem.Width, UnitType.Ex), DateFormatString = DateFormat, AppendText = ResourceManager.GetString(DateFormat), LocID = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, CssClass = cssClass + "adfj-record-item adfj-record-item-calender adfj-record-item-" + panelItem.GetClassName() }; panelItem.Target = datePicker; return new object[] { validator, datePicker }; }
public override FrameworkElement buildFieldView() { StackPanel dateLayout = new StackPanel(); dateLayout.Orientation = Orientation.Horizontal; DatePicker datePicker = new DatePicker(); datePicker.VerticalAlignment = VerticalAlignment.Top; datePicker.HorizontalAlignment = HorizontalAlignment.Stretch; datePicker.FontFamily = getSkin().getFieldFont(); datePicker.FontSize = getSkin().getFieldFontSize(); //note .. do not set color - should be according to wp theme if (getField().getFieldInfo().isReadOnly()) { datePicker.IsEnabled = false; datePicker.Foreground = new SolidColorBrush(Colors.LightGray); } return datePicker; }
protected override void Init() { var datePicker = new DatePicker { AutomationId = DatePicker }; var datePickerFocusButton = new Button { Text = "Click to focus DatePicker", Command = new Command(() => datePicker.Focus()) }; Content = new StackLayout { Children = { datePicker, datePickerFocusButton } }; }
public static void EditCard(Card Card, DatePicker dtpckrDueDate, ObservableCollection<Card> CardsCollection) { Card.Name = Card.Name; Card.Description = Card.Description; Card.DueDate = dtpckrDueDate.Date.Date; Card.AssignedColor = Card.AssignedColor; short _counter = 0; try { foreach (var _card in CardsCollection) { if (Card == _card) { CardsCollection[_counter] = Card; } _counter++; } } catch { } project_flux.API.Card.Update(Card.ID, Card.JobID, Card.Name, Card.Description, Card.Weight, Card.DueDate, Card.AssignedColor); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Begin building a new dialog. var builder = new AlertDialog.Builder(Activity); Rect displayRectangle = new Rect(); Window window = Activity.Window; window.DecorView.GetWindowVisibleDisplayFrame(displayRectangle); var inflater = Activity.LayoutInflater; dateView = inflater.Inflate(Resource.Layout.DateRange, null); dateView.SetMinimumHeight((int)(displayRectangle.Width() * 0.9f)); dateView.SetMinimumHeight((int)(displayRectangle.Height() * 0.9f)); Button butOk = dateView.FindViewById<Button> (Resource.Id.butok); butOk.Click+= ButOk_Click; datePicker1 = DatePicker.NewInstance(SetDateDlg1); datePicker2 = DatePicker.NewInstance(SetDateDlg2); EditText frd = dateView.FindViewById<EditText> (Resource.Id.trxdatefr); EditText tod = dateView.FindViewById<EditText> (Resource.Id.trxdateto); frd.Text = DateTime.Today.ToString ("dd-MM-yyyy"); frd.Click += delegate(object sender, EventArgs e) { datePicker1.Show(FragmentManager, "datePicker"); }; tod.Text = DateTime.Today.ToString ("dd-MM-yyyy"); tod.Click += delegate(object sender, EventArgs e) { datePicker2.Show(FragmentManager, "datePicker2"); }; builder.SetView (dateView); builder.SetPositiveButton ("CANCEL", HandlePositiveButtonClick); var dialog = builder.Create(); //Now return the constructed dialog to the calling activity return dialog; }
/// <summary> /// Override the default template /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); datePicker = (DatePicker)GetTemplateChild("PART_DatePicker"); if (datePicker == null) datePicker = new DatePicker(); timePicker = (TimePicker)GetTemplateChild("PART_TimePicker"); if (timePicker == null) timePicker = new TimePicker(); datePicker.SelectedDateChanged += delegate{ SetCurrentDateTime(); }; timePicker.SelectedTimeChanged += delegate { SetCurrentDateTime(); }; datePicker.CurrentlySelectedDate = DateTimeSelected; timePicker.SelectedTime = DateTimeSelected.TimeOfDay; //snyc the min and max date for datepicker Binding minDateBinding = new Binding("MinDate"); minDateBinding.Source = this; datePicker.SetBinding(DatePicker.MinDateProperty, minDateBinding); Binding maxDateBinding = new Binding("MaxDate"); maxDateBinding.Source = this; datePicker.SetBinding(DatePicker.MaxDateProperty, maxDateBinding); //snyc the min and max time for timepicker Binding minTimeBinding = new Binding("MinDate.TimeOfDay"); minTimeBinding.Source = this; timePicker.SetBinding(TimePicker.MinTimeProperty, minTimeBinding); Binding maxTimeBinding = new Binding("MaxDate.TimeOfDay"); maxTimeBinding.Source = this; timePicker.SetBinding(TimePicker.MaxTimeProperty, maxTimeBinding); }
public override View GetView(int index) { if (base.GetView(index) == null) { _datePicker = new DatePicker { HorizontalOptions = LayoutOptions.FillAndExpand // set the style ID on the view so that we can retrieve it when UI testing #if UI_TESTING , StyleId = Name #endif }; _timePicker = new TimePicker { HorizontalOptions = LayoutOptions.FillAndExpand, // set the style ID on the view so that we can retrieve it when UI testing #if UI_TESTING , StyleId = Name #endif }; Color defaultTextColor = _datePicker.TextColor; _datePicker.TextColor = Color.Gray; _timePicker.TextColor = Color.Gray; _hasFocused = false; _datePicker.Focused += (o, e) => { if (!_hasFocused) { _datePicker.TextColor = defaultTextColor; _timePicker.TextColor = defaultTextColor; _hasFocused = true; } }; _timePicker.Focused += (o, e) => { if (!_hasFocused) { _datePicker.TextColor = defaultTextColor; _timePicker.TextColor = defaultTextColor; _hasFocused = true; } }; _datePicker.DateSelected += (o, e) => { Complete = Value != null; }; _timePicker.PropertyChanged += (o, e) => { if (e.PropertyName == nameof(TimePicker.Time)) { Complete = Value != null; } }; _label = CreateLabel(index); _label.VerticalTextAlignment = TextAlignment.Center; base.SetView(new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { _label, _datePicker, _timePicker } }); } else { _label.Text = GetLabelText(index); // if the view was already initialized, just update the label since the index might have changed. } return(base.GetView(index)); }
static public void Clear(DatePicker dp, int t) { dp.Text = ""; }
public void datepicker_correctly_render_null_value() { var element = new DatePicker("test").Value(null); element.ValueAttributeShouldEqual(null); }
static ContentPage DatePickerPage() { var pickerInit = new DatePicker { Date = new DateTime(1978, 12, 24), TextColor = Color.Red }; var pickerColorDefaultToggle = new DatePicker { Date = new DateTime(1978, 12, 24) }; var defaultText = "Should have default color text"; var pickerColorLabel = new Label { Text = defaultText }; var toggleButton = new Button { Text = "Toggle DatePicker Text Color" }; toggleButton.Clicked += (sender, args) => { if (pickerColorDefaultToggle.TextColor.IsDefault) { pickerColorDefaultToggle.TextColor = Color.Fuchsia; pickerColorLabel.Text = "Should have fuchsia text"; } else { pickerColorDefaultToggle.TextColor = Color.Default; pickerColorLabel.Text = defaultText; } }; const string disabledText = "DatePicker is Disabled; Should have default disabled color."; var pickerDisabledlabel = new Label { Text = disabledText }; var pickerColorDisabled = new DatePicker { IsEnabled = false, TextColor = Color.Green }; var buttonToggleEnabled = new Button() { Text = "Toggle IsEnabled" }; buttonToggleEnabled.Clicked += (sender, args) => { pickerColorDisabled.IsEnabled = !pickerColorDisabled.IsEnabled; if (!pickerColorDisabled.IsEnabled) { pickerDisabledlabel.Text = disabledText; } else { pickerDisabledlabel.Text = "DatePicker is Enabled; Should Be Green"; } }; return(new ContentPage { Title = "DatePicker", Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, Device.OnPlatform(00, 0, 0)), Content = new StackLayout { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, Children = { pickerColorLabel, pickerColorDefaultToggle, toggleButton, pickerInit, pickerDisabledlabel, pickerColorDisabled, buttonToggleEnabled } } }); }
/// <summary> /// Формирование контрола фильтра в зависимости от выбранного условия /// </summary> /// <param name="w"></param> /// <param name="page"></param> /// <param name="inx"></param> /// <param name="setValue"></param> private void RenderControlsV4UserFilterClause(TextWriter w, Page page, int inx, bool setValue) { var ctrlId = FilterUserCtrlBaseName + "_" + Settings.TreeViewId + "_" + inx; var nextCtrl = inx == 2 ? "btnUFilter_Apply_" + Settings.TreeViewId : FilterUserCtrlBaseName + "_" + Settings.TreeViewId + "_2" + "_0"; if (page.V4Controls.ContainsKey(ctrlId)) { page.V4Controls.Remove(ctrlId); } var ctrlValue = ""; if (setValue) { if (FilterUser.FilterType == TreeViewColumnUserFilterEnum.Между && inx == 2) { if (FilterUser.FilterValue2 != null) { if (ColumnType != TreeViewColumnTypeEnum.Date) { ctrlValue = FilterUser.FilterValue2.ToString(); } else { ctrlValue = ((DateTime)FilterUser.FilterValue2).ToString("dd.MM.yyyy"); } } } else { if (FilterUser.FilterValue1 != null) { if (ColumnType != TreeViewColumnTypeEnum.Date) { ctrlValue = FilterUser.FilterValue1.ToString(); } else { ctrlValue = ((DateTime)FilterUser.FilterValue1).ToString("dd.MM.yyyy"); } } } } switch (ColumnType) { case TreeViewColumnTypeEnum.Decimal: case TreeViewColumnTypeEnum.Double: case TreeViewColumnTypeEnum.Float: case TreeViewColumnTypeEnum.Int: var ctrlN = new Number { HtmlID = ctrlId, ID = ctrlId, V4Page = page, NextControl = nextCtrl, Value = ctrlValue, CSSClass = "v4NumberTextAlign" }; page.V4Controls.Add(ctrlN); ctrlN.RenderControl(w); break; case TreeViewColumnTypeEnum.Date: var ctrlD = new DatePicker { HtmlID = ctrlId, ID = ctrlId, V4Page = page, Value = ctrlValue, NextControl = nextCtrl }; page.V4Controls.Add(ctrlD); ctrlD.RenderControl(w); break; default: var ctrlT = new TextBox { HtmlID = ctrlId, ID = ctrlId, V4Page = page, Value = ctrlValue, NextControl = nextCtrl }; page.V4Controls.Add(ctrlT); ctrlT.RenderControl(w); break; } }
public void OnDateSet(DatePicker view, int year, int month, int day) { var date = new DateTime(year, month + 1, day); View.FindViewById <EditText> (Resource.Id.date).Text = date.ToString("yyyy MMMMM dd"); }
/// <summary> /// Сохраняет нового клиента и закрывает текущее окно /// </summary> /// <param name="Cb_Status">ComboBox выбора статуса</param> /// <param name="NumPassport">TextBox паспорта или ИНН</param> /// <param name="LstName">TextBox Фамилии</param> /// <param name="FstName">TextBox Имени</param> /// <param name="BrthDay">DatePicker Дня рождения</param> /// <param name="Bt_Rating">TextBox Кпедитного рейтинга</param> internal void SaveNewClient(ComboBox Cb_Status, TextBox NumPassport, TextBox LstName, TextBox FstName, DatePicker BrthDay, TextBox Bt_Rating) { try { bool flag = true; if (NumPassport.Text != "") { //Если клиент Компания if (((AddClient_Helper)Cb_Status.SelectedValue).Status == "COMPANY") { ///проверка ИНН на совпадение foreach (var cl in MainWindow.ML.clientData.Clients) { if (cl.Passport == 0) { object clc = cl; if (NumPassport.Text != "") { try { if (Convert.ToUInt32(NumPassport.Text) == ((Client_Company)clc).Inn) { MessageBox.Show("Клиент с таким ИНН уже существует!"); NumPassport.Text = ""; flag = false; break; } } catch { MessageBox.Show("Номер ИНН должен сосоять только из чисел"); flag = false; } } else { MessageBox.Show("Вы не заполнили все поля"); flag = false; } } } if (flag == true) { try { var client = new Client_Company(LstName.Text, Convert.ToDateTime(BrthDay.Text), Convert.ToUInt32(NumPassport.Text), "0", adress, "COMPANY"); client.Rating = Convert.ToInt32(Bt_Rating.Text); MainWindow.ML.clientData.Clients.Add(client); MainWindow.ML.LogiAll.Logis.Add(new Logi((client.Inn.ToString() + " ДОБАВЛЕН в " + (DateTime.Now).ToString()))); MainWindow.ML.LogiAll.Save(); Bt_Rating.BorderBrush = Brushes.Gray; } catch { MessageBox.Show("Рейтинг должен состоять из целых чисел"); Bt_Rating.BorderBrush = Brushes.Red; flag = false; } } } //если клиент физическое лицо else { try { // Проверка Паспорта на совпадение foreach (var cl in MainWindow.ML.clientData.Clients) { if (NumPassport.Text != "") { if (Convert.ToUInt32(NumPassport.Text) == cl.Passport) { MessageBox.Show("Клиент с таким номером паспорта уже существует!"); flag = false; NumPassport.Text = ""; break; } } else { MessageBox.Show("Вы не заполнили все поля"); flag = false; } } } catch { MessageBox.Show("Номер Паспорта должен сосоять только из чисел"); flag = false; } if (flag == true) { try { client = new Client(FstName.Text, LstName.Text, Convert.ToDateTime(BrthDay.Text), Convert.ToUInt32(NumPassport.Text), "", adress, work); client.Status = ((AddClient_Helper)Cb_Status.SelectedValue).Status; MainWindow.ML.clientData.Clients.Add(client); client.Rating = Convert.ToInt32(Bt_Rating.Text); MainWindow.ML.LogiAll.Logis.Add(new Logi((client.Passport.ToString() + " ДОБАВЛЕН в " + (DateTime.Now).ToString()))); MainWindow.ML.LogiAll.Save(); Bt_Rating.BorderBrush = Brushes.Gray; } catch { } } } } else { MessageBox.Show("Вы не заполнили все поля"); flag = false; } if (flag == true) { ///перебирает открытые окна и закрывает текущее foreach (Window window in App.Current.Windows) { if (window is AddClient) { Ev_Mes += Mes; // добавляем метод в событие window.Close(); Ev_Mes?.Invoke("Добавлен новый клиент"); } } } } catch (MyExeption e) { BrthDay.BorderBrush = Brushes.Red; NumPassport.BorderBrush = Brushes.Red; Bt_Rating.BorderBrush = Brushes.Red; MessageBox.Show("Проверьте коректность вводимых данных. " + e.Message); } }
private string GetRangeHoverCls(DateTime currentColDate) { if (!IsRange || DatePicker.HoverDateTime == null || Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month) == false) { return(""); } var startValue = FormatDateByPicker(GetIndexValue(0)); var endValue = FormatDateByPicker(GetIndexValue(1)); DateTime hoverDateTime = FormatDateByPicker((DateTime)DatePicker.HoverDateTime); if ((startValue != null && ((DateTime)startValue).Date == hoverDateTime.Date) || (endValue != null && ((DateTime)endValue).Date == hoverDateTime.Date)) { return(""); } DateTime currentDate = FormatDateByPicker(currentColDate); DateTime preDate = GetPreDate(currentDate); DateTime nextDate = GetNextDate(currentDate); int onfocusPickerIndex = DatePicker.GetOnFocusPickerIndex(); StringBuilder cls = new StringBuilder(); if (onfocusPickerIndex == 1 && startValue != null) { if (startValue != endValue && currentDate == startValue) { cls.Append($" {PrefixCls}-cell-range-hover-start"); } else if (currentDate < hoverDateTime) { cls.Append($"{PrefixCls}-cell-range-hover"); // when pre day is not inview, then current day is the start. if (IsInView(preDate) == false) { cls.Append($" {PrefixCls}-cell-range-hover-start"); } // when next day is not inview, then current day is the end. else if (IsInView(nextDate) == false) { cls.Append($" {PrefixCls}-cell-range-hover-end"); } } else if (currentDate == hoverDateTime) { cls.Append($" {PrefixCls}-cell-range-hover-end"); } } else if (onfocusPickerIndex == 0 && endValue != null) { if (startValue != endValue && currentDate == endValue) { cls.Append($" {PrefixCls}-cell-range-hover-end"); } else if (currentDate > hoverDateTime) { cls.Append($"{PrefixCls}-cell-range-hover"); // when pre day is not inview, then current day is the start. if (IsInView(preDate) == false) { cls.Append($" {PrefixCls}-cell-range-hover-start"); } // when next day is not inview, then current day is the end. else if (IsInView(nextDate) == false) { cls.Append($" {PrefixCls}-cell-range-hover-end"); } } else if (currentDate == hoverDateTime) { cls.Append($" {PrefixCls}-cell-range-hover-start"); } } return(cls.ToString()); }
private void Button_Click(object sender, EventArgs e) { var picker = new DatePicker(); }
private void AddItem(object sender, EventArgs e) { stackLayoutSavePage = new StackLayout(); Label label1 = new Label(); label1.Text = "Название"; Entry entry1 = new Entry(); Label label2 = new Label(); label2.Text = "Жанр"; Entry entry2 = new Entry(); Label label3 = new Label(); label3.Text = "Цена"; Entry entry3 = new Entry(); entry3.Keyboard = Keyboard.Numeric; Label label4 = new Label(); label4.Text = "Дата выхода"; DatePicker datePicker1 = new DatePicker() { Format = "D", }; Button buttonSave = new Button(); buttonSave.Text = "Сохранить"; buttonSave.Clicked += ButtonSave_Clicked; Button buttonBack = new Button(); buttonBack.Text = "Назад"; buttonBack.Clicked += ButtonBack_Clicked; Button getPhotoBtn = new Button { Text = "Выбрать фото" }; Image img = new Image(); img.IsVisible = false; getPhotoBtn.Clicked += async(o, l) => { if (CrossMedia.Current.IsPickPhotoSupported) { MediaFile photo = await CrossMedia.Current.PickPhotoAsync(); imgPath = photo.Path; } }; stackLayoutSavePage.Children.Add(label1); stackLayoutSavePage.Children.Add(entry1); stackLayoutSavePage.Children.Add(label2); stackLayoutSavePage.Children.Add(entry2); stackLayoutSavePage.Children.Add(label3); stackLayoutSavePage.Children.Add(entry3); stackLayoutSavePage.Children.Add(label4); stackLayoutSavePage.Children.Add(datePicker1); stackLayoutSavePage.Children.Add(img); stackLayoutSavePage.Children.Add(getPhotoBtn); stackLayoutSavePage.Children.Add(buttonSave); stackLayoutSavePage.Children.Add(buttonBack); stackLayoutSavePage.Padding = 5; this.Content = stackLayoutSavePage; }
void ReleaseDesignerOutlets() { if (ActualTextField != null) { ActualTextField.Dispose(); ActualTextField = null; } if (AddButton != null) { AddButton.Dispose(); AddButton = null; } if (AmountTextField != null) { AmountTextField.Dispose(); AmountTextField = null; } if (CashflowIDTextField != null) { CashflowIDTextField.Dispose(); CashflowIDTextField = null; } if (CashflowsTableView != null) { CashflowsTableView.Dispose(); CashflowsTableView = null; } if (CommentTextField != null) { CommentTextField.Dispose(); CommentTextField = null; } if (DatePicker != null) { DatePicker.Dispose(); DatePicker = null; } if (ExistingCashflowsScrollView != null) { ExistingCashflowsScrollView.Dispose(); ExistingCashflowsScrollView = null; } if (ExpireButton != null) { ExpireButton.Dispose(); ExpireButton = null; } if (RecordDateOverridePicker != null) { RecordDateOverridePicker.Dispose(); RecordDateOverridePicker = null; } if (ShowExpiredButton != null) { ShowExpiredButton.Dispose(); ShowExpiredButton = null; } if (SystemMessageTextField != null) { SystemMessageTextField.Dispose(); SystemMessageTextField = null; } if (TypePopUpButton != null) { TypePopUpButton.Dispose(); TypePopUpButton = null; } if (EntityPopUpButton != null) { EntityPopUpButton.Dispose(); EntityPopUpButton = null; } }
public void OnDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { DateTime selectedDate = new DateTime(year, monthOfYear + 1, dayOfMonth); _dateSelectedHandler(selectedDate); }
public DatePickerBuilderTests() { datePicker = DatePickerTestHelper.CreateDatePicker(null, null); builder = new DatePickerBuilder(datePicker); }
public async void Calendar(DatePicker startDate, TimePicker startTime) { await AppointmentManager.ShowTimeFrameAsync(startDate.Date, startTime.Time); }
void Awake() { datePicker = transform.Find("DatePicker - Popup").GetComponent <DatePicker> (); }
void formInputChanged(object sender, RoutedEventArgs e) { string name = ""; string input = ""; DataValidator.dataFieldType type = DataValidator.dataFieldType.NOTSET; TextBlock successTextBlock = null; bool validationSuccess = false; if (sender is TextBox) { TextBox t = (TextBox)sender; name = t.Name; input = t.Text; } else if (sender is ComboBox) { ComboBox c = (ComboBox)sender; name = c.Name; input = ((ComboBoxItem)(c.SelectedItem)).Content.ToString(); } else if (sender is DatePicker) { DatePicker d = (DatePicker)sender; name = d.Name; input = d.SelectedDate.Value.Date.Date.ToShortDateString(); } else { return; } // Escape this method if it hasn't found the Control Type by now. if (String.IsNullOrEmpty(name)) { return; } for (int i = 0; i < fields.Count; i++) { if (fields[i].name.Equals(name)) { type = fields[i].dataFieldType; successTextBlock = fields[i].successTextBox; fields[i].userEntryText = input; } } // Find out the type of data the user has just entered ( ie firstname, dateOfBith, CreditCardNumber etc) if (type != DataValidator.dataFieldType.NOTSET) { validationSuccess = DataValidator.validateField(type, input); successTextBlock.Text = validationSuccess ? DataDelegate.SUCCESS : DataDelegate.FAIL; if (sender is TextBox) { TextBox tb = (TextBox)sender; tb.Background = validationSuccess ? new SolidColorBrush(SUCCESS_COLOR) : new SolidColorBrush(FAIL_COLOR); } if (sender is DatePicker) { DatePicker dp = (DatePicker)sender; dp.Background = validationSuccess ? new SolidColorBrush(SUCCESS_COLOR) : new SolidColorBrush(FAIL_COLOR); } } }
Grid BuildQuestionsView() { /* Method: BuildQuestionsView * Programmer: Harry Martin * Description: This method manages the construction of the Grid View * Which includes the binding of the quiz question objects to their UI elements */ //Get the number of questions per page and build the appropriate variables such that the pages can be dynamically built Grid quizGrid = BuildQuestionGrid(); int index = 0; try { foreach (QuizQuestion quizQuestion in ThisPageQs) { //Create the element vars var questionLabel = new Label { FontAttributes = FontAttributes.Bold }; var helpLabel = new Label { HorizontalTextAlignment = TextAlignment.Start, VerticalTextAlignment = TextAlignment.Center }; //Set the Bindings questionLabel.SetBinding(Label.TextProperty, "text"); helpLabel.SetBinding(Label.TextProperty, "help"); //Set the Binding Contexts questionLabel.BindingContext = quizQuestion; helpLabel.BindingContext = quizQuestion; /*Add the elements to the parent Grid * [index * questionViewRows] = The current Quiz Index's row*/ quizGrid.Children.Add(questionLabel, 0, index * questionViewRows); quizGrid.Children.Add(helpLabel, 0, index * questionViewRows + 1); //Set advance row/grid spanning Grid.SetColumnSpan(questionLabel, 2); Grid.SetColumnSpan(helpLabel, 2); //The following if statements will get the question type and dynamically implement the required data entry element if (quizQuestion.type == "date") { DatePicker datePicker = new DatePicker { Format = "D", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.End }; quizGrid.Children.Add(datePicker, 0, index * questionViewRows + 2); Grid.SetColumnSpan(datePicker, 2); //Set advance row/grid spanning } else if (quizQuestion.type == "textbox") { var textbox = new Entry { Placeholder = "Short answer..." }; quizGrid.Children.Add(textbox, 0, index * questionViewRows + 2); Grid.SetColumnSpan(textbox, 2); //Set advance row/grid spanning } else if (quizQuestion.type == "textarea") { var textarea = new Editor() { HeightRequest = 100 }; quizGrid.Children.Add(textarea, 0, index * questionViewRows + 2); Grid.SetColumnSpan(textarea, 2); //Set advance row/grid spanning } else if (quizQuestion.type == "choice") { var picker = new Picker(); foreach (string p_choice in quizQuestion.options) { picker.Items.Add(p_choice); } quizGrid.Children.Add(picker, 0, index * questionViewRows + 2); Grid.SetColumnSpan(picker, 2); //Set advance row/grid spanning } //END Quiz Answer Type Statement index++; } quizGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); //Adds a final row to prevent stretching of final element //DEBUG: DisplayAlert("Alert", "\n Page MinQ id: " + minQ + " \nPage MaxQ id:" + maxQ, "OK"); /* Add the 'Next Page' button IF there are more questions to display. * OR add the 'Complete' button otherwise... */ if (maxQ < thisQuiz.questions.Count()) { var nextButton = new Button { Text = "Next Page", VerticalOptions = LayoutOptions.Start }; quizGrid.Children.Add(nextButton, 0, maxQ * questionViewRows + 3); Grid.SetColumnSpan(nextButton, 2); //Set advance row/grid spanning //Set the button links nextButton.Clicked += delegate { if (thisQuiz.questionsPerPage.Count() > currentPage) { currentPage++; updatePageQuestions(); updatePageContent(); } }; } else { var completeButton = new Button { Text = "Complete" }; quizGrid.Children.Add(completeButton, 0, maxQ * questionViewRows + 3); Grid.SetColumnSpan(completeButton, 2); //Set advance row/grid spanning //Set the button links completeButton.Clicked += delegate { Navigation.PopAsync(); }; } DisplayAlert("Alert", "DEBUG: \nNumber of QuizGrid Elements: " + quizGrid.Children.Count(), "OK"); } catch (Exception ex) { DisplayAlert("Alert", "Unknown exception..." + ex, "OK"); } return(quizGrid); }
void ReleaseDesignerOutlets() { if (CloseButton != null) { CloseButton.Dispose(); CloseButton = null; } if (ControlsStackView != null) { ControlsStackView.Dispose(); ControlsStackView = null; } if (DatePicker != null) { DatePicker.Dispose(); DatePicker = null; } if (DatePickerContainer != null) { DatePickerContainer.Dispose(); DatePickerContainer = null; } if (DurationInput != null) { DurationInput.Dispose(); DurationInput = null; } if (EndDateLabel != null) { EndDateLabel.Dispose(); EndDateLabel = null; } if (EndTimeLabel != null) { EndTimeLabel.Dispose(); EndTimeLabel = null; } if (EndView != null) { EndView.Dispose(); EndView = null; } if (SaveButton != null) { SaveButton.Dispose(); SaveButton = null; } if (SetEndButton != null) { SetEndButton.Dispose(); SetEndButton = null; } if (StackView != null) { StackView.Dispose(); StackView = null; } if (StartDateLabel != null) { StartDateLabel.Dispose(); StartDateLabel = null; } if (StartTimeLabel != null) { StartTimeLabel.Dispose(); StartTimeLabel = null; } if (StartView != null) { StartView.Dispose(); StartView = null; } if (WheelView != null) { WheelView.Dispose(); WheelView = null; } if (StartLabel != null) { StartLabel.Dispose(); StartLabel = null; } if (EndLabel != null) { EndLabel.Dispose(); EndLabel = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } }
void CreateUI() { stack = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 48, VerticalOptions = LayoutOptions.StartAndExpand }; innerStack = new StackLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, Orientation = StackOrientation.Horizontal, MinimumWidthRequest = App.ScreenSize.Width, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 48, }; var topbar = new TopBar(true, "", this, 1, "back_arrow", "", innerStack, true).CreateTopBar(); stack.HeightRequest = App.ScreenSize.Height - topbar.HeightRequest; var lstElements = new List <UIAttributes> { new UIAttributes { Text = Langs.Const_Screen_Title_Journeys, Position = 0 }, new UIAttributes { Text = Langs.Const_Label_Show_Private_Off, Position = 1, ScreenLeft = false }, new UIAttributes { Text = "switch_button_blue_off".CorrectedImageSource(), IsImageSource = true, Position = 0, ScreenLeft = false, ClickEvent = ToggleButton } }; titleBar = new GeneralTopBar(lstElements); var fromDatePicker = new DatePicker { MinimumDate = DateTime.Now.AddDays(-30), //MaximumDate = DateTime.Now.AddDays(-30), IsVisible = false }; fromDatePicker.SetBinding(DatePicker.DateProperty, new Binding("StartDate")); var toDatePicker = new DatePicker { MaximumDate = DateTime.Now, //MinimumDate = fromDatePicker.MaximumDate, IsVisible = false }; toDatePicker.SetBinding(DatePicker.DateProperty, new Binding("EndDate")); var spacer = new DatePicker { IsVisible = false }; var btnSearch = new Button { BorderRadius = 6, BackgroundColor = FormsConstants.AppyBlue, TextColor = Color.White, Text = Langs.Const_Button_Search, HeightRequest = 42 }; btnSearch.Clicked += delegate { ViewModel.PerformSearch(); }; btnFrom = new Button { BackgroundColor = FormsConstants.AppyDarkShade, TextColor = Color.White, BorderRadius = 6, HeightRequest = 42 }; btnFrom.SetBinding(Button.TextProperty, new Binding("StartDateText")); btnFrom.Clicked += delegate { fromDatePicker.Focus(); }; btnTo = new Button { BackgroundColor = FormsConstants.AppyDarkShade, TextColor = Color.White, HeightRequest = 42, BorderRadius = 6 }; btnTo.SetBinding(Button.TextProperty, new Binding("EndDateText")); btnTo.Clicked += delegate { toDatePicker.Focus(); }; var grid = new Grid { WidthRequest = App.ScreenSize.Width, RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = App.ScreenSize.Height * .1 }, new RowDefinition { Height = 1 }, new RowDefinition { Height = 36 }, new RowDefinition { Height = GridLength.Star } } }; grid.Children.Add(new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, Children = { new StackLayout { Orientation = StackOrientation.Vertical, Children = { btnFrom, fromDatePicker } }, new Image { Source = "date_arrow".CorrectedImageSource(), HeightRequest = 16, WidthRequest = 16 }, new StackLayout { Orientation = StackOrientation.Vertical, Children = { btnTo, toDatePicker } }, new StackLayout { Orientation = StackOrientation.Vertical, Children = { btnSearch, spacer } } } }, 0, 0); grid.Children.Add(new BoxView { HeightRequest = 1, WidthRequest = App.ScreenSize.Width, BackgroundColor = Color.White }, 0, 1); lstView = new ListView { ItemsSource = ViewModel.Expenses, WidthRequest = App.ScreenSize.Width * .9, ItemTemplate = new DataTemplate(typeof(ExpensesViewCell)), SeparatorVisibility = SeparatorVisibility.None, HeightRequest = App.ScreenSize.Height * .8, HasUnevenRows = true }; if (ViewModel.Expenses.Count == 0) { Task.Run(async() => await DisplayAlert(Langs.Const_Title_Error_1, Langs.Const_Msg_No_Journeys, "OK")); } grid.Children.Add(new StackLayout { HorizontalOptions = LayoutOptions.Center, WidthRequest = App.ScreenSize.Width, Children = { lstView } }, 0, 2); var lblDate = new Label { FontFamily = Helper.RegFont, FontSize = 12, TextColor = Color.White, HorizontalTextAlignment = TextAlignment.Center }; lblDate.SetBinding(Label.TextProperty, new Binding("DateRange")); grid.Children.Add(new StackLayout { HorizontalOptions = LayoutOptions.Center, Children = { lblDate } }, 0, 2); stack.Children.Add(grid); innerStack.Children.Add(stack); var masterStack = new StackLayout { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start, Children = { new StackLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, WidthRequest = App.ScreenSize.Width, Children = { topbar } }, new StackLayout { TranslationY = -6, Children = { titleBar } }, innerStack } }; Content = masterStack; }
private void Make_Calendar() { Grid mainGrid = new Grid { HorizontalAlignment = HorizontalAlignment.Stretch, MaxWidth = 720, Background = new SolidColorBrush(Color.FromArgb(255, 31, 31, 31)), }; if (!Fixed.IsDarkTheme) { mainGrid.Background = new SolidColorBrush(Color.FromArgb(255, 244, 244, 244)); } mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); mainGrid.RowDefinitions.Add(new RowDefinition()); #region Hide dialog button ListViewItem hideLVI = new ListViewItem { HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch, MinHeight = 0, MinWidth = 0, Background = null, Padding = new Thickness(0), Margin = new Thickness(0), BorderBrush = new SolidColorBrush(Color.FromArgb(31, 0, 0, 0)), BorderThickness = new Thickness(1), }; hideLVI.SetValue(Grid.RowProperty, 0); mainGrid.Children.Add(hideLVI); TextBlock hideTB = new TextBlock { HorizontalAlignment = HorizontalAlignment.Center, FontSize = 18, FontFamily = new FontFamily("Segoe UI Symbol"), Text = "", VerticalAlignment = VerticalAlignment.Center, }; hideLVI.Content = hideTB; hideLVI.Tapped += (s, e) => { Hide_Calendar(); }; #region Manipulation calendar_Grid.ManipulationMode = ManipulationModes.TranslateY; calendar_Grid.ManipulationDelta += (s, e) => { calendarCT.TranslateY += e.Delta.Translation.Y; if (calendarCT.TranslateY < 0) { calendarCT.TranslateY = 0; } if (calendarCT.TranslateY > 50) { hideTB.Text = ""; } else { hideTB.Text = ""; } }; calendar_Grid.ManipulationCompleted += (s, e) => { if (calendarCT.TranslateY > 50) { Hide_Calendar(); } else { calendarCT.TranslateY = 0; } hideTB.Text = ""; }; #endregion #endregion #region Setup panel var panel = new StackPanel { Margin = new Thickness(12), }; panel.SetValue(Grid.RowProperty, 1); mainGrid.Children.Add(panel); StackPanel headerSp = new StackPanel { HorizontalAlignment = HorizontalAlignment.Center }; DatePicker dp = new DatePicker { Margin = new Thickness(0, 12, 0, 0), Header = "Vaktija za datum:", Date = DateTime.Now, HorizontalAlignment = HorizontalAlignment.Center, }; headerSp.Children.Add(dp); TextBlock hijriTB = new TextBlock { Margin = new Thickness(12), FontSize = 20, Text = "", HorizontalAlignment = HorizontalAlignment.Left, }; headerSp.Children.Add(hijriTB); panel.Children.Add(headerSp); #endregion #region Content panel Grid content_Grid = new Grid(); content_Grid.RowDefinitions.Add(new RowDefinition()); content_Grid.RowDefinitions.Add(new RowDefinition()); content_Grid.RowDefinitions.Add(new RowDefinition()); content_Grid.RowDefinitions.Add(new RowDefinition()); content_Grid.RowDefinitions.Add(new RowDefinition()); content_Grid.RowDefinitions.Add(new RowDefinition()); content_Grid.SetValue(Grid.RowProperty, 2); mainGrid.Children.Add(content_Grid); #endregion #region Events dp.DateChanged += (s, args) => { DateTime dttt = new DateTime(dp.Date.Year, dp.Date.Month, dp.Date.Day); Show_Special_Prayers_For_Custom_Date(content_Grid, dttt); hijriTB.Text = Get.Name_Of_Day_In_Week((int)dttt.DayOfWeek).ToLower() + ", " + HijriDate.Get(dttt).day + ". " + Get.Name_Of_Month_Hijri(HijriDate.Get(dttt).month) + " " + HijriDate.Get(dttt).year + "."; }; #endregion #region Show dialog Show_Special_Prayers_For_Custom_Date(content_Grid, DateTime.Now); hijriTB.Text = Get.Name_Of_Day_In_Week((int)DateTime.Now.DayOfWeek).ToLower() + ", " + HijriDate.Get(DateTime.Now).day + ". " + Get.Name_Of_Month_Hijri(HijriDate.Get(DateTime.Now).month) + " " + HijriDate.Get(DateTime.Now).year + "."; Show_Calendar(mainGrid); #endregion }
void DatePicker.IOnDateChangedListener.OnDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) { Rebind(); }
static public void Clear(DatePicker dp) { dp.SelectedDate = DateTime.Now; }
public GraphsPage() { Title = "BP Readings"; //BPMRecords recode = new BPMRecords(3, 1, 2018, 138.02, 92.02, 105); //records(recode); #if __IOS__ var resourcePrefix = "MoniHealth.iOS.Resources."; #endif #if __ANDROID__ var resourcePrefix = "MoniHealth.Android.Resources."; #else var resourcePrefix = "MoniHealth.Pages."; #endif var editor = new Label { Text = "loading...", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }; #region How to load a text file embedded resource var assembly = IntrospectionExtensions.GetTypeInfo(typeof(GraphsPage)).Assembly; Stream stream = assembly.GetManifestResourceStream(resourcePrefix + "tempdata.txt"); string text = ""; string alltext = ""; using (var reader = new StreamReader(stream)) { while ((text = reader.ReadLine()) != null) { alltext = alltext + "\n" + text; Allrecord.Add(new BPMRecords(text)); count = count + 1; } //text = reader.ReadLine(); } #endregion editor.Text = alltext; //record.Add(new BPMRecords(text)); //record.Add(new BPMRecords("1-Mar-18", 138.12, 85.12, 105)); var Lastest = new Label { Text = " ", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }; #region Buttons and picker elements Button Submit = new Button { Text = " Submit ", Font = Font.SystemFontOfSize(NamedSize.Small), BorderWidth = 1, BorderColor = Color.Silver, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start }; var Start = new Label { Text = "Start Date:", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), VerticalOptions = LayoutOptions.Center }; DatePicker StartDate = new DatePicker { MinimumDate = Allrecord[0].AllDate, MaximumDate = Allrecord[count - 1].AllDate, FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, Date = Allrecord[0].AllDate, }; start = StartDate.Date; StartDate.DateSelected += StartDateChanged; var End = new Label { Text = "End Date: ", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), VerticalOptions = LayoutOptions.Center }; DatePicker EndDate = new DatePicker { MinimumDate = StartDate.Date, MaximumDate = DateTime.Today, FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, Date = Allrecord[count - 1].AllDate }; end = EndDate.Date; EndDate.DateSelected += EndDateChanged; Button ViewGraph = new Button { Text = " ViewGraph ", Font = Font.SystemFontOfSize(NamedSize.Small), BorderWidth = 1, BorderColor = Color.Silver, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start }; ViewGraph.Clicked += ViewGraphButton; Picker typeOfGraph = new Picker { Title = "Type of Data in Graph", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start }; typeOfGraph.Items.Add("Systolic"); typeOfGraph.Items.Add("Diastolic"); typeOfGraph.Items.Add("HeartBeat"); typeOfGraph.Items.Add("All"); typeOfGraph.SelectedIndex = 0; typeOfGraphs.Text = "Type of Graph: \n" /*+ typeOfGraph.Items[typeOfGraph.SelectedIndex]*/; typeOfGraph.SelectedIndexChanged += TypeOfGraphChanged; #endregion #region Adding data Input = new Button { Text = " Manual Input ", Font = Font.SystemFontOfSize(NamedSize.Small), BorderWidth = 1, BorderColor = Color.Silver, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start }; Input.Clicked += InputButton; inputStack.Children.Add(Input); inputDateString = new Label { Text = "Input Date:", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), VerticalOptions = LayoutOptions.Center }; inputDatePicker = new DatePicker { MinimumDate = new DateTime(2018, 1, 1), MaximumDate = DateTime.Today, FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, Date = DateTime.Today, }; inputDate = DateTime.Today; inputDatePicker.DateSelected += InputDateChanged; inputTimeString = new Label { Text = "Input Time:", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), VerticalOptions = LayoutOptions.Center }; inputTimePicker = new TimePicker { FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, }; //inputTimePicker.SetBinding(TimePicker.TimeProperty, "StartTime"); inputTimePicker.PropertyChanged += InputTimeChanged; inputSystolic = new Entry { Keyboard = Keyboard.Numeric, FontSize = 13, Placeholder = "Enter Systolic", VerticalOptions = LayoutOptions.CenterAndExpand }; inputDiastolic = new Entry { Keyboard = Keyboard.Numeric, FontSize = 13, Placeholder = "Enter Diastolic", VerticalOptions = LayoutOptions.CenterAndExpand }; inputHeartBeat = new Entry { Keyboard = Keyboard.Numeric, FontSize = 13, Placeholder = "Enter HeartBeat", VerticalOptions = LayoutOptions.CenterAndExpand }; SubmitInput = new Button { Text = " Submit Input ", Font = Font.SystemFontOfSize(NamedSize.Small), BorderWidth = 1, BorderColor = Color.Silver, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start }; SubmitInput.Clicked += SubInputButton; CancelInput = new Button { Text = " Cancel Input ", Font = Font.SystemFontOfSize(NamedSize.Small), BorderWidth = 1, BorderColor = Color.Silver, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start }; CancelInput.Clicked += CancelInputButton; #endregion avgOfLastTen.Text = AverageLastTen(); //Lastest.Text ="Latest Reading: "+ Allrecord[count - 1].readingToString(); Lastest.Text = "Your most recent blood pressure measurement taken on 3-5-2019 was 124/85 mmHG, with a heartrate of 99"; Last = Allrecord[count - 1]; //start = StartDate.Date; //end = EndDate.Date; Submit.Clicked += SubmitButton; ; /*record = Allrecord.Where(x => x.AllDate >= StartDate.Date && x.AllDate <= EndDate.Date).ToList(); * foreach (var reading in record) * { * specificDates.Text = specificDates.Text + reading.readingToString() + "\n"; * }*/ #region Old greaphs method /*Button createButton = new Button * { * * Text = "Create Account", * Font = Font.SystemFontOfSize(NamedSize.Small), * BorderWidth = 1, * HorizontalOptions = LayoutOptions.Center, * VerticalOptions = LayoutOptions.CenterAndExpand * }; * createButton.Clicked += OnButtonClicked;*/ /*StackLayout stackLayout = new StackLayout { }; * * stackLayout.Children.Add(editor); * Content = new ScrollView * { * Content = stackLayout * };*/ /*List<Entry> entries = new List<Entry> * {new Entry((float)record[count-2].Systolic) * { * Color = SKColor.Parse("#FF1493"), * Label = record[count-2].Date, * ValueLabel = record[count - 2].Systolic.ToString() * }, * * new Entry((float)record[count-1].Systolic) * { * Color = SKColor.Parse("#AA1493"), * Label = record[count-1].Date, * ValueLabel = record[count - 1].Systolic.ToString() * } * * };*/ /*List<Entry> entries = new List<Entry> { }; * double findmin = 300; * for (int i = 0; i <= 7; i++) * { * entries.Add(new Entry((float)record[i].Systolic)); * entries[i].Label = record[i].Date; * entries[i].ValueLabel = record[i].Systolic.ToString(); * entries[i].Color = SKColor.Parse("#FF1493"); * * * if (findmin >= record[i].Systolic) * { * findmin = record[i].Systolic; * } * } * * * * ChartView chart1 = new ChartView * { * Chart = new LineChart { Entries = entries, MinValue = (int)findmin, }, * HeightRequest = 160, * //Chart.DrawCaptionElements() * * };*/ /*try * { * Content = chart1; * } * catch (Exception e) * { * if (e.InnerException != null) * { * string err = e.InnerException.Message; * } * }*/ #endregion #region mini graph List <Microcharts.Entry> minientries = new List <Microcharts.Entry> { }; double findmin = 300; int m = 0; var recordmini = Allrecord.Where(x => x.AllDate >= Allrecord[count - 10].AllDate && x.AllDate <= Allrecord[count - 1].AllDate).ToList(); foreach (var reading in recordmini) { minientries.Add(new Microcharts.Entry((float)reading.Systolic)); minientries[m].Label = reading.AllDate.ToShortDateString(); minientries[m].ValueLabel = reading.Systolic.ToString(); minientries[m].Color = SKColor.Parse("#FF1493"); m++; if (findmin >= reading.Systolic) { findmin = reading.Systolic; } } ChartView chart1 = new ChartView { Chart = new LineChart { Entries = minientries, MinValue = (int)findmin, }, HeightRequest = 160, }; /* * try * { * Content = chart1; * } * catch (Exception e) * { * if (e.InnerException != null) * { * string err = e.InnerException.Message; * } * }*/ #endregion MainChart = chart1; StackLayout stackLayout = new StackLayout { Margin = new Thickness(20), VerticalOptions = LayoutOptions.FillAndExpand, Children = { /*new Label { Text = (recode[0].ToStringArray()), * FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)), * FontAttributes = FontAttributes.Bold}*/ Lastest, new Label { Text = "" }, new Label { Text = "Previous 10 recorded Systolic Blood Pressure Levels" }, chart1, avgOfLastTen, new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, Children = { Start, StartDate } }, new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, Children = { End, EndDate } }, new StackLayout() { Orientation = StackOrientation.Horizontal,Children = { typeOfGraphs, typeOfGraph } }, new StackLayout() { Orientation = StackOrientation.Horizontal,Children = { Submit, ViewGraph } }, avgOfSD, specificDates, inputStack } }; Content = new ScrollView { Content = stackLayout, Margin = new Thickness(0, 0, 0, 10) }; }
/// <summary> /// Begins when the behavior attached to the view /// </summary> /// <param name="bindable">bindable value</param> protected override void OnAttachedTo(StackLayout bindable) { this.editorLayout = bindable; this.editorScrollView = bindable.FindByName <ScrollView>("editorScrollView"); this.eventNameText = bindable.FindByName <Entry>("eventNameText"); this.organizerText = bindable.FindByName <Entry>("organizerText"); this.cancelButton = bindable.FindByName <Button>("cancelButton"); this.saveButton = bindable.FindByName <Button>("saveButton"); this.endDatePicker = bindable.FindByName <DatePicker>("endDate_picker"); this.endTimePicker = bindable.FindByName <TimePicker>("endTime_picker"); this.startDatePicker = bindable.FindByName <DatePicker>("startDate_picker"); this.startTimePicker = bindable.FindByName <TimePicker>("startTime_picker"); this.switchAllDay = bindable.FindByName <Switch>("switchAllDay"); this.startTimeZonePicker = bindable.FindByName <Picker>("startTimeZonePicker"); this.startTimeZonePicker.SelectedIndex = 0; this.startTimeZonePicker.ItemsSource = TimeZoneCollection.TimeZoneList; this.startTimeZonePicker.SelectedIndexChanged += this.StartTimeZonePicker_SelectedIndexChanged; this.endTimeZonePicker = bindable.FindByName <Picker>("endTimeZonePicker"); this.endTimeZonePicker.SelectedIndex = 0; this.endTimeZonePicker.ItemsSource = TimeZoneCollection.TimeZoneList; this.endTimeZonePicker.SelectedIndexChanged += this.EndTimeZonePicker_SelectedIndexChanged; this.endTimeLabelLayout = bindable.FindByName <Grid>("endTimeLabel_layout"); this.startDateTimePickerLayout = bindable.FindByName <Grid>("StartdateTimePicker_layout"); this.startDatePickerLayout = bindable.FindByName <Grid>("start_datepicker_layout"); this.organizerLayout = bindable.FindByName <Grid>("organizer_layout"); this.startTimePickerLayout = bindable.FindByName <Grid>("start_timepicker_layout"); this.startTimeLabelLayout = bindable.FindByName <Grid>("startTimeLabel_layout"); this.endDateTimePickerLayout = bindable.FindByName <Grid>("EndDateTimePicker_layout"); this.endDatePickerLayout = bindable.FindByName <Grid>("end_datepicker_layout"); this.endDateTimePickerLayout = bindable.FindByName <Grid>("EndDateTimePicker_layout"); this.endTimePickerLayout = bindable.FindByName <Grid>("end_timepicker_layout"); //// Editor Layout Date and time Picker Alignment for UWP if (Device.RuntimePlatform == "UWP" && Device.Idiom == TargetIdiom.Desktop) { this.startDatePicker.HorizontalOptions = LayoutOptions.StartAndExpand; this.startTimePicker.HorizontalOptions = LayoutOptions.StartAndExpand; this.endDatePicker.HorizontalOptions = LayoutOptions.StartAndExpand; this.endTimePicker.HorizontalOptions = LayoutOptions.StartAndExpand; this.startDatePicker.WidthRequest = 450; this.startTimePicker.WidthRequest = 450; this.endDatePicker.WidthRequest = 450; this.endTimePicker.WidthRequest = 450; } this.saveButton.Clicked += this.SaveButton_Clicked; this.cancelButton.Clicked += this.CancelButton_Clicked; this.switchAllDay.Toggled += this.SwitchAllDay_Toggled; }
public void datepicker_correctly_formats_date_value() { var value = new DateTime(2000, 2, 2, 14, 5, 24, 331); var element = new DatePicker("test").Value(value); element.ValueAttributeShouldEqual("2000-02-02"); }
public DayViewPage(DateTime dateTime) { try { #region Page Title = "Expense Tracker"; var toolAdd = new ToolbarItem { Text = "Add" }; ToolbarItems.Add(toolAdd); #endregion #region Controls listView = new ListView { HasUnevenRows = true, SeparatorVisibility = SeparatorVisibility.None, IsPullToRefreshEnabled = true, ItemsSource = observableCollection }; listView.ItemTemplate = new DataTemplate(() => { var lblDescription = new Label { TextColor = Colors.Black75, FontSize = Styles.FontSmall }; lblDescription.SetBinding(Label.TextProperty, "Description"); var lblDateTime = new Label { TextColor = Colors.Black50, FontSize = Styles.FontSmall }; lblDateTime.SetBinding(Label.TextProperty, "DateTime", stringFormat: "{0:hh:mm tt}"); var lblAmount = new Label { TextColor = Colors.Blue75, FontSize = Styles.FontSmall, HorizontalOptions = LayoutOptions.EndAndExpand }; lblAmount.SetBinding(Label.TextProperty, "Amount", stringFormat: "{0:F2}"); var grid = new Grid { Padding = 16, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }, }, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) } } }; grid.Children.Add(lblDescription); grid.Children.Add(lblDateTime, 0, 1); grid.Children.Add(lblAmount, 1, 0); Grid.SetRowSpan(lblAmount, 2); return(new ViewCell { View = grid }); }); dtpkr = new DatePicker { Date = dateTime.Date, IsVisible = false }; lblDate = new Label { Text = dtpkr.Date.ToLongDateString(), TextColor = Colors.Black75, HorizontalOptions = LayoutOptions.Center }; stkDate = new StackLayout { Padding = 16, BackgroundColor = Colors.Black25, Children = { lblDate } }; lblTotal = new Label { Text = "0.00", FontSize = Styles.FontMedium, TextColor = Colors.White, HorizontalOptions = LayoutOptions.End }; stkTotalView = new StackLayout { Spacing = 0, Padding = 16, BackgroundColor = Colors.Primary, Children = { new Label { Text = "Total:", FontSize = Styles.FontSmall, TextColor = Colors.WhiteSmoke, HorizontalOptions = LayoutOptions.End }, lblTotal } }; lblNoExpense = new Label { Margin = new Thickness(0, 60, 0, 0), Text = "No expenses found", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, TextColor = Colors.Black25, FontSize = Styles.FontMedium, IsVisible = false }; #endregion #region Container Content = new StackLayout { Spacing = 0, Children = { stkDate, dtpkr, lblNoExpense, listView, stkTotalView, new AdControlContainer() } }; #endregion #region Gestures/Events toolAdd.Clicked += (sender, args) => { Navigation.PushAsync(new AddExpensePage(dtpkr.Date), true); }; listView.RefreshCommand = new Command(() => { LoadData(dtpkr.Date); }); listView.ItemTapped += async(sender, args) => { listView.SelectedItem = null; var action = await DisplayActionSheet("Action", "Cancel", null, "Edit", "Delete"); if (action == "Edit") { await Navigation.PushAsync(new AddExpensePage(DateTime.Today, (Expense)args.Item), true); } else if (action == "Delete") { var deleteAction = await DisplayAlert("Warning", "Are you sure you want to delete this expense?", "Yes", "No"); if (deleteAction) { data.Delete <Expense>(((Expense)args.Item).Id); LoadData(dtpkr.Date); } } }; stkDate.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => { dtpkr.Focus(); }), NumberOfTapsRequired = 1 }); dtpkr.DateSelected += (sender, args) => { lblDate.Text = dtpkr.Date.ToLongDateString(); LoadData(dtpkr.Date); }; #endregion } catch (Exception ex) { Utils.LogMessage("DayViewPage()", ex); } }
public void datepicker_limit_sets_limits() { var element = new DatePicker("x").Limit(new DateTime(2000, 1, 1), new DateTime(2000, 12, 31), 7).ToString() .ShouldHaveHtmlNode("x"); element.ShouldHaveAttribute(HtmlAttribute.Min).WithValue("2000-01-01"); element.ShouldHaveAttribute(HtmlAttribute.Max).WithValue("2000-12-31"); element.ShouldHaveAttribute(HtmlAttribute.Step).WithValue("7"); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var v = inflater.Inflate(Resource.Layout.MemberRegisterLayout, container, false); txtName = v.FindViewById <EditText>(Resource.Id.txtMemberName); datePickerBirthDay = v.FindViewById <DatePicker>(Resource.Id.datePickerBirthday); radioGroupGend = v.FindViewById <RadioGroup>(Resource.Id.radioGroupGender); radioGendReset = v.FindViewById <RadioButton>(Resource.Id.radioButtonMale); radioGroupPreg = v.FindViewById <RadioGroup>(Resource.Id.radioGroupPregnancy); radioPregReset = v.FindViewById <RadioButton>(Resource.Id.radioButtonYes); txtDiseases = v.FindViewById <EditText>(Resource.Id.txtDiseases); Button button = v.FindViewById <Button>(Resource.Id.btnMemberReg); button.Click += delegate { try { string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "appdb.db3"); var db = new SQLiteConnection(dpPath); // db.CreateTable<MembersTable>(); MembersTable tbl = new MembersTable(); tbl.name = txtName.Text; tbl.birthday = datePickerBirthDay.DateTime.ToString(); //RadioGroup use check Gender. RadioButton checkedGender = v.FindViewById <RadioButton>(radioGroupGend.CheckedRadioButtonId); if (checkedGender.Text == "Female") { tbl.gender = checkedGender.Text; } else { tbl.gender = checkedGender.Text; } //RadioGroup use Check Pregnat or not. RadioButton checkedPreg = v.FindViewById <RadioButton>(radioGroupPreg.CheckedRadioButtonId); if (checkedPreg.Text == "Yes") { tbl.pregnancy = checkedPreg.Text; } else { tbl.pregnancy = checkedPreg.Text; } tbl.diseases = txtDiseases.Text; //SET MALE CHECKED THEN PREGNANCY RADIO GROUP ENABLE FALSE CODE SECTION //if (radioGendReset.Checked == true) // radioGroupPreg.Enabled = false; //else // radioGroupPreg.Enabled = true; db.Insert(tbl); Toast.MakeText(this.Activity, "Record Added Successfully...,", ToastLength.Short).Show(); //Reset all inputs for defalt value txtName.Text = ""; radioGendReset.Checked = true; radioPregReset.Checked = true; txtDiseases.Text = ""; radioGroupPreg.Enabled = true; } catch (Exception ex) { Toast.MakeText(this.Activity, ex.ToString(), ToastLength.Short); } }; return(v); }
public void ExposedDatePicker(ref DatePicker datePicker, ref TimePicker timePicker) { datePicker = this.datePicker; timePicker = this.timePicker; }
public override void Focus() { DatePicker.Focus(); }
private void GenerateDataRow(string currentField) { RowDefinition autoRow = new RowDefinition { Height = new GridLength(40), Name = "rowTextValue" }; grdEdit.RowDefinitions.Add(autoRow); Label autoLabel = new Label { Name = String.Format("lblAutoGenerated_{0}", string.Join("", currentField.Split(' '))), Content = String.Format("{0}:", currentField), Foreground = Brushes.White }; grdEdit.Children.Add(autoLabel); Grid.SetRow(autoLabel, grdEdit.RowDefinitions.Count - 1); //Column 1 if (lstDateNumericFields.Contains(currentField)) { if (currentField == "Rating") { Slider sldControl = new Slider() { Name = String.Format("sldrRating_{0}", grdEdit.RowDefinitions.Count - 1), Minimum = 0, Maximum = 99, Width = 245, Height = 25 }; grdEdit.Children.Add(sldControl); Grid.SetRow(sldControl, grdEdit.RowDefinitions.Count - 1); Grid.SetColumn(sldControl, 1); sldControl.ValueChanged += sldEditor_ValueChanged; Label sliderValue = new Label { Name = String.Format("lblAutoGenerated_{0}", grdEdit.RowDefinitions.Count - 1), Content = String.Empty, Foreground = Brushes.White, Margin = new Thickness(0, 5, 0, 0) }; grdEdit.Children.Add(sliderValue); Grid.SetRow(sliderValue, grdEdit.RowDefinitions.Count - 1); Grid.SetColumn(sliderValue, 2); } else if (currentField == "Year") { ComboBox Years = new ComboBox(); Years.Height = 25; Years.Width = 240; Years.Items.Add(String.Empty); for (int year = DateTime.Now.Year; year >= 1900; year--) { Years.Items.Add(year); } grdEdit.Children.Add(Years); Grid.SetRow(Years, grdEdit.RowDefinitions.Count - 1); Grid.SetColumn(Years, 1); } else { DatePicker dp = new DatePicker() { Name = String.Format("dpAutoGenerated_{0}", grdEdit.RowDefinitions.Count - 1), Height = 25 }; grdEdit.Children.Add(dp); Grid.SetRow(dp, grdEdit.RowDefinitions.Count - 1); Grid.SetColumn(dp, 1); autoRow.Name = "rowDateTimeValue"; } autoRow.Name = "rowIntValue"; } else { TextBox autoTextBox = new TextBox { Name = String.Format("txtAutoGenerated_{0}", string.Join("", currentField.Split(' '))), Width = 240, Height = 25 }; grdEdit.Children.Add(autoTextBox); Grid.SetColumn(autoTextBox, 1); Grid.SetRow(autoTextBox, grdEdit.RowDefinitions.Count - 1); } //Column 2 if (lstArrayFields.Contains(currentField)) { //In here we need to assign the name values of the ValueTemplate so that we can differeniate based on the rows. DataTemplate dt = (DataTemplate)grdEdit.FindResource("tmplArray"); StackPanel outerSP = ((StackPanel)dt.LoadContent()); //Outer Stack Panel outerSP.Name = String.Format("spParent_{0}", grdEdit.RowDefinitions.Count - 1); //ListBox ((ListBox)outerSP.Children[2]).Name = String.Format("lstbxValueContainer_{0}", grdEdit.RowDefinitions.Count - 1); //Buttons ((Button)outerSP.Children[0]).Name = String.Format("btnAddValue_{0}", grdEdit.RowDefinitions.Count - 1); ((Button)outerSP.Children[1]).Name = String.Format("btnRemoveValue_{0}", grdEdit.RowDefinitions.Count - 1); //Add to the grid and set the row. grdEdit.Children.Add(outerSP); Grid.SetRow(outerSP, grdEdit.RowDefinitions.Count - 1); autoRow.Name = "rowArrayValues"; } }
protected override void OnTapped() { base.OnTapped(); DatePicker.Focus(); }
private void FillFieldTypeOptions() { ContentTypeInfo contentTypeInfo = _contentTypeProvider.Select(ContentTypeId, ErrorList); if (contentTypeInfo != null) { FieldInfo info = FieldInfo.GetFieldArray(contentTypeInfo.FieldsXml).FirstOrDefault(x => x.Name == Id); pnlCustomControlOptions.Controls.Clear(); switch (FormHelper.GetFieldTypeByCode(drlFieldType.SelectedValue)) { case FormFieldType.TextBoxControl: TextBoxControl control = new TextBoxControl(); control.ViewMode = FormControlViewMode.Development; control.ID = FormFieldTypeCode.TEXTBOX; if (info != null) control.Value = info.Options; pnlCustomControlOptions.Controls.Add(control); break; case FormFieldType.DatePickerControl: DatePicker datepicker = new DatePicker(); datepicker.ViewMode = FormControlViewMode.Development; datepicker.ID = FormFieldTypeCode.DATEPICKER; if (info != null) datepicker.Value = info.Options; pnlCustomControlOptions.Controls.Add(datepicker); break; case FormFieldType.DateTimePickerControl: DateTimePicker datetimepicker = new DateTimePicker(); datetimepicker.ViewMode = FormControlViewMode.Development; datetimepicker.ID = FormFieldTypeCode.DATETIMEPICKER; if (info != null) datetimepicker.Value = info.Options; pnlCustomControlOptions.Controls.Add(datetimepicker); break; case FormFieldType.YesNoSelector: YesNoSelector yesnoselector = new YesNoSelector(); yesnoselector.ViewMode = FormControlViewMode.Development; yesnoselector.ID = FormFieldTypeCode.YESNOSELECTOR; if (info != null) yesnoselector.Value = info.Options; pnlCustomControlOptions.Controls.Add(yesnoselector); break; case FormFieldType.FileUpload: FileUploader fuploader = new FileUploader(); fuploader.ViewMode = FormControlViewMode.Development; fuploader.ID = FormFieldTypeCode.FILEUPLOAD; if (info != null) fuploader.Value = info.Options; pnlCustomControlOptions.Controls.Add(fuploader); break; case FormFieldType.YearSelector: YearSelector yearselector = new YearSelector(); yearselector.ViewMode = FormControlViewMode.Development; yearselector.ID = FormFieldTypeCode.YEARSELECTOR; if (info != null) yearselector.Value = info.Options; pnlCustomControlOptions.Controls.Add(yearselector); break; case FormFieldType.CaptchaControl: AbstractBasicUserControl captcha = (AbstractBasicUserControl) this.Page.LoadControl("~/"); captcha.ViewMode = FormControlViewMode.Development; captcha.ID = FormFieldTypeCode.CAPTCHA; if (info != null) captcha.Value = info.Options; pnlCustomControlOptions.Controls.Add(captcha); break; case FormFieldType.GuidGenerator: GuidGeneratorControl guidcontrol = new GuidGeneratorControl(); guidcontrol.ViewMode = FormControlViewMode.Development; pnlCustomControlOptions.Controls.Add(guidcontrol); break; case FormFieldType.FckEditor: FckEditorControl fckeditor = new FckEditorControl(); fckeditor.ID = FormFieldTypeCode.FCKEDITOR; fckeditor.ViewMode = FormControlViewMode.Development; if (info != null) fckeditor.Value = info.Options; pnlCustomControlOptions.Controls.Add(fckeditor); break; case FormFieldType.ListLookUp: ListLookUp listLookUp = new ListLookUp(); listLookUp.ViewMode = FormControlViewMode.Development; listLookUp.ID = FormFieldTypeCode.LISTLOOKUP; if (info != null) listLookUp.Value = info.Options; pnlCustomControlOptions.Controls.Add(listLookUp); break; case FormFieldType.ContentTypeLookUp: ContentTypeLookUp contentTypeLookUp = new ContentTypeLookUp(); contentTypeLookUp.ViewMode = FormControlViewMode.Development; contentTypeLookUp.ID = FormFieldTypeCode.CONTENTTYPELOOKUP; if (info != null) contentTypeLookUp.Value = info.Options; pnlCustomControlOptions.Controls.Add(contentTypeLookUp); break; case FormFieldType.ParameterGetter: ParameterGetterControl parameterGetterControl = new ParameterGetterControl(); parameterGetterControl.ID = FormFieldTypeCode.PARAMETERGETTER; parameterGetterControl.ViewMode = FormControlViewMode.Development; if (info != null) parameterGetterControl.Value = info.Options; pnlCustomControlOptions.Controls.Add(parameterGetterControl); break; case FormFieldType.UserProfileGetter: FromUserProfileControl userProfileControl = new FromUserProfileControl(); userProfileControl.ID = FormFieldTypeCode.USERPROFILEGETTER; userProfileControl.ViewMode = FormControlViewMode.Development; if (info != null) userProfileControl.Value = info.Options; pnlCustomControlOptions.Controls.Add(userProfileControl); break; //Load Custom Form control default: //AbstractBasicUserControl abstarctcontrol = // this.CreateCustomFormControl(ddlFieldType.SelectedItem.Value); //abstarctcontrol.Value = info.Options; //pnlCustomControlOptions.Controls.Add(abstarctcontrol); break; } } }
public SchedulePage() { // Create the view model for this page _vm = new SchedulePageViewModel(); this.BindingContext = _vm.ScheduleDetails; BackgroundColor = Color.White; // Create our screen objects // Create a label for the technician list _labelTitle = new Xamarin.Forms.Label(); _labelTitle.Text = "SCHEDULE"; _labelTitle.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null); _labelTitle.FontSize = 22; _labelTitle.TextColor = Color.White; _labelTitle.HorizontalTextAlignment = TextAlignment.Center; _labelTitle.VerticalTextAlignment = TextAlignment.Center; Grid titleLayout = new Grid() { BackgroundColor = Color.FromHex("#2980b9"), HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 80 }; titleLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); titleLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); titleLayout.Children.Add(_labelTitle, 0, 0); StackLayout stackDateFilter = new StackLayout(); stackDateFilter.Padding = 30; stackDateFilter.Spacing = 10; filterStartDate = new DatePicker(); filterEndDate = new DatePicker(); Button buttonFilter = new Button() { FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null), TextColor = Color.White, Text = "FILTER TICKETS BY DATE", BackgroundColor = Color.FromHex("#2ECC71") }; buttonFilter.Clicked += ButtonFilter_Clicked; App_Settings appSettings = App.Database.GetApplicationSettings(); filterStartDate.Date = (DateTime.Now.AddDays(Convert.ToDouble(appSettings.ScheduleDaysBefore) * (-1))).Date; filterEndDate.Date = (DateTime.Now.AddDays(Convert.ToDouble(appSettings.ScheduleDaysAfter))).Date; stackDateFilter.Children.Add(filterStartDate); stackDateFilter.Children.Add(filterEndDate); stackDateFilter.Children.Add(buttonFilter); // Create a template to display each technician in the list var dataTemplateItem = new DataTemplate(typeof(ScheduledAppointmentDataCell)); // Create the actual list _listViewScheduledAppointments = new ListView() { HasUnevenRows = true, BindingContext = _vm.ScheduleDetails, ItemsSource = _vm.ScheduleDetails, ItemTemplate = dataTemplateItem, SeparatorVisibility = SeparatorVisibility.None }; _listViewScheduledAppointments.ItemTapped += ListViewScheduledAppointments_ItemTapped; Content = new StackLayout { BackgroundColor = Color.FromHex("#2980b9"), Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { titleLayout, stackDateFilter, _listViewScheduledAppointments } }; }
public void OnDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { }
protected override void Init() { var stackLayout = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; // DatePicker var datePickerButton = new Button { Text = "Show DatePicker", AutomationId = DatePickerButton }; var datePicker = new DatePicker { IsVisible = false }; datePickerButton.Clicked += (s, a) => { Device.BeginInvokeOnMainThread(() => { if (datePicker.IsFocused) { datePicker.Unfocus(); } datePicker.Focus(); }); }; // TimePicker var timePickerButton = new Button { Text = "Show TimePicker", AutomationId = TimePickerButton }; var timePicker = new TimePicker { IsVisible = false }; timePickerButton.Clicked += (s, a) => { Device.BeginInvokeOnMainThread(() => { if (timePicker.IsFocused) { timePicker.Unfocus(); } timePicker.Focus(); }); }; // Picker var pickerButton = new Button { Text = "Show Picker", AutomationId = PickerButton }; var picker = new Picker { IsVisible = false, ItemsSource = _pickerValues }; pickerButton.Clicked += (s, a) => { Device.BeginInvokeOnMainThread(() => { if (picker.IsFocused) { picker.Unfocus(); } picker.Focus(); }); }; stackLayout.Children.Add(datePickerButton); stackLayout.Children.Add(datePicker); stackLayout.Children.Add(timePickerButton); stackLayout.Children.Add(timePicker); stackLayout.Children.Add(pickerButton); stackLayout.Children.Add(picker); Content = stackLayout; }