public void ExecuteLoadPickersCommand() { for (int year = 2020; year <= DateTime.Today.Year; year++) { var yearItem = new PickerItem { Id = year, Text = year.ToString(), }; YearsList.Add(yearItem); } for (int month = 1; month <= 12; month++) { var date = new DateTime(DateTime.Today.Year, month, 1); var monthItem = new PickerItem { Id = date.Month, Text = date.ToString("MMMM"), }; MonthsList.Add(monthItem); } }
void OnSelectionChangedUpdateInterval(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0 && e.RemovedItems.Count > 0) { string key = string.Empty; PickerItem pickerItem = e.AddedItems[0] as PickerItem; switch ((sender as FrameworkElement).Name.Replace("UpdateInterval", "").Replace("Picker", "")) { case "Lockscreen": key = Constants.LOCKSCREEN_UPDATE_INTERVAL; scheduleSettings.LockscreenUpdateInterval = (int)pickerItem.Key; break; case "Livetile": key = Constants.LIVETILE_UPDATE_INTERVAL; scheduleSettings.LivetileUpdateInterval = (int)pickerItem.Key; break; default: return; } MutexedIsoStorageFile.Write <ScheduleSettings>(scheduleSettings, "ScheduleSettings", Constants.MUTEX_DATA); } }
private ChatItem CreateDatePickerChatItem() { DatePickerContext datePickercontext = new DatePickerContext(); PickerItem pickerItem = new PickerItem(); pickerItem.Context = datePickercontext; datePickercontext.PropertyChanged += (sender, args) => { if (args.PropertyName == nameof(DatePickerContext.SelectedDate)) { if (datePickercontext.SelectedDate != null) { this.chat.Items.Remove(pickerItem); string selectedDate = datePickercontext.SelectedDate.Value.ToString("dd MMM", CultureInfo.InvariantCulture); this.chat.Items.Add(new TextMessage() { Author = this.chat.Author, Text = selectedDate }); } } }; return(pickerItem); }
private void HandleDateSelection(Activity activity) { if (activity.Text.Contains("Please, choose a date for visiting")) { ItemPickerContext itemPickerContext = new ItemPickerContext { ItemsSource = new List <CardAction>() { new CardAction() { Title = "Choose a Date" } } }; PickerItem pickerItem = new PickerItem(); pickerItem.Context = itemPickerContext; itemPickerContext.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(ItemPickerContext.SelectedItem)) { if (itemPickerContext.SelectedItem != null) { this.chat.Items.Remove(pickerItem); this.chat.Items.Add(this.CreateDatePickerChatItem()); } } }; this.chat.Items.Add(pickerItem); } }
public void OnBubbleSelected(PickerItem item) { System.Diagnostics.Debug.WriteLine($"Selected: {item.Title}"); Snackbar.Make(Picker, $"Selected: {item.Title}", Snackbar.LengthLong) .SetAction("Action", (Android.Views.View.IOnClickListener)null) .Show(); }
private void HandleSuggestedActions(Activity activity) { if (activity.SuggestedActions == null) { return; } ItemPickerContext itemPickerContext = new ItemPickerContext { ItemsSource = activity.SuggestedActions.Actions }; PickerItem pickerItem = new PickerItem(); pickerItem.Context = itemPickerContext; itemPickerContext.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(ItemPickerContext.SelectedItem)) { if (itemPickerContext.SelectedItem != null) { this.chat.Items.Remove(pickerItem); string selectedItem = ((CardAction)itemPickerContext.SelectedItem).Title; this.chat.Items.Add(new TextMessage { Author = this.chat.Author, Text = selectedItem }); } } }; this.chat.Items.Add(pickerItem); }
private ImageCardContext CreateImageContext(PickerItem cardPickerItem, Attachment attachment) { HeroCard card = JsonConvert.DeserializeObject <HeroCard>(attachment.Content.ToString()); ImageCardContext imageContext = new ImageCardContext(); if (card.Images != null && card.Images.Count > 0) { imageContext.Image = card.Images[0].Url; } imageContext.Title = card.Title; imageContext.Subtitle = card.Subtitle; imageContext.Description = card.Text; foreach (CardAction action in card.Buttons) { CardAction currentAction = action; CardActionContext actionContext = new CardActionContext() { Text = currentAction.Title, Command = new Command(() => { this.chat.Items.Remove(cardPickerItem); this.chat.Items.Add(new TextMessage() { Author = this.chat.Author, Text = currentAction.Value.ToString() }); }) }; imageContext.Actions.Add(actionContext); } return(imageContext); }
public ChooseItem() { InitializeComponent(); // >> chat-chatpicker-itempicker ItemPickerContext context = new ItemPickerContext { ItemsSource = new List <string>() { "2 days", "5 days", "7 days", "Another period" } }; PickerItem pickerItem = new PickerItem { Context = context, HeaderText = "Select an item" }; chat.Items.Add(pickerItem); context.PropertyChanged += (s, e) => { if (e.PropertyName == "SelectedItem") { if (context.SelectedItem != null) { chat.Items.Remove(pickerItem); chat.Items.Add(new TextMessage { Author = chat.Author, Text = "" + context.SelectedItem }); } } }; // << chat-chatpicker-itempicker }
public ChooseTime() { InitializeComponent(); // >> chat-chatpicker-timepicker TimePickerContext context = new TimePickerContext { StartTime = TimeSpan.FromHours(1), EndTime = TimeSpan.FromHours(5), }; PickerItem pickerItem = new PickerItem { Context = context }; chat.Items.Add(new TextMessage { Text = "Select a time" }); chat.Items.Add(pickerItem); context.PropertyChanged += (s, e) => { if (e.PropertyName == "SelectedValue") { if (context.SelectedValue != null) { chat.Items.Remove(pickerItem); chat.Items.Add(new TextMessage { Author = chat.Author, Text = "" + context.SelectedValue }); } } }; // << chat-chatpicker-timepicker }
private void CreateAdaptiveCard(Attachment attachment) { JsonSerializerSettings settings = new JsonSerializerSettings(); settings.Converters.Add(new JsonAdaptiveElementToObjectConverter()); AdaptiveCard adaptiveCard = JsonConvert.DeserializeObject <AdaptiveCard>(attachment.Content.ToString(), settings); if (adaptiveCard.TType == "Summary") { string title = ((AdaptiveTextBlock)adaptiveCard.Body[1]).Text; string subtitle = ((AdaptiveTextBlock)adaptiveCard.Body[2]).Text; StringBuilder description = new StringBuilder(); description.AppendLine(((AdaptiveTextBlock)adaptiveCard.Body[4]).Text); description.AppendLine(((AdaptiveTextBlock)adaptiveCard.Body[3]).Text); description.AppendLine(); description.AppendLine(((AdaptiveTextBlock)adaptiveCard.Body[5]).Text); description.AppendLine(); description.AppendLine(((AdaptiveTextBlock)adaptiveCard.Body[8]).Text); description.AppendLine(string.Format("{0} {1}", ((AdaptiveTextBlock)adaptiveCard.Body[6]).Text, ((AdaptiveTextBlock)adaptiveCard.Body[7]).Text)); Summary summary = new Summary(); summary.Title = title; summary.Subtitle = subtitle; summary.Description = description.ToString(); summary.ImageUri = ((AdaptiveImage)adaptiveCard.Body[0]).Url.OriginalString; ChatItem summaryItem = new PickerItem(); summaryItem.Data = summary; this.chat.Items.Add(summaryItem); } }
private void CreateModels() { FontSource = new ObservableCollection <PickerItem <string, string> >(); FontStyleSource = new ObservableCollection <PickerItem <string, string> >(); FontWeightSource = new ObservableCollection <PickerItem <string, ushort> >(); //글자 스타일 피커 데이터 생성 foreach (FontStyle fs in Enum.GetValues(typeof(FontStyle)).Cast <FontStyle>()) { PickerItem <string, string> item = new PickerItem <string, string>() { Key = fs.ToString(), Name = fs.ToString() }; FontStyleSource.Add(item); } //글자 굵기 피커 데이터 설정 foreach (var fwProp in typeof(FontWeights).GetRuntimeProperties()) { PickerItem <string, ushort> item = new PickerItem <string, ushort>() { Key = ((FontWeight)fwProp.GetValue("Weight")).Weight, Name = fwProp.Name }; FontWeightSource.Add(item); } }
private void LoadFontList() { if (!_IsFontLoading) { _IsFontLoading = true; FontSource.Clear(); //폰트 콤보 FontHelper.LoadAllFont(FontSource, FontTypes.All, () => { DispatcherHelper.CheckBeginInvokeOnUI(() => { var selected = FontSource.FirstOrDefault(x => x.Key == Settings.Subtitle.FontFamily); if (selected == null) { Settings.Subtitle.FontFamily = Settings.FONT_FAMILY_DEFAUT; selected = FontSource.FirstOrDefault(x => x.Key == Settings.Subtitle.FontFamily); } FontFamily = selected; _IsFontLoading = false; }); }); } }
private void HandleDateSelection(Activity activity) { if (activity.Text == "When do you want your vacation to start?" || activity.Text.Contains("This doesn't seem to be a valid date.")) { ItemPickerContext itemPickerContext = new ItemPickerContext { ItemsSource = new List <CardAction>() { new CardAction() { Title = "Select Start Date" } } }; PickerItem pickerItem = new PickerItem(); pickerItem.Data = itemPickerContext; pickerItem.Context = itemPickerContext; itemPickerContext.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(ItemPickerContext.SelectedItem)) { if (itemPickerContext.SelectedItem != null) { this.Items.Remove(pickerItem); this.Items.Add(this.CreateDatePickerChatItem()); } } }; this.Items.Add(pickerItem); } }
public static Widget defaultLayoutBuilder( BuildContext context, List <Color> colors, PickerItem child ) { Orientation orientation = MediaQuery.of(context).orientation; var list = new List <Widget>(); foreach (var color in colors) { list.Add(child(color)); } return(new Container( width: orientation == Orientation.portrait ? 300f : 300f, height: orientation == Orientation.portrait ? Mathf.FloorToInt(list.Count / 4) * 60f : 200f, child: GridView.count( crossAxisCount: orientation == Orientation.portrait ? 4 : 6, crossAxisSpacing: 5f, mainAxisSpacing: 5f, children: list ) //GridView.count )); //Container }
public ChooseDate() { InitializeComponent(); // >> chat-chatpicker-datepicker DatePickerContext context = new DatePickerContext { MinDate = new DateTime(2019, 1, 1), MaxDate = new DateTime(2019, 2, 2), DisplayDate = new DateTime(2019, 1, 16) }; PickerItem pickerItem = new PickerItem { Context = context }; chat.Items.Add(new TextMessage { Text = "Select a date", Author = chat.Author }); chat.Items.Add(pickerItem); context.PropertyChanged += (s, e) => { if (e.PropertyName == "SelectedDate") { if (context.SelectedDate != null) { chat.Items.Remove(pickerItem); chat.Items.Add(new TextMessage { Author = chat.Author, Text = "" + context.SelectedDate }); } } }; // << chat-chatpicker-datepicker }
private void defaultPagePicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (defaultPagePicker.SelectedItem != null && e.RemovedItems.Count > 0 && e.AddedItems.Count > 0) { PickerItem pickerItem = defaultPagePicker.SelectedItem as PickerItem; int pageIndex = (int)pickerItem.Key; SettingManager.Instance.UpdateNLoad(SettingManager.KEY_SEARCH_DEFAULT_PAGE, pageIndex); } }
private void dataUsagePicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dataUsagePicker.SelectedItem != null && e.RemovedItems.Count > 0 && e.AddedItems.Count > 0) { PickerItem pickerItem = dataUsagePicker.SelectedItem as PickerItem; int perDataUsage = (int)pickerItem.Key; SettingManager.Instance.UpdateNLoad(SettingManager.KEY_CELLULAR_DATA_USAGE, perDataUsage); } }
private void LivetileFontWeightPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0) { PickerItem item = e.AddedItems[0] as PickerItem; if (item != null) { SettingHelper.Set(Constants.LIVETILE_FONT_WEIGHT, item.Key, false); } } }
private void imgQualityPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (imgQualityPicker.SelectedItem != null && e.RemovedItems.Count > 0 && e.AddedItems.Count > 0) { PickerItem pickerItem = imgQualityPicker.SelectedItem as PickerItem; ImageQualityTypes imgQualityType = (ImageQualityTypes)pickerItem.Key; //변경된 설정 저장 SettingManager.Instance.UpdateNLoad(SettingManager.KEY_IMAGE_QUALITY, imgQualityType); //변경값 포인팅 매니져로 전달 PointingControlManager.Instance.ImageQualityType = imgQualityType; } }
private void HandleSuggestedActions(Activity activity) { if (activity.SuggestedActions != null) { ItemPickerContext itemPickerContext = null; if (activity.Text == "Here are some recommended locations for you:") { List <TravelCardAction> travelActions = new List <TravelCardAction>(); foreach (CardAction action in activity.SuggestedActions.Actions) { travelActions.Add(new TravelCardAction() { DestinationName = action.Title }); } itemPickerContext = new ItemPickerContext { ItemsSource = travelActions }; this.Context = itemPickerContext; this.PickerHeaderText = "Select a Location"; this.IsChatPickerVisible = true; } else { itemPickerContext = new ItemPickerContext { ItemsSource = activity.SuggestedActions.Actions }; PickerItem pickerItem = new PickerItem(); pickerItem.Data = itemPickerContext; pickerItem.Context = itemPickerContext; itemPickerContext.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(ItemPickerContext.SelectedItem)) { if (itemPickerContext.SelectedItem != null) { this.Items.Remove(pickerItem); string selectedItem = ((CardAction)itemPickerContext.SelectedItem).Title; this.Items.Add(new TextMessage { Author = this.Me, Text = selectedItem }); } } }; this.Items.Add(pickerItem); } } }
private void RenderCards(JToken attachments) { string layout = Convert.ToString(attachments.Parent.Parent["attachmentLayout"]); if (layout != "carousel") { return; } List <CardContext> imageCards = new List <CardContext>(); CardPickerContext cardContext = new CardPickerContext(); PickerItem cardPickerItem = new PickerItem { Context = cardContext }; foreach (JToken attachment in attachments) { List <CardActionContext> actions = new List <CardActionContext>(); foreach (var action in attachment["buttons"]) { var localAction = action; actions.Add(new CardActionContext() { Text = Convert.ToString(localAction["title"]), Command = new Command(() => { this.chat.Items.Remove(cardPickerItem); string actionText = Convert.ToString(localAction["value"]); this.chat.Items.Add(new TextMessage() { Text = actionText, Author = this.chat.Author }); }) }); } ImageCardContext imageContext = new ImageCardContext(); if (attachment["images"] != null && attachment["images"].Count() > 0) { imageContext.Image = (Convert.ToString(attachment["images"][0]["url"])); } imageContext.Title = Convert.ToString(attachment["title"]); imageContext.Subtitle = Convert.ToString(attachment["subtitle"]); imageContext.Actions = actions; imageCards.Add(imageContext); } cardContext.Cards = imageCards; this.chat.Items.Add(cardPickerItem); }
public PickerItem GetItem(int itemIndex) { if (itemIndex < 0 || itemIndex >= _bubbles.Count) { return(null); } var result = _bubbles[itemIndex]; var item = new PickerItem(result); return(item); }
private void SetPickerSource(ListPicker picker, List <PickerItem> itemList, string selectKey) { PickerItem selectItem = null; foreach (PickerItem item in itemList) { if ((string)item.Key == selectKey) { selectItem = item; break; } } picker.ItemsSource = itemList; picker.SelectedItem = selectItem; }
public CustomCard() { InitializeComponent(); PickerItem pickerItem = new PickerItem(); var context = new CardPickerContext { Cards = this.GetCards(pickerItem) }; pickerItem.Context = context; chat.Items.Add(new TextMessage { Text = "Select a contact" }); chat.Items.Add(pickerItem); }
protected void LoadDataPickers() { try { if (this.IsInternetAndCloseModal()) { var yearPickerTemp = new ObservableCollection <PickerItem>(); for (int iyear = DateTime.Now.Year - 1; iyear <= (DateTime.Now.Year + 1); iyear++) { yearPickerTemp.Add(new PickerItem { Value = iyear, DisplayName = iyear.ToString() }); } YearPicker = yearPickerTemp; var monthPickerTemp = new ObservableCollection <PickerItem>(); for (int imes = DateTime.MinValue.Month; imes < DateTime.MaxValue.Month + 1; imes++) { monthPickerTemp.Add(new PickerItem { Value = imes, DisplayName = dtinfo.GetMonthName(imes) }); } MonthPicker = monthPickerTemp; var MyDate = DateTime.Now; var InitYearPickerItem = new PickerItem { Value = MyDate.Year, DisplayName = MyDate.Year.ToString(), }; var InitMonthPickerItem = new PickerItem { Value = MyDate.Month, DisplayName = dtinfo.GetMonthName(MyDate.Month), }; MyItemMonthPicker = MonthPicker.Where(x => x.Value == InitMonthPickerItem.Value).FirstOrDefault(); MyItemYearPicker = YearPicker.Where(x => x.Value == InitYearPickerItem.Value).FirstOrDefault(); } } catch (Exception ex) { IsBusy = false; BaseModule.DialogErrorCustomService.DialogErrorCommonTryAgain(); Crashes.TrackError(ex); } }
public ChooseCard() { InitializeComponent(); // >> chat-chatpicker-cardpicker-pickeritem PickerItem pickerItem = new PickerItem(); var context = new CardPickerContext { Cards = this.GetCards(pickerItem) }; pickerItem.Context = context; chat.Items.Add(new TextMessage { Text = "Select a destination" }); chat.Items.Add(pickerItem); // << chat-chatpicker-cardpicker-pickeritem }
public IEnumerable <PickerItem> GetAllMemberTypesWithAlias() { var list = new List <PickerItem>(); Guid[] guids = umbraco.cms.businesslogic.CMSNode.getAllUniquesFromObjectType(new Guid("9b5416fb-e72f-45a9-a07b-5a9a2709ce43")); foreach (var g in guids) { var mt = new MemberType(g); var p = new PickerItem { Id = mt.Alias, Value = mt.Text }; list.Add(p); } return(list); }
private void RenderReplyMessages(JObject message) { JArray replies = message.Value <JArray>("replies"); if (replies == null) { return; } List <InsuranceService> options = new List <InsuranceService>(); foreach (JValue reply in replies) { InsuranceService option = new InsuranceService(); option.Type = reply.ToString(); options.Add(option); } ItemPickerContext insurancePickerContext = new ItemPickerContext(); insurancePickerContext.ItemsSource = options; PickerItem insurancePickerItem = new PickerItem() { Context = insurancePickerContext }; insurancePickerContext.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(ItemPickerContext.SelectedItem)) { if (insurancePickerContext.SelectedItem != null) { this.chat.Items.Remove(insurancePickerItem); string insuranceServiceType = ((InsuranceService)insurancePickerContext.SelectedItem).Type; this.chat.Items.Add(new TextMessage() { Author = this.chat.Author, Text = insuranceServiceType }); } } }; this.chat.Items.Add(insurancePickerItem); }
void ffmpegSubtitleSupport_SubtitleUpdatedEvent(SubtitleSupport sender, SubtitleInfomation subtitleInfomation) { Subtitle subtitle = CreateSubtitle(subtitleInfomation);; if (subtitle != null) { PickerItem <string, string> item = new PickerItem <string, string> { Key = subtitleInfomation.streamIndex.ToString(), Name = subtitle.Title, Payload = subtitle, Payload2 = (byte)4 }; //재생패널 콤보 변경 MessengerInstance.Send <Message>(new Message("SubtitleUpdated", item), TransportControlViewModel.NAME); } }
public IEnumerable<PickerItem> GetAllMemberTypesWithAlias() { var list = new List<PickerItem>(); Guid[] guids = umbraco.cms.businesslogic.CMSNode.getAllUniquesFromObjectType(new Guid("9b5416fb-e72f-45a9-a07b-5a9a2709ce43")); foreach (var g in guids) { var mt = new MemberType(g); var p = new PickerItem { Id = mt.Alias, Value = mt.Text }; list.Add(p); } return list; }
public IEnumerable<PickerItem> GetAllProperties(string membertypeAlias) { var list = new List<PickerItem>(); var memtype = umbraco.cms.businesslogic.member.MemberType.GetByAlias(membertypeAlias); foreach(var prop in memtype.PropertyTypes) { var p = new PickerItem { Id = prop.Alias, Value = prop.Name }; if(!list.Contains(p)) list.Add(p); } return list; }
private void CreateModels() { ResourceLoader loader = ResourceLoader.GetForCurrentView(); PickerItem <string, string>[] hwBackKeyAction = { new PickerItem <string, string>() { Name = loader.GetString("MoveToUpperFolder"),Key = HardwareBackButtonAction.MoveToUpperFolder.ToString() }, new PickerItem <string, string>() { Name = loader.GetString("TerminateApplication"),Key = HardwareBackButtonAction.TerminateApplication.ToString() } }; FontSource = new ObservableCollection <PickerItem <string, string> >(); HardwareBackButtonActionSource = new ObservableCollection <PickerItem <string, string> >(hwBackKeyAction); StartUpSectionSource = new ObservableCollection <PickerItem <string, int> >(); _AllVideoSectionItem = new PickerItem <string, int>() { Name = loader.GetString("AllVideo/Text"), Key = 1 }; StartUpSectionSource.Add(new PickerItem <string, int>() { Name = loader.GetString("Explorer/Header"), Key = 0 }); if (UseAllVideoSection) { StartUpSectionSource.Add(_AllVideoSectionItem); } StartUpSectionSource.Add(new PickerItem <string, int>() { Name = loader.GetString("Playlist/Header"), Key = 2 }); StartUpSectionSource.Add(new PickerItem <string, int>() { Name = loader.GetString("About/Header"), Key = 3 }); }