public App() { PositionToStringValueConverter positionConverter = new PositionToStringValueConverter(); // This app main page is a Circle Page var page = new CirclePage(); // With a Circle List View as the only component var circleListView = new CircleListView { // Items on this list view are coming from a predefined pins list (check Pins.cs) ItemsSource = Pins.Predefined, // Each item on the list has two visual elements: ItemTemplate = new DataTemplate(() => { var cell = new TextCell(); // a Label (e.g. Rome) cell.SetBinding(TextCell.TextProperty, "Label"); // and its coordinates. cell.SetBinding(TextCell.DetailProperty, "Position", converter: positionConverter); return(cell); }), }; circleListView.ItemTapped += CircleListView_ItemTapped; page.Content = circleListView; page.RotaryFocusObject = circleListView; NavigationPage.SetHasNavigationBar(page, false); MainPage = new NavigationPage(); MainPage.Navigation.PushAsync(page, false); }
private void tagClickedFunc(Object sender, EventArgs e) { TagProvider tp = new TagProvider(); Dictionary <string, string> d = tp.getAllTag(); int tagCount = tp.getNum(); var tagGroup = new List <IconDescBind>(); foreach (string key in d.Keys) { tagGroup.Add(new IconDescBind { path = key, tagDesc = d[key] }); } DataTemplate dt = new DataTemplate(() => { var icon = new Image() { HorizontalOptions = LayoutOptions.End }; var tagDescLable = new Label() { HorizontalTextAlignment = TextAlignment.Center }; //var space = new Label() { Text = " " }; icon.SetBinding(Image.SourceProperty, "path"); tagDescLable.SetBinding(Label.TextProperty, "tagDesc"); StackLayout sl = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, Children = { icon, tagDescLable, } }; return(new ViewCell { View = sl }); }); CircleListView clv = new CircleListView { ItemsSource = tagGroup, ItemTemplate = dt, HorizontalOptions = LayoutOptions.Center, }; clv.ItemTapped += TagTapped; cp = new CirclePage() { Content = clv }; //np.PushAsync(cp); Navigation.PushModalAsync(cp); }
public ProfilesListPage(TeslaVehicle vehicle, IProfileService profileService, ITeslaAPIWrapper teslaAPIWrapper) { NavigationPage.SetHasNavigationBar(this, false); var listView = new CircleListView { Header = UIUtil.CreateHeaderLabel(vehicle.Name), ItemTemplate = new DataTemplate(() => { Label nameLabel = new Label { HeightRequest = 120, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; nameLabel.SetBinding(Label.TextProperty, "Name"); return(new ViewCell { View = new StackLayout { Children = { nameLabel, } } }); }), }; listView.ItemTapped += async(sender, e) => { var binder = (ProfileBinder)e.Item; await Navigation.PushAsync(new ProfileActionPage(binder.Profile, vehicle, profileService, teslaAPIWrapper)); }; ActionButton = new ActionButtonItem { Text = "Create", Command = new Command(async() => { await Navigation.PushAsync(new EditProfilePage(profileService)); }) }; Content = listView; Disposable = profileService .GetProfiles() .Subscribe(updatedList => { LogUtil.Debug("New profiles list count = " + updatedList.Count); listView.ItemsSource = updatedList.Select(p => new ProfileBinder(p)); }); }
/// <summary> /// Creates a new ListView for listing UUIDs. /// </summary> public void CreateUUIDListView() { UuidListView = new CircleListView { HorizontalOptions = LayoutOptions.CenterAndExpand, }; UuidListView.ItemsSource = UuidList; UuidListView.ItemTemplate = new DataTemplate(() => { var textCell = new TextCell(); textCell.SetBinding(TextCell.TextProperty, "."); return(textCell); }); }
/// <summary> /// Creates a new ListView for listing detected devices. /// </summary> public void CreateDeviceListView() { DeviceListView = new CircleListView { HorizontalOptions = LayoutOptions.CenterAndExpand, }; DeviceListView.ItemsSource = DeviceList; DeviceListView.ItemTemplate = new DataTemplate(() => { TextCell textCell = new TextCell(); textCell.SetBinding(TextCell.TextProperty, "Address"); return(textCell); }); DeviceListView.ItemTapped += DeviceTapped; }
public App() { // The root page of your application MainPage = new CirclePage(); StackLayout mainStack = new StackLayout { VerticalOptions = LayoutOptions.Center, }; Tizen.Applications.Application app = Tizen.Applications.Application.Current; CircleListView clView = new CircleListView(); List <string> appInfoList = new List <string>(); // ApplicationInfo appInfoList.Add("ApplicationInfo: "); appInfoList.Add("AppID: " + app.ApplicationInfo.ApplicationId); appInfoList.Add("AppType: " + app.ApplicationInfo.ApplicationType); appInfoList.Add("ExePath: " + app.ApplicationInfo.ExecutablePath); appInfoList.Add("PackageId: " + app.ApplicationInfo.IconPath); appInfoList.Add("SharedResourcePath: " + app.ApplicationInfo.SharedResourcePath); appInfoList.Add("SharedTrustedPath: " + app.ApplicationInfo.SharedTrustedPath); // DirectoryInfo appInfoList.Add("DirectoryInfo: "); appInfoList.Add("Resource: " + app.DirectoryInfo.Resource); appInfoList.Add("Cache: " + app.DirectoryInfo.Cache); appInfoList.Add("Data: " + app.DirectoryInfo.Data); appInfoList.Add("ExpansionPackageResource: " + app.DirectoryInfo.ExpansionPackageResource); appInfoList.Add("ExternalCache: " + app.DirectoryInfo.ExternalCache); appInfoList.Add("ExternalData: " + app.DirectoryInfo.ExternalData); appInfoList.Add("ExternalSharedData: " + app.DirectoryInfo.ExternalSharedData); appInfoList.Add("SharedResource: " + app.DirectoryInfo.SharedResource); appInfoList.Add("SharedTrusted: " + app.DirectoryInfo.SharedTrusted); appInfoList.Add("SharedData: " + app.DirectoryInfo.SharedData); clView.ItemsSource = appInfoList; mainStack.Children.Add(clView); ((CirclePage)MainPage).Content = mainStack; }
public ProfileActionPage(Profile profile, TeslaVehicle teslaVehicle, IProfileService profileService, ITeslaAPIWrapper teslaAPIWrapper) { NavigationPage.SetHasNavigationBar(this, false); var listView = new CircleListView { Header = UIUtil.CreateHeaderLabel(profile.Name), ItemsSource = new List <string> { "Run", "Edit", "Delete" }, }; listView.ItemTapped += async(sender, e) => { switch (e.Item) { case "Run": await Navigation.PushAsync(new ExecuteActionPage(profile, teslaVehicle, teslaAPIWrapper)); break; case "Edit": await Navigation.PushAsync(new EditProfilePage(profile, profileService)); // Remove this page. After editing the action this list should be gone. Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 2]); break; case "Delete": await profileService.DeleteProfileAsync(profile); await Navigation.PopAsync(); break; default: break; } }; Content = listView; }
public AddActionPage(Profile profile, IProfileService profileService) { NavigationPage.SetHasNavigationBar(this, false); var listView = new CircleListView { ItemsSource = VehicleActionUtils.GetUserActions().Select(a => new VehicleActionBinder(a)), ItemTemplate = new DataTemplate(() => { Label nameLabel = new Label { HeightRequest = 120, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; nameLabel.SetBinding(Label.TextProperty, "Name"); return(new ViewCell { View = new StackLayout { Children = { nameLabel, } } }); }), }; listView.ItemTapped += async(sender, e) => { var binder = (VehicleActionBinder)e.Item; await binder.Action.CustomizeOrReturn(profile, null, Navigation, profileService); }; Content = listView; }
public ProfilesPage(PageParameters pageParameters) { PageParameters = pageParameters; const string json = @"{ ""profiles"": { ""home"": { ""credentials"": { ""name"": ""home"", ""host"": ""hostname"", ""token"": ""49Vm8WRwZifK"", ""timeout"": 100 } }, ""name"": { ""credentials"": { ""name"": ""job"", ""host"": ""ipaddress"", ""token"": ""fhchfjfhjffj"", ""timeout"": 100 } } } }"; var jFile = JObject.Parse(json); var jCredentials = jFile[ProfilesNode]?.Values(); var credentials = jCredentials?.Select(jToken => jToken?[nameof(Credentials).ToLower()]?.ToObject <Credentials>()).ToList() ?? new List <Credentials>(); var cellData = (from credential in credentials let command = new Command <Credentials>(ListCellTap) select new CellData(credential.Name, credential.Host, credential.HideAddress, command, credential)) .OrderBy(data => ((Credentials)data.CommandParameter).Name).ToList(); ListView = new CircleListView { Header = new Label { FontSize = 20, FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.Default, Text = "Homes 🏘️", }, BarColor = Color.Default, ItemTemplate = new ListCellDataTemplateSelector(), ItemsSource = new ProfileListModelView(cellData).ItemCollection, }; Content = ListView; RotaryFocusObject = ListView; void ListCellTap(object commandParameter) { var editPageParameters = new PageParameters(AppPage.ProfileEdit, (Credentials)commandParameter, "", default, PageParameters.PageSwitch);
public RecordList(DateTime pCurrTime) { String date = pCurrTime.ToString("yyyy-MM-dd"); cCurrTime = pCurrTime; DataInteractionV2 di = new DataInteractionV2(); ArrayList show = di.readRec(date); PrevBtnClicked += prevClickedFunc; NextBtnClicked += nextClickedFunc; prev.Clicked += PrevBtnClicked; next.Clicked += NextBtnClicked; homeBtnClicked += homeClickedFunc; goHome.Clicked += homeBtnClicked; //尚无记录的page //CirclePage noRec = new CirclePage(); //StackLayout noRecLayout = new StackLayout() //{ // Orientation = StackOrientation.Vertical, // VerticalOptions = LayoutOptions.Center, // Children = // { // prev, // new Label(){ Text = pCurrTime.ToString("yyyy-MM-dd").Substring(5), HorizontalTextAlignment = TextAlignment.Center, FontSize=8}, // new Image(){ Source = "Empty.png", Scale = 0.5, HeightRequest=100 }, // new Label(){ Text = "今日尚无记录哦", HorizontalTextAlignment = TextAlignment.Center, FontSize = 5}, // goHome, // next, // } //}; //noRec.Content = noRecLayout; //if (show.Count == 0 || ((ArrayList)show[0]).Count == 0) //{ // Navigation.PushModalAsync(noRec); // return; //} //show.Add(); DataTemplate dt = new DataTemplate(() => { var tagLable = new Label() { FontSize = 12, HorizontalTextAlignment = TextAlignment.Center }; var detailLable = new Label() { FontSize = 9, HorizontalTextAlignment = TextAlignment.Center }; tagLable.SetBinding(Label.TextProperty, "tagDesc"); detailLable.SetBinding(Label.TextProperty, "detailDesc"); StackLayout sl = new StackLayout() { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.Center, Children = { tagLable, detailLable }, }; return(new ViewCell { View = sl }); }); DataTemplate headerTemplate = new DataTemplate(() => { var headLable = new Label() { TextColor = Color.Blue, HorizontalTextAlignment = TextAlignment.Center }; StackLayout sl = new StackLayout() { HorizontalOptions = LayoutOptions.Center, Children = { headLable }, }; return(new ViewCell() { View = sl }); }); var listGroup = new List <TagDescBind>(); ArrayList tagArray; ArrayList descArray; ArrayList detailedDescArray; ArrayList idArray; string head = " " + date.Substring(5); double sum = di.readTodaySum(date); if (show.Count == 0 || ((ArrayList)show[0]).Count == 0) { tagArray = new ArrayList(); descArray = new ArrayList(); detailedDescArray = new ArrayList(); idArray = new ArrayList(); head = head + "日尚无记录。"; } else { tagArray = (ArrayList)show[0]; descArray = (ArrayList)show[1]; detailedDescArray = (ArrayList)show[2]; idArray = (ArrayList)show[3]; if (sum >= 0) { head += ": +" + sum.ToString(); } else { head += ": " + sum.ToString(); } } for (int i = 0; i < tagArray.Count; i++) { listGroup.Add(new TagDescBind() { tagDesc = (string)tagArray[i], detailDesc = (string)descArray[i], descDesc = (string)detailedDescArray[i], id = (int)idArray[i] }); } CircleListView clv = new CircleListView() { ItemsSource = listGroup, Header = head, ItemTemplate = dt }; clv.ItemTapped += showDetails; StackLayout page = new StackLayout() { Children = { prev, clv, next } }; Content = page; }