Esempio n. 1
0
        public ProfileEditPage(PageParameters pageParameters)
        {
            var profileEditView = new StackLayout
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Children          = { new Label {
                                          HorizontalTextAlignment = TextAlignment.Center, Text = "v4 ok - v5.5 NOT ok"
                                      } }
            };

            var profileEditViewScroll = new CircleScrollView {
                Content = profileEditView
            };

            Content = profileEditViewScroll;
        }
        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);