private void OnDaySelected(PickerCell cell) { // NOTE - important to keep this order selectedDate = new DateTime(focusedDate.Year, focusedDate.Month, cell.dateTime.Day); focusedDate = selectedDate; // Debug.Log($"selectedDate: {selectedDate}"); cellClickedDelegate?.Invoke(cell); }
public override void CellClicked(PickerCell cell) { // set the new date calendar.focusedDate = new DateTime( cell.transform.GetSiblingIndex() + startYear, calendar.focusedDate.Month, calendar.focusedDate.Day); // zoom out calendar.ZoomOut(); }
public override void CellClicked(PickerCell cell) { // set the new date calendar.focusedDate = new DateTime( calendar.focusedDate.Year, cell.transform.GetSiblingIndex() + 1, Mathf.Clamp(calendar.focusedDate.Day, 1, DateTime.DaysInMonth(calendar.focusedDate.Year, cell.transform.GetSiblingIndex() + 1))); // zoom out calendar.ZoomOut(); }
public override void CellClicked(PickerCell cell) { DateTime temp; int clickedIndex = cell.transform.GetSiblingIndex(); int firstDay = (int)new DateTime(calendar.focusedDate.Year, calendar.focusedDate.Month, 1).DayOfWeek; int numberOfDays = DateTime.DaysInMonth(calendar.focusedDate.Year, calendar.focusedDate.Month); int numberOfDaysLastMonth = 0; if (calendar.focusedDate.Month == 1) { numberOfDaysLastMonth = DateTime.DaysInMonth(calendar.focusedDate.Year - 1, 12); } else { numberOfDaysLastMonth = DateTime.DaysInMonth(calendar.focusedDate.Year, calendar.focusedDate.Month - 1); } // clicked in the last month if (clickedIndex < firstDay) { temp = new DateTime( calendar.focusedDate.AddMonths(-1).Year, calendar.focusedDate.AddMonths(-1).Month, clickedIndex + numberOfDaysLastMonth - firstDay + 1); } // clicked in the next month else if (clickedIndex > firstDay + numberOfDays - 1) { temp = new DateTime( calendar.focusedDate.AddMonths(1).Year, calendar.focusedDate.AddMonths(1).Month, clickedIndex - numberOfDays - firstDay + 1); } // clicked in the current month else { temp = new DateTime( calendar.focusedDate.Year, calendar.focusedDate.Month, clickedIndex - firstDay + 1); } // don't allow to proceed if past date selected and it's not allowed if (temp.Date.IsOlderDate(DateTime.Today) && !calendar.allowPastSelection) { return; } calendar.focusedDate = temp; calendar.ZoomOut(); cellClickedDelegate?.Invoke(cell); }
/// <summary> /// Dispose the specified disposing. /// </summary> /// <returns>The dispose.</returns> /// <param name="disposing">If set to <c>true</c> disposing.</param> protected override void Dispose(bool disposing) { if (disposing) { _parent = null; _pickerCell = null; _source = null; _listview = null; _context = null; } base.Dispose(disposing); }
internal PickerTableViewController(PickerCellView pickerCellView, UITableView tableView, INavigation shellNavigation = null) : base(UITableViewStyle.Grouped) { _pickerCell = pickerCellView.Cell as PickerCell; _pickerCellNative = pickerCellView; _parent = pickerCellView.CellParent; _source = _pickerCell.ItemsSource as IList; _tableView = tableView; _shellNavigation = shellNavigation; _pickerCell.SelectedItems ??= new List <object>(); SetUpProperties(); }
private static PickerCell CreatePicker(string text, string itemsBinding, PickerMode mode, string subtext = "", string commandBinding = null) { var cell = new PickerCell(); cell.Text = text; cell.SetBinding(PickerCell.PickerItemsProperty, itemsBinding); cell.Mode = mode; cell.SubText = subtext; if (commandBinding != null) { cell.SetBinding(PickerCell.EmptyCommandProperty, commandBinding); } return(cell); }
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context) { currentContext = context; nativeCell = (PickerCell)item; cellView = convertView as PickerCellView; if (cellView == null) { cellView = new PickerCellView(context, item); cellView.EditText.Click += OnClicked; } UpdatePicker(); return(cellView); }
private void CellClickedDelegate(PickerCell cell) { // don't allow to add new reminder to past dates if (cell.dateTime.Date.IsOlderDate(DateTime.Now.Date)) { _addReminderButton.gameObject.SetActive(false); } else { _addReminderButton.gameObject.SetActive(true); } // cache last selected date to open calendar keeping last progress _lastSelectedDate = cell.dateTime.Date; SetScrollData(cell.reminders); }
/// <summary> /// Dispose the specified disposing. /// </summary> /// <returns>The dispose.</returns> /// <param name="disposing">If set to <c>true</c> disposing.</param> protected override void Dispose(bool disposing) { if (disposing) { _pickerCell = null; _selectedCache = null; _source = null; _parent = null; _accentColor.Dispose(); _accentColor = null; _titleColor?.Dispose(); _titleColor = null; _background?.Dispose(); _background = null; _tableView = null; } base.Dispose(disposing); }
internal PickerAdapter(Android.Content.Context context, PickerCell pickerCell, ListView listview) { _context = context; _listview = listview; _pickerCell = pickerCell; _parent = pickerCell.Parent as SettingsView; _source = pickerCell.ItemsSource as IList; if (pickerCell.SelectedItems == null) { pickerCell.SelectedItems = new List <object>(); } if (_parent != null) { _listview.SetBackgroundColor(_parent.BackgroundColor.ToAndroid()); _listview.Divider = new ColorDrawable(_parent.SeparatorColor.ToAndroid()); _listview.DividerHeight = 1; } SetUpProperties(); }
public void CreateCells(string name) { RectTransform mainPanelRect = gameObject.GetComponent <RectTransform>(); GridLayoutGroup grid = gameObject.GetComponent <GridLayoutGroup>(); // create the elements for (int i = 0; i < columns * rows; i++) { GameObject go = Instantiate(button, Vector3.zero, Quaternion.identity) as GameObject; PickerCell cell = go.GetComponent <PickerCell>(); cell.cellClickedDelegate = CellClicked; cells.Add(cell); go.transform.SetParent(this.transform); go.transform.localScale = Vector3.one; go.name = name; } // set the grid layout grid.cellSize = new Vector2(mainPanelRect.rect.width / columns - horizSpacing, mainPanelRect.rect.height / rows - vertSpacing); grid.spacing = new Vector2(horizSpacing, vertSpacing); }
public LeadDetailPage() { #region name entry EntryCell companyNameEntryCell = new EntryCell() { Label = TextResources.Leads_LeadDetail_CompanyName, Placeholder = TextResources.Leads_LeadDetail_CompanyNamePlaceholder, Keyboard = Keyboard.Text }; companyNameEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Company", BindingMode.TwoWay); #endregion #region industry picker PickerCell industryPickerCell = new PickerCell(); industryPickerCell.Label.Text = TextResources.Leads_LeadDetail_Industry; foreach (var industry in Account.IndustryTypes) { industryPickerCell.Picker.Items.Add(industry); } industryPickerCell.Picker.SetBinding(Picker.SelectedIndexProperty, "Lead.IndustryTypeCurrentIndex", BindingMode.TwoWay); industryPickerCell.Picker.SelectedIndexChanged += (sender, e) => { ViewModel.Lead.Industry = industryPickerCell.Picker.Items[industryPickerCell.Picker.SelectedIndex]; }; #endregion #region opportunity size entry EntryCell opportunitySizeEntryCell = new EntryCell() { Label = TextResources.Leads_LeadDetail_OpportunitySize, Placeholder = TextResources.Leads_LeadDetail_OpportunitySizePlaceholder, Keyboard = Keyboard.Numeric }; opportunitySizeEntryCell.SetBinding(EntryCell.TextProperty, "Lead.OpportunitySize", BindingMode.TwoWay, new CurrencyDoubleConverter()); #endregion #region opportunity stage picker PickerCell opportunityStagePickerCell = new PickerCell(); opportunityStagePickerCell.Label.Text = TextResources.Leads_LeadDetail_OpportunityStage; foreach (var opportunityStage in Account.OpportunityStages) { opportunityStagePickerCell.Picker.Items.Add(opportunityStage); } opportunityStagePickerCell.Picker.SetBinding(Picker.SelectedIndexProperty, "Lead.OpportunityStageCurrentIndex", BindingMode.TwoWay); opportunityStagePickerCell.Picker.SelectedIndexChanged += (sender, e) => { ViewModel.Lead.OpportunityStage = opportunityStagePickerCell.Picker.Items[opportunityStagePickerCell.Picker.SelectedIndex]; }; #endregion #region roleEntry EntryCell roleEntryCell = new EntryCell() { Label = TextResources.Leads_LeadContactDetail_Role, LabelColor = Palette._007, Keyboard = Keyboard.Text }; roleEntryCell.SetBinding(EntryCell.TextProperty, "Lead.JobTitle", BindingMode.TwoWay); #endregion #region firstNameEntry EntryCell firstNameEntryCell = new EntryCell() { Label = TextResources.Leads_LeadContactDetail_FirstName, Keyboard = Keyboard.Text }; firstNameEntryCell.SetBinding(EntryCell.TextProperty, "Lead.FirstName", BindingMode.TwoWay); #endregion #region lastNameEntry EntryCell lastNameEntryCell = new EntryCell() { Label = TextResources.Leads_LeadContactDetail_LastName, Keyboard = Keyboard.Text }; lastNameEntryCell.SetBinding(EntryCell.TextProperty, "Lead.LastName", BindingMode.TwoWay); #endregion #region phoneEntry EntryCell phoneEntryCell = new EntryCell() { Label = TextResources.Leads_LeadContactDetail_Phone, Keyboard = Keyboard.Telephone }; phoneEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Phone", BindingMode.TwoWay); #endregion #region emailEntry EntryCell emailEntryCell = new EntryCell() { Label = TextResources.Leads_LeadContactDetail_Email, Keyboard = Keyboard.Email }; emailEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Email", BindingMode.TwoWay); #endregion #region streetEntry EntryCell streetEntryCell = new EntryCell() { Label = TextResources.Leads_LeadContactDetail_Address, Keyboard = Keyboard.Text }; streetEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Street", BindingMode.TwoWay); #endregion #region postalCodeEntry EntryCell postalCodeEntryCell = new EntryCell() { Label = TextResources.Leads_LeadContactDetail_PostalCode, Keyboard = Keyboard.Numeric }; postalCodeEntryCell.SetBinding(EntryCell.TextProperty, "Lead.PostalCode", BindingMode.TwoWay); #endregion #region cityEntry EntryCell cityEntryCell = new EntryCell() { Label = TextResources.Leads_LeadContactDetail_City, Keyboard = Keyboard.Text }; cityEntryCell.SetBinding(EntryCell.TextProperty, "Lead.City", BindingMode.TwoWay); #endregion #region stateEntry EntryCell stateEntryCell = new EntryCell() { Label = TextResources.Leads_LeadContactDetail_State, Keyboard = Keyboard.Text }; stateEntryCell.SetBinding(EntryCell.TextProperty, "Lead.State", BindingMode.TwoWay); #endregion #region countryEntry EntryCell countryEntryCell = new EntryCell() { Label = TextResources.Leads_LeadContactDetail_Country, Keyboard = Keyboard.Text }; countryEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Country", BindingMode.TwoWay); #endregion #region compose view hierarchy Content = new TableView() { Intent = TableIntent.Settings, Root = new TableRoot() { new TableSection("Company") { companyNameEntryCell, industryPickerCell }, new TableSection(TextResources.Leads_LeadDetail_OpportunityHeading) { opportunitySizeEntryCell, opportunityStagePickerCell }, new TableSection("Info") { roleEntryCell, firstNameEntryCell, lastNameEntryCell }, new TableSection("Contact") { phoneEntryCell, emailEntryCell }, new TableSection("Address") { streetEntryCell, postalCodeEntryCell, cityEntryCell, stateEntryCell, countryEntryCell } } }; #endregion }
public virtual void CellClicked(PickerCell cell) { cellClickedDelegate?.Invoke(cell); }
public LeadDetailPage() { #region name entry EntryCell companyNameEntryCell = new EntryCell() { Label = TextResources.Leads_LeadDetail_CompanyName, Placeholder = TextResources.Leads_LeadDetail_CompanyNamePlaceholder }; companyNameEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Company", BindingMode.TwoWay); #endregion #region industry picker PickerCell industryPickerCell = new PickerCell(); industryPickerCell.Picker.HorizontalOptions = new LayoutOptions(LayoutAlignment.Center, true); industryPickerCell.Picker.Title = TextResources.Leads_LeadDetail_Industry; foreach (var industry in Account.IndustryTypes) { industryPickerCell.Picker.Items.Add(industry); } industryPickerCell.Picker.SetBinding(Picker.SelectedIndexProperty, "Lead.IndustryTypeCurrentIndex", BindingMode.TwoWay); industryPickerCell.Picker.SelectedIndexChanged += (sender, e) => { ViewModel.Lead.Industry = industryPickerCell.Picker.Items[industryPickerCell.Picker.SelectedIndex]; }; #endregion #region opportunity size entry EntryCell opportunitySizeEntryCell = new EntryCell() { Label = TextResources.Leads_LeadDetail_OpportunitySize, Placeholder = TextResources.Leads_LeadDetail_OpportunitySizePlaceholder, Keyboard = Keyboard.Numeric }; opportunitySizeEntryCell.SetBinding(EntryCell.TextProperty, "Lead.OpportunitySize", BindingMode.TwoWay, new CurrencyDoubleConverter()); #endregion #region opportunity stage picker PickerCell opportunityStagePickerCell = new PickerCell(); opportunityStagePickerCell.Picker.HorizontalOptions = new LayoutOptions(LayoutAlignment.Center, true); opportunityStagePickerCell.Picker.Title = TextResources.Leads_LeadDetail_OpportunityStage; foreach (var opportunityStage in Account.OpportunityStages) { opportunityStagePickerCell.Picker.Items.Add(opportunityStage); } opportunityStagePickerCell.Picker.SetBinding(Picker.SelectedIndexProperty, "Lead.OpportunityStageCurrentIndex", BindingMode.TwoWay); opportunityStagePickerCell.Picker.SelectedIndexChanged += (sender, e) => { ViewModel.Lead.OpportunityStage = opportunityStagePickerCell.Picker.Items[opportunityStagePickerCell.Picker.SelectedIndex]; }; #endregion #region compose table view Content = new TableView() { Intent = TableIntent.Settings, Root = new TableRoot() { new TableSection() { companyNameEntryCell, industryPickerCell }, new TableSection(TextResources.Leads_LeadDetail_OpportunityHeading) { opportunitySizeEntryCell, opportunityStagePickerCell } } }; #endregion }
private void ListCallback(ListResponse response) { _invokeButton.IsEnabled = true; var parameters = response.Node.Parameters; var columns = response.Node.Columns; _invokePermission = response.Node.Invokable; if (parameters != null) { foreach (var param in parameters) { Cell cell = null; var name = param["name"].Value <string>(); var type = param["type"].Value <string>(); string[] typeParams = new string[0]; var bracketIndex = type.IndexOf('['); if (bracketIndex != -1) { type = type.Substring(0, bracketIndex); typeParams = param["type"].Value <string>().Substring(bracketIndex + 1).TrimEnd(new char[] { ']' }).Split(','); } switch (type) { case "string": { cell = new EntryCell { Label = name }; break; } case "int": case "number": { cell = new EntryCell { Label = name, Keyboard = Keyboard.Numeric }; break; } case "bool": { cell = new SwitchCell { Text = name }; break; } case "enum": cell = new PickerCell(new List <string>(typeParams)) { Label = name }; break; case "binary": case "group": case "dynamic": { cell = new EntryCell { Label = name }; break; } default: { Debug.WriteLine(string.Format("Unknown type: {0}", type)); } break; } if (cell != null) { _parameterCells.Add(name, cell); Device.BeginInvokeOnMainThread(() => _parametersSection.Add(cell)); } } if (parameters.Count > 0) { Device.BeginInvokeOnMainThread(() => { _tableRoot.Add(_parametersSection); }); } } if (columns != null) { foreach (var column in columns) { var name = columns["name"].Value <string>(); var type = columns["type"].Value <string>(); Device.BeginInvokeOnMainThread(() => { Cell cell; switch (type) { case "string": case "binary": case "dynamic": { cell = new EntryCell { IsEnabled = false, Label = name }; break; } case "number": case "int": { cell = new EntryCell { IsEnabled = false, Label = name }; break; } case "bool": { cell = new SwitchCell { IsEnabled = false, Text = name }; break; } default: { throw new Exception(string.Format("Unknown type: {0}", column.Type)); } } if (cell != null) { _columnCells.Add(cell); Device.BeginInvokeOnMainThread(() => _columnsSection.Add(cell)); } }); } if (columns.Count > 0) { Device.BeginInvokeOnMainThread(() => { _tableRoot.Add(_columnsSection); }); } } response.Close(); }
private void CellClickedDelegate(PickerCell cell) { ControlCalendarPopup(false); }
internal PickerAdapter(Context context, PickerCellView renderer, PickerCell pickerCell, ListView listView) : base() { _Context = context; _Renderer = renderer; _ListView = listView; _PickerCell = pickerCell; _Parent = pickerCell.Parent; _Source = pickerCell.ItemsSource ?? new List <object?>(); pickerCell.SelectedItems ??= new List <object?>(); _ListView.SetBackgroundColor(pickerCell.Prompt.BackgroundColor.ToAndroid()); _ListView.Divider = new ColorDrawable(_PickerCell.Prompt.SeparatorColor.ToAndroid()); _ListView.DividerHeight = 1; if (pickerCell.Prompt.BackgroundColor != Color.Default) { BackgroundColor = pickerCell.Prompt.BackgroundColor.ToAndroid(); } // else if ( _Parent.CellPopup.BackgroundColor != Color.Default ) { BackgroundColor = _Parent.CellPopup.BackgroundColor.ToAndroid(); } else { BackgroundColor = Color.White.ToAndroid(); } if (pickerCell.Prompt.AccentColor != Color.Default) { AccentColor = pickerCell.Prompt.AccentColor.ToAndroid(); } // else if ( _Parent.CellPopup.AccentColor != Color.Default ) { AccentColor = _Parent.CellPopup.AccentColor.ToAndroid(); } else { BackgroundColor = Color.Accent.ToAndroid(); } if (pickerCell.Prompt.TitleColor != Color.Default) { TitleTextColor = pickerCell.Prompt.TitleColor.ToAndroid(); } // else if ( _Parent.CellTitleColor != Color.Default ) { TitleTextColor = _Parent.CellTitleColor.ToAndroid(); } else { TitleTextColor = Color.Black.ToAndroid(); } if (pickerCell.Prompt.ItemColor != Color.Default) { TextColor = pickerCell.Prompt.ItemColor.ToAndroid(); } // else if ( _Parent.CellTitleColor != Color.Default ) { TextColor = _Parent.CellTitleColor.ToAndroid(); } else { TextColor = Color.Black.ToAndroid(); } if (pickerCell.Prompt.TitleFontSize > 0) { FontSize = (float)pickerCell.Prompt.TitleFontSize; } // else if ( _Parent.CellPopup.FontSize > 0 ) { FontSize = _Parent.CellPopup.FontSize; } else { FontSize = 12; } if (pickerCell.Prompt.ItemDescriptionColor != Color.Default) { DetailColor = pickerCell.Prompt.ItemDescriptionColor.ToAndroid(); } // else if ( _Parent.CellPopup.DescriptionTextColor != Color.Default ) { DetailColor = _Parent.CellPopup.DescriptionTextColor.ToAndroid(); } if (pickerCell.Prompt.ItemDescriptionFontSize > 0) { DetailFontSize = (float)pickerCell.Prompt.ItemDescriptionFontSize; } // else if ( pickerCell.CellPopup.DescriptionFontSize > 0 ) { DetailFontSize = pickerCell.CellPopup.DescriptionFontSize; } else { DetailFontSize = 10; } }