Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

Label visibility true when entry text property is not empty

$
0
0

Hello Guy's

      I have a create application but i am facing a issue.
      I want to label visibility true when entry text property is not empty and when entry text property not empty then label visibility false.
      I want to do this thing only Xaml page not Cs. page.

         <StackLayout  Grid.Row="1" Orientation="Vertical" BackgroundColor="Transparent" Spacing="10">
                <Label x:Name="lblUserName" Text="User ID" FontSize="Medium" TextColor="White" />
               <Entry x:Name="enrtyUserName" Placeholder="User ID" FontSize="Medium" PlaceholderColor="Gray" BackgroundColor="White" />
        </StackLayout>

Is it possible in xaml coding use like value converter or triggers.

Thanks in advance


Issue reported while submitting windows app to windows store

$
0
0

I have developed a Xamarin Forms(.Net standard) UWP app and submitted it to windows store, but the windows store team reject the app because of the following issue.

The app doesn’t install on one or more of the currently selected device families due to an unsupported minimum OS version. If the affected device family is not intended to be targeted, then please de-select the unsupported device family and resubmit the app. Otherwise, please change the minimum and/or target OS version that the app supports (https://docs.microsoft.com/en-us/windows/uwp/updates-and-versions/choose-a-uwp-version#choose-which-version-to-use-for-your-app)

My apps min and target versions are Windows 10 Fall Creators Update(10.0; Build 16299). I am targetting my app only for windows 10 desktop devices and Windows 10 mobile devices. So what is the correct min and target versions for my app?

Xamarin Android app crash in Release mode using Parse SDK

$
0
0

I have a Xamarin Forms PCL app that works fine in DEBUG mode but when I change it to RELEASE mode and deploy to device it crashes while instantiating the ParseClient object.
If I change the linker to 'Don't link' it works fine but the apk is too large (40MB), so I am guessing the linker is stripping out something that the app is needing in RELEASE mode.

Anyone has run into this issue?

apk from Xamarin.Forms keeps crashing

$
0
0

Hi All,

Unfortunately when I load my apk onto a physical device, it crashes immediately. I have been playing around trying to figure out what is happening, and here are my observations:

1) If I set linking to 'none', it works. So clearly the problem has to do with the linking. However, this is clearly not a viable solution.

2) In debug mode, if I enable proguard and turn linking on, the app still works fine.

3) If I make a new blank Xamarin.Forms app, then follow the instructions to release the apk for Android, the same problem occurs (the app immediately crashes).

4) If I make a blank Xamarin.Android app, then follow the instructions, the apk works fine.

It is very difficult to troubleshoot without knowing why the App is crashing. Do you have any suggestions as to what is occurring, or how I can get a log file on my physical device to understand why the Xamarin.Forms version of the Android apk fails, when the Xamarin.Android version works fine?

Thanks,

Dustin

Image button showing Unhandled exception error.

$
0
0

Hi,

I am new to xamarin android . i am using image button . it is showing "Unhandled exception Error" message. Error Message is

**Unhandled Exception:

System.NullReferenceException: Object reference not set to an instance of an object. occurred**

My code is:

  <ImageButton
   android:id="@+id/button1"
   android:src="@drawable/testbutton"
   android:layout_width="225dp"
   android:layout_height="225dp"
   android:layout_below="@+id/testbtn"
   android:layout_marginTop="40dp"
   android:background="#dbe8ff"
   android:layout_centerHorizontal="true" />

   ImageButton button2 = FindViewById<ImageButton>(Resource.Id.button1);
   button2.Click += Button2_Click;

Please help me to resolve this.

Visual Studio 2017 Pro - 15.9.6 + Xamarin

$
0
0

Hello, I am using visual studio 2017 Pro(15.9.6) with Xamarin .UITest (2.2.4), NUnit 2.6.4, NunitAdapter (2.1.1)- As virtual Android, I am using Genymotion Google Nexus 6. Visual studio 2017 find Genymotion without any problems.
Xamarin.UITest created by default the project TestApp. TestApp can connect to my Android Virutal Genymotion, and start automatically TestApp(no problem for now). I then created some UnitTests, that are in Tests.cs in another project, as explained in the manual of Xamarin.
Now my problem is that when I try to RUN my unitTest via Test Explorer, there is no connection to my Genymotion Android(as well i tried different Android simulators from VS) and get always error: No devices connected.
I also tried to run my Unitest, using the RUN function from VS, but it stop as MainActivity.cs, meaning the TestApp happear on my virtual android, and nothing go forward. I can see that my unitTests are totally ignored.

1 year ago, I had already the same setup and all was working. I think was Visual studio 2015, if i can remember correctly.

What do you think about this problem?

How to add images taken from camera to a Listview?

$
0
0

Hi everyone,
I would like to add images to a Listview?(or other layout) after each image is taken by the camera, something similar to the image above. How would I approach this?
I was be able to follow this example code from James MediaPlugin

Animate button when pushed by entry set to visible?

$
0
0

I have a button that is centered, and when a entry is set to visible - the button is pushed sideways. Right now the motion happens to quickly - is there anyway I can slow the motion down?


Animated image for button Highlighted ?

$
0
0

hello,

is this possible to set animated image for button Highlighted ?

thanks

Master-Detail Hamburger iOS vs. Android

$
0
0

I have built a Master/Detail page with a menu. It works beautifully in Android, giving me an animated hamburger. But in iOS the hamburger becomes the word menu and only appears on one screen. Have you run into this? Is this a known and/or fixable problem?

I have followed the approach shown here.

Thanks

Resize View on content changed

$
0
0

I have the following situation:

On my xaml page I have a setup that looks like this:

Open Bracket ScrollView Close Bracket
Open Bracket local:MyView x:Name="Test" BackgroundColor="White" BackgroundImageFilePath="{Binding BackgroundAttachment.LocalAttachmentFilePath}"
StrokeColor="{Binding StrokeColor}" StrokeWidth="{Binding StrokeWidth}"/ Close Bracket
Open Bracket /ScrollView Close Bracket

This is, roughly, supposed to be a drawing pad. the user can set a background image and then draw all over it.

It has a Renderer, which contains these fields:

    ImageView imageView;
    Canvas sketchCanvas;
    Bitmap backgroundBmp; 

It has an OnElementChanged which does roughly:

protected override void OnElementChanged(ElementChangedEventArgs<SketchPadView> e)
        {
            base.OnElementChanged(e);
            if (Control == null && e.NewElement != null)
            {

                imageView = new Android.Widget.ImageView(Forms.Context);
                //imageView.SetMinimumHeight(2300);
                //imageView.SetMinimumWidth(2300);
                SetNativeControl(imageView);                
            }
            if(e.OldElement != null)
            {
                e.NewElement.SketchBytesRequested -= OnSketchBytesRequested;                
            }
            if (e.NewElement != null)
            {
                e.NewElement.SketchBytesRequested += OnSketchBytesRequested;
                Element.Reset = () => Reset();
                Element.Redo = () => Redo();
                Element.Undo = () => Undo();                
            }
        }

and then there are other methods that set sketchCanvas and backgroundBmp into imageView.

The problem comes when zooming.

I'm doing:

private void RescaleImage(float newParentScaling)
        {
            float oldParentScaling = ParentScaling;
            float removeOldParentScaling = 1 / oldParentScaling;
            ParentScaling = newParentScaling;
            sketchCanvas.Scale(removeOldParentScaling, removeOldParentScaling);
            sketchCanvas.Scale(newParentScaling, newParentScaling);
            foreach (var pInfo in sketchPathInfos)
            {
                Matrix m = new Matrix();
                m.SetScale(removeOldParentScaling, removeOldParentScaling);
                pInfo.Path.Transform(m);
                m.SetScale(newParentScaling, newParentScaling);
                pInfo.Path.Transform(m);
            }
        }

Which works well enough for handling the sketchCanvas, and backgroundBmp is also taken care of. But the imageView size doesn't change. I can give it a height/width in its constructor (up in onElementChanged), and if I make them very big there then my scrollView (all the way at the top in the xamarin page) dutifully lets me scroll up and down it. But most of it starts out as empty. That is, I can scroll around a big empty imageView with a small sketchCanvas up there in the corner.

What i'd like to do is change the size of my imageView along with my sketchCanvas, such that the scrollView would show a scrollbar when imageView got big, and not do so when it was small. In a perfect world it would also start out the same size as the scrollView, a la 'FillAndExpand' behavior.

But the only thing I can seem to set on the imageView is the minimumHeight/minimumWidth parameters, and while those affect the ScrollView if I set them at the beginning, they don't seem to do so if I set them at the end of my RescaleImage function. Is there a way to set the imageView's height/width, or in other ways resize it, such that I can have MyView grow and shrink with its content, with the user scrolling about in the scrollView when it is too large?

image button in xaml

$
0
0

how can I create an image button in xaml. all platforms have an image button but I cant create one in xaml. why?

How to increase the distance between keyboard and editor

$
0
0

I need to increase the distance between the soft-keyboard and the editor in the UI. Currently, the keyboard overlaps the editor bottom part.

Screenshot adding below:

I try margin, padding and spacing but no change when the keyboard is on.

Is there any solution for this?

Image Button

$
0
0

How to build image button in Xamarin form ? thanks

Xamarin.iOS & Xamarin.Android Developer Experience

$
0
0

Hi All,

I've been playing with Xamarin.Forms and as a newcomer to the framework / tooling I've not been having a great experience being honest. XAML previewer not really working and randomly crashing, a few builds just not building then next try working, auto complete not working until I restart VS for my own XAML controls etc, all which has lowered my confidence of using Xamarin.

I know I'm not alone reading the forums and so on but also I know a lot of people make great apps with Xamarin and I love C# and the ecosystem so am investigating the possibility of using Xamarin.iOS and Xamarin.Android instead of Xamarin.Forms.

I have a base knowledge of native iOS app dev, Swift, Xcode etc so I can (for example) use Xcode to create a ToDo list type app just fine and am thinking Xamarin.iOS might be a better route for me to start with? Later on I can add an Android UI when I come up to speed with the basics of Android native dev and code share the business logic etc?

I wanted to ask what the experience is like generally for people using Xamarin.iOS and Xamarin.Android nowadays vs Forms? Are things generally better / less buggy do you feel? If I'm reading the wind right people generally have a better time with Xamarin.iOS & Xamarin.Android. Please be gentle if that's not the case lol

Hoping to find a way forward, appreciate any thoughts, cheers all!


Issue with Creating Card Connect SDK Xamarin binding Library for iOS

$
0
0

I created a Xamarin Binding Library project to map the card connect sdk for ios and was successful in it. But when I try to create a sample project to test the function its giving me the following error.

Could not create an native instance of the type 'CardConnect.CCCPaymentRequest': the native class hasn't been loaded. It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.

You can find the Objective C & Swift sample and documentation in the link below https://developer.cardconnect.com/mobile-sdks#iOS

Also I am trying to bind an Objective C framework library

Windows 10 entreprise, Visual studio 2017 Pro(15.9.6)+ Xamarin UITest

$
0
0

Hello, I am using visual studio 2017 Pro(15.9.6) with Xamarin .UITest (2.2.4), NUnit 2.6.4, NunitAdapter (2.1.1)- As virtual Android, I am using Genymotion Google Nexus 6(api 25). Visual studio 2017 find Genymotion without any problems.
Xamarin.UITest created by default the project TestApp. TestApp can connect to my Android Virutal Genymotion, and start automatically TestApp(no problem for now). I then created some UnitTests, that are in Tests.cs in another project, as explained in the manual of Xamarin.
Now my problem is that when I try to RUN my unitTest via Test Explorer, there is no connection to my Genymotion Android(as well i tried different Android simulators from VS) and get always error: No devices connected.
I also tried to run my Unitest, using the RUN function from VS, but it stop as MainActivity.cs, meaning the TestApp happear on my virtual android, and nothing go forward. I can see that my unitTests are totally ignored.

1 year ago, I had already the same setup and all was working. I think was Visual studio 2015, if i can remember correctly.

[XAMARIN FORMS] problem of the link between my xaml view (with a picker) and the viewmodel

$
0
0

Hello everyone,

I have a small problem, I explain myself:

here's what I did, I have a page with buttons (with different values) and a picker (see xaml code), when the user clicks on a button, normally the picker selection list proposes things that are linked to the value of my button through lists (see my view model code). Except it doesn't work!

In my opinion it is because of the static type that is on some of my lists and methods. So my picker which has a binding on one of my lists does not display my selection because it cannot access my list because it is in static and not a constructor (in which I call the element of my binding).

Do you have a solution for me?

If you can't understand me, don't hesitate to ask me questions?

you will find the different files with my code below.

Sincerely
Camille

xaml code :

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="PolQual.Views.StatementReferencielPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:PolQual.Views"
    xmlns:viewModels="clr-namespace:PolQual.ViewModels;assembly=PolQual"
    Title="Accueil">

    <ContentPage.BindingContext>
        <viewModels:StatementReferencielPageModel />
    </ContentPage.BindingContext>

    <ContentPage.Content>

        <StackLayout>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="10*" />
                    <RowDefinition Height="15*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100*" />
                </Grid.ColumnDefinitions>

                <Label
                    Grid.Row="0"
                    Grid.Column="0"
                    FontSize="25"
                    HorizontalOptions="Center"
                    Text="Information sur le relevé référenciel" />

            </Grid>

            <ScrollView>
                <Grid x:Name="gridLayout" />
            </ScrollView>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="8*" />
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="5*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="1*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="25*" />
                    <ColumnDefinition Width="50*" />
                    <ColumnDefinition Width="25*" />
                </Grid.ColumnDefinitions>

                <Label
                    Grid.Row="1"
                    Grid.Column="1"
                    FontSize="15"
                    Text="Veuillez sélectioner le secteur :" />

                <Picker
                    x:Name="PickerSectorsLists"
                    Title="Sélectionner votre secteur"
                    Grid.Row="2"
                    Grid.Column="1"
                    ItemDisplayBinding="{Binding Value}"
                    ItemsSource="{Binding SectorsFindLists}"
                    SelectedItem="{Binding SelectedSector}" />

                <Label
                    Grid.Row="4"
                    Grid.Column="1"
                    FontSize="15"
                    Text="{Binding ShowHouseholdTrash}" />

                <Switch
                    x:Name="SwitchHousehodTrash"
                    Grid.Row="5"
                    Grid.Column="1"
                    HorizontalOptions="Start"
                    IsToggled="{Binding HouseholdTrash}" />

                <Label
                    Grid.Row="6"
                    Grid.Column="1"
                    FontSize="15"
                    Text="{Binding ShowBoxboard}" />

                <Switch
                    x:Name="SwitchBoxboard"
                    Grid.Row="7"
                    Grid.Column="1"
                    HorizontalOptions="Start"
                    IsToggled="{Binding Boxboard}" />

                <Label
                    Grid.Row="8"
                    Grid.Column="1"
                    FontSize="15"
                    Text="{Binding ShowGlass}" />

                <Switch
                    x:Name="SwitchGlass"
                    Grid.Row="9"
                    Grid.Column="1"
                    HorizontalOptions="Start"
                    IsToggled="{Binding Glass}" />

                <Button
                    Grid.Row="11"
                    Grid.Column="1"
                    BackgroundColor="#2196f3"
                    Clicked="GoToAssesmentGrid"
                    FontSize="20"
                    Text="Valider les informations"
                    TextColor="White" />

            </Grid>

        </StackLayout>

    </ContentPage.Content>
</ContentPage>

Behind code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using PolQual.ViewModels;

namespace PolQual.Views
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class StatementReferencielPage : ContentPage
    {
        public StatementReferencielPage()
        {
            InitializeComponent ();
            BindingContext = new StatementReferencielPageModel();
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            //collmun
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(25, GridUnitType.Star) });
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50, GridUnitType.Star) });
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(25, GridUnitType.Star) });

            var PolesListsIndex = 0;

            for (int columnIndex = 1; columnIndex < 2; columnIndex++)
            {
                for (int rowIndex = 0; rowIndex < 7; rowIndex++)
                {
                    if (PolesListsIndex >= StatementReferencielPageModel.PolesLists.Count<Pole>())
                    {
                        return;
                    }
                    var poles = StatementReferencielPageModel.PolesLists[PolesListsIndex];
                    PolesListsIndex += 1;

                    var button = new Button()
                    {                   
                        Text = poles.Name,
                        BackgroundColor = Color.FromHex(poles.Color),
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions = LayoutOptions.Center,
                        WidthRequest = 280,
                    };
                    string request = StatementReferencielPageModel.PolesLists[rowIndex].Name;
                    button.Clicked += delegate { MaFunction(request); };// anonymous method
                    gridLayout.Children.Add(button, columnIndex, rowIndex);  

                }
            }
        }

        public static void MaFunction(string polename)
        {
           StatementReferencielPageModel.FindPoleName(polename);
        }

        public void GoToAssesmentGrid(object sender, System.EventArgs e)
        {
            if (PickerSectorsLists.SelectedIndex == -1) 
            {
                DisplayAlert("Erreur de saisie", "Veuillez séléctioner un secteur svp! ", "D'accord");
            }
            else
            {
                var page = new AssesmentGridPage();
                Navigation.PushAsync(page);
            }
         }
    }
}

view Model code :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using Xamarin.Forms;
using PolQual.Views;

namespace PolQual.ViewModels
{
    public class StatementReferencielPageModel : INotifyPropertyChanged
    {
        private static List<Sector> _sectorsLists;
        public static List<Sector> SectorsLists { get => _sectorsLists; set => _sectorsLists = value; }

        private readonly List<Sector> sectorsFindLists;
        private static List<Sector> _sectorsFindLists;
        public static List<Sector> SectorsFindLists { get => _sectorsFindLists; set => _sectorsFindLists = value; }

        private static List<Pole> _polesLists;
        public static List<Pole> PolesLists { get => _polesLists; set => _polesLists = value; }

        public event PropertyChangedEventHandler PropertyChanged;

        public void OnPropertyChanged([CallerMemberName] string propertyname = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyname));
        }

        private bool _boxboard { get; set; }
        public bool Boxboard
        {
            get { return _boxboard; }
            set
            {
                _boxboard = value;
                OnPropertyChanged();
                OnPropertyChanged(nameof(ShowBoxboard));
            }
        }

        private bool _glass { get; set; }
        public bool Glass
        {
            get { return _glass; }
            set
            {
                _glass = value;
                OnPropertyChanged();
                OnPropertyChanged(nameof(ShowGlass));
            }
        }

        private bool _householdTrash { get; set; }
        public bool HouseholdTrash
        {
            get { return _householdTrash; }
            set
            {
                _householdTrash = value;
                OnPropertyChanged();
                OnPropertyChanged(nameof(ShowHouseholdTrash));
            }
        }

        private Sector _selectedSector { get; set; }
        public Sector SelectedSector
        {
            get { return _selectedSector; }
            set
            {
                if (_selectedSector != value)
                {
                    _selectedSector = value;
                    // que faire quand l'élèment est sélectionné !
                }
            }
        }

        public StatementReferencielPageModel()
        {
            SectorsLists = GetSectors().OrderBy(t => t.Key).ToList();
            SectorsFindLists = GetSectors().OrderBy(t => t.Key).ToList();
            PolesLists = GetPoles().OrderBy(t => t.Key).ToList();
        }

        public List<Sector> GetSectors()
        {
            var Sectors = new List<Sector>()
            {
                //Erdre et cens
                new Sector() { Key = 0, Value = "Sautron", PoleName="Erdre et cens" },
                new Sector() { Key = 1, Value = "Orvault", PoleName="Erdre et cens" },
                new Sector() { Key = 2, Value = "Nantes Nord", PoleName="Erdre et cens" },
                new Sector() { Key = 3, Value = "La-Chapelle-Sur-Erdre", PoleName="Erdre et cens" },
                // Erdre et Loire
                new Sector() { Key = 4, Value = "Mauves-Sur-Loire", PoleName="Erdre et Loire" },
                new Sector() { Key = 5, Value = "Carquefou", PoleName="Erdre et Loire" },
                new Sector() { Key = 6, Value = "Thouré sur Loire", PoleName="Erdre et Loire" },
                new Sector() { Key = 7, Value = "Sainte Luce sur Loire", PoleName="Erdre et Loire" },
                new Sector() { Key = 8, Value = "Nantes Erdre", PoleName="Erdre et Loire" },
                new Sector() { Key = 9, Value = "Doulon", PoleName="Erdre et Loire" },
                //Loire-Sèvre et Vignoble
                new Sector() { Key = 10, Value = "Rezé", PoleName="Loire-Sèvre et Vignoble" },
                new Sector() { Key = 11, Value = "Les Sornières", PoleName="Loire-Sèvre et Vignoble" },
                new Sector() { Key = 12, Value = "Vertou", PoleName="Loire-Sèvre et Vignoble" },
                new Sector() { Key = 13, Value = "Saint Sébastien sur Loire", PoleName="Loire-Sèvre et Vignoble" },
                new Sector() { Key = 14, Value = "Base Goulaine", PoleName="Loire-Sèvre et Vignoble" },
                new Sector() { Key = 15, Value = "Nantes sud", PoleName="Loire-Sèvre et Vignoble" },
                //Sud-Ouest
                new Sector() { Key = 16, Value = "Bouchenais", PoleName="Sud-Ouest" },
                new Sector() { Key = 17, Value = "Saint-Aignan-Grandlieu", PoleName="Sud-Ouest" },
                new Sector() { Key = 18, Value = "Bouaye", PoleName="Sud-Ouest" },
                new Sector() { Key = 19, Value = "Saint-Leger-Les-Vignes", PoleName="Sud-Ouest" },
                new Sector() { Key = 20, Value = "Brains", PoleName="Sud-Ouest" },
                new Sector() { Key = 21, Value = "La-Montagne", PoleName="Sud-Ouest" },
                new Sector() { Key = 22, Value = "Saint-Jean-De-Boiseau", PoleName="Sud-Ouest" },
                new Sector() { Key = 23, Value = "Le Pellerin", PoleName="Sud-Ouest" },
                //Loire-Chézine
                new Sector() { Key = 24, Value = "Couëron", PoleName="Loire-Chézine" },
                new Sector() { Key = 25, Value = "Saint-Herblain", PoleName="Loire-Chézine" },
                new Sector() { Key = 26, Value = "Indre", PoleName="Loire-Chézine" },
                //Nantes-Ouest
                new Sector() { Key = 27, Value = "Bellevue-Chantenay-Sainte-Anne", PoleName="Nantes-Ouest" },
                new Sector() { Key = 28, Value = "Dervallière-Zola", PoleName="Nantes-Ouest" },
                new Sector() { Key = 29, Value = "Breil-Barberie", PoleName="Nantes-Ouest" },
                new Sector() { Key = 30, Value = "Hauts Pavés Saint Félix", PoleName="Nantes-Ouest" },
                //Nantes-Loire
                new Sector() { Key = 31, Value = "Malakof-Saint-Donatien", PoleName="Nantes-Loire" },
                new Sector() { Key = 32, Value = "Centre Ville", PoleName="Nantes-Loire" },
                new Sector() { Key = 33, Value = "île de Nantes", PoleName="Nantes-Loire" },

            };
            return Sectors;
        }

        public List<Pole> GetPoles()
        {
            var Poles = new List<Pole>()
            {
                new Pole { Key = 1, Name = "Erdre et Cens", Color = "ffccd5"},
                new Pole { Key = 2, Name = "Erdre et Loire", Color = "ff4d4d"},
                new Pole { Key = 3, Name = "Loire-Sèvre et vignoble", Color = "ff9933"},
                new Pole { Key = 4, Name = "Sud-Ouest", Color = "bfbfbf"},
                new Pole { Key = 5, Name = "Loire-chézine", Color = "ffff4d"},
                new Pole { Key = 6, Name = "Nantes-Ouest", Color = "3385ff"},
                new Pole { Key = 7, Name = "Nantes-Loire", Color = "53c653"},
            };
            return Poles;
        }

        public static void FindPoleName(string polename)
        {
            for (int search = 0; search < SectorsLists.Count(); search++)
            {
                if (SectorsLists[search].PoleName == polename)
                {
                    SectorsFindLists.Add(new Sector() {Key = search, Value = SectorsLists[search].Value, PoleName = polename });
                }
            }
        }

        public string ShowBoxboard
        {
            get
            {
                return $"{(_boxboard ? "Jour de collecte des cartons : oui " : "Jour de collecte des cartons : non")}";
            }
        }

        public string ShowGlass
        {
            get
            {
                return $"{(_glass ? "Jour de collecte du verre : oui " : "Jour de collecte du verre : non")}";
            }
        }

        public string ShowHouseholdTrash
        {
            get
            {
                return $"{(_householdTrash ? "Jour de collecte des Ordure ménagère : oui " : "Jour de collecte des Ordure ménagère : non")}";
            }
        }
    }

    public class Sector
    {
        private int _key;
        public int Key { get => _key; set => _key = value; }

        private string _value;
        public string Value { get => _value; set => _value = value; }

        private string _poleName;
        public string PoleName { get => _poleName; set => _poleName = value; }
    }

    public class Pole
    {
        private int _key;
        public int Key { get => _key; set => _key = value; }

        private string _color;
        public string Color { get => _color; set => _color = value; }

        private string _name;
        public string Name { get => _name; set => _name = value; }
    }
}

How can I pass a ViewCell into custom control?

$
0
0

I'm making a custom control and how can I pass other View into it?

In my case I want to pass in a custom ViewCell to my custom ListView so I could re-use this custom control with different item sources and their proper ViewCells:

<ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="Foobar.Base.Views.LazyListView">
    <ContentView.Content>
        <StackLayout>
            <Label Text ="Custom ListView"></Label>
            <CustomListView ItemsSource="{Binding Items}">
                <CustomListView .ItemTemplate>
                   ** <!--Render a custom ViewCell that was passed in to the custom control-->**
                </CustomListView.ItemTemplate>
            </CustomListView >
        </StackLayout>
    </ContentView.Content>
</ContentView>

Should I use something like x:Arguments for it?

HttpClient - request timed out (happens on iOS only)

$
0
0

Hi,

I have an issue regarding requesting data from a web service, when I execute a http request that takes longer than 60 seconds I get the following request timed out error:

(Replaced web service url with {URL})

System.Net.WebException: The request timed out. ---> Foundation.NSErrorException: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x28088d560 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask .<9>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask .<9>"
), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey={URL}, NSErrorFailingURLKey={URL}, _kCFStreamErrorDomainKey=4}
--- End of inner exception stack trace ---
at System.Net.Http.NSUrlSessionHandler+d__29.MoveNext () [0x001c3] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/src/Foundation/NSUrlSessionHandler.cs:202
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Http.HttpClient+d__48.MoveNext () [0x00080] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:276

I tried setting timeout to InfiniteTimeSpan but this seems to be ignored..

Also I tried setting the NSUrlSessionConfiguration to:
NSUrlSessionConfiguration.DefaultSessionConfiguration.TimeoutIntervalForRequest = 90.0;
NSUrlSessionConfiguration.DefaultSessionConfiguration.TimeoutIntervalForResource = 90.0;
But this also seems to be ignored.

I am using only once instance of the HttpClient across the application.

All requests that are taking less that 60 seconds are working great.

I am hoping to find a solution.

Best regards,

Bas

Viewing all 204402 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>