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

Asymmetric encryption using keystore with fingerprint authentication

$
0
0

Hello,
For my project I try to create a private and public key on keystore and keychain. But I would like protect the access of the keys with fingerprint authentification.

I find a lot example to create keys. Unfortunately I can't add link in this post ..
I didn't find any example for protect my keys with authentification. Do you have some information about that ?

Moreover, I hear that it's possible on native Android to unlock key when the user unlock the smartphone (scheme, pin or fingerprint). Do you know if it's possible with Xamarin ?

Thanks for your answer ;)


How to display .gif image as launchscreen in xamarin forms ios project

$
0
0

hi all,
How to display .gif image as launchscreen in xamarin forms ios project ,i have idea in android project but i don't know how to do this in ios project
if any one have idea about this please post it here

Trigger a Picker programmatically

$
0
0

Hi there,

I have a picker as a children on my stacklayout. If i press it, the items at the picker are shown, and i can select one. So far so good.

However i want to show it without having to press it, that is, for instance if i have an option at the tabbar, and i press it, i want the picker to show.
How can i achieve this?

Thank you!

loading HTML with resources in application internal storage directory

$
0
0

My application tries to load a HTML string to webview. The HTML refers to an image file which is stored in the application internal storage directory "/data/data//files". The HTML is displayed, but a "broken link" image is displayed instead of the image. My code is like below

===============================================================================================

var myhtml = "<html> <body> <img src=\"Chrysanthemum.jpg\" alt=\"Chrysanthemum.jpg\" height=\"55\" width=\"55\" /> </body> </html>";

string baseURL = System.IO.Path.Combine("file://" + System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/");

webView.LoadDataWithBaseURL(baseURL, myhtml, "text/html", "UTF-8", null);_

===============================================================================================

If I store the file in the application "assets" folder and use "file:///android_assets/" as the baseURL, the image is displayed properly. Unfortunately my application downloads these images and cannot use them from assets folder.

Is anything wrong with this approach? Any help would be greatly appreciated.

PS. When I tried the same logic in Android native app (not Xamarin.android), the same baseURL loads the image properly.

Line Chart with OxyPlot.Xamarin.Forms show track on point tabbed

$
0
0

Hi, I'm working with a line chart with the OxyPlot.Xamarin.Forms plugin, this is the plot function:
public PlotModel GetLineChart()
{

        OnPropertyChanged("GraphModel");

        var model = new PlotModel
        {
            LegendPlacement = LegendPlacement.Outside,
            LegendPosition = LegendPosition.BottomCenter,
            LegendOrientation = LegendOrientation.Horizontal,
            LegendBorderThickness = 0
        };
        model.PlotType = PlotType.XY;
        model.InvalidatePlot(false);

        Dictionary<string, List<Prices>> values = HistoricData[Selected.ProductId];


        int colorIndex = 0;
        List<string> x_names = new List<string>();

        foreach (var item in values.Keys)
        {

            if (item.ToUpper() == Selected.ProductName) { SelectedIndex = colorIndex; }
            var lineSeries = new LineSeries()
            {
                Title = item,
                MarkerType = MarkerType.Circle,
                //TrackerFormatString = "X={2},\nY={4}",
                CanTrackerInterpolatePoints = false
                //LabelPlacement = LabelPlacement.Inside
                //LabelFormatString = "{0}"
            };
            lineSeries.MarkerResolution = 3;
            lineSeries.MarkerFill = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
            lineSeries.MarkerStroke = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
            lineSeries.MarkerSize = 3;

            var points = new List<DataPoint>();


            lineSeries.Color = OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);

            foreach (var price in values[item])
            {
                points.Add(new DataPoint(price.Week+price.Year, price.Price));           
            }

            if (ButtonsVisibility.Count == 0)
            {
                lineSeries.IsVisible = (Selected.ProductName == item.ToUpper()) ? true : false;
            }
            else
            {
                lineSeries.IsVisible = ButtonsVisibility[colorIndex];
            }


            lineSeries.ItemsSource = points;
            lineSeries.MarkerType = OxyPlot.MarkerType.Circle;


            lineSeries.TrackerFormatString = "X={2},\nY={4}";
            lineSeries.TextColor = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);

            model.Series.Add(lineSeries);
            colorIndex++;
        }

        NumButtons = colorIndex;

        LinearAxis yaxis = new LinearAxis();
        yaxis.Position = AxisPosition.Left;
        yaxis.MajorGridlineStyle = LineStyle.Dot;
        model.Axes.Add(yaxis);

        LineChart = model;
        OnPropertyChanged("GraphModel");
        return LineChart;

    }
}

Then in the LineChart.xaml.cs file:
protected async override void OnAppearing()
{
await _viewModel.LinearViewModel.GetSubCategoryHistoricWeekPrices(App.ViewModel.LoginViewModel.SesionToken, FROM_DATE, TO_DATE);

    Plot.Model = _viewModel.LinearViewModel.GetLineChart();
        PlotController controller = new PlotController();
        controller.UnbindAll();
        controller.BindTouchDown(PlotCommands.PointsOnlyTrackTouch);
        Plot.Controller = controller;

        AddButtons();
    }

My problem is that when the user taps one point of the line series, I want to display the track of that point, something like:
Track info of a point

But in my case, after a tap doesn't appear any track, I think that the problem is in the controller bindings on the OnAppearing method but I don't know which binding I should in the controller to show the track, any suggestion?

Mismatch between the processor architecture

$
0
0

Hi.
I am using Xamarin.Forms on Visual Studio 2017. I am trying to use a dll that is compiled on 64bit. When i run the app on android emulator, it has a warning of "mismatch between the processor architecture" and the app crashed on the emulator. If i disable the initialization of the said dll, app runs fine.

Is it possible to use external dll's or api's on xamarin and if yes, how can we use those properly on xamarin.

Thanks...

trying to add binding library

$
0
0

I am trying to add binding library "JiaoZiVideoPlayer" to my xamarin.android project but I am getting the following error
_invokedynamic requires --min-sdk-version >= 26 _what this means and how I can solve this issue

bellow the screen shot of my project minsdk

image

Android 8.1/9 crash reports in AwaitTaskContinuation.RunOrScheduleAction on OnePlus5 and Nokia 6.1

$
0
0

Hello, I am unable to track this crash, it seems to happen on very specific devices but it's outside my code and I believe it's xamarin related.
The exception reported is
"System.IndexOutOfRangeException: Index was outside the bounds of the array." in the "AwaitTaskContinuation.RunOrScheduleAction" method.

I'm attaching my VS infos :

Microsoft Visual Studio Professional 2017
Version 15.9.5
VisualStudio.15.Release/15.9.5+28307.280
Microsoft .NET Framework
Version 4.7.03190

Installed Version: Professional

Visual C++ 2017 00369-60000-00001-AA126
Microsoft Visual C++ 2017

ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools

Application Insights Tools for Visual Studio Package 8.14.11009.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017 15.9.04012.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services 15.8.31590
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017 5.2.60913.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 15.9.03024.0
Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.3.6000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 15.9.02046.0
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.3.6000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.1.49 (remotes/origin/d15-8@ee674f3)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events

GnD Editor Extension 1.5.2.0
GnD Editor Extension
Copyright (c) 2018 Sony Interactive Entertainment Inc. All rights reserved.

JavaScript Language Service 2.0
JavaScript Language Service

JavaScript Project System 2.0
JavaScript Project System

JavaScript UWP Project System 2.0
JavaScript UWP Project System

Microsoft Azure HDInsight Azure Node 2.3.6000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.3.6000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 2.4
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.3.6000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.10730.2

Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 1.0
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

Microsoft XNA Game Studio 4.0
Microsoft XNA Game Studio 4.0
Build 4.0.30901.0

MLGen Package Extension 1.0
MLGen Package Visual Studio Extension Detailed Info

Mono Debugging for Visual Studio 4.13.12-pre (9bc9548)
Support for debugging Mono processes with Visual Studio.

NintendoSDK Visual Studio Extension 1.0
NintendoSDK Visual Studio Extension

NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Oasis for NX 7.2.8.26511
NX Visual Studio Integration

PlayStation® Debugger 1.0.154.0
Adds debugging support for PlayStation® platforms to Visual Studio.

PlayStation® Visual Studio Integration 2.5.1.4
PlayStation® Visual Studio Integration
Copyright © 2018 Sony Interactive Entertainment Inc. All rights reserved.

PlayStation®4 Debugger 1.0
Adds debugging support for PlayStation®4 to Visual Studio

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Razor CPU 5.50.0.13
Razor Performance Analysis and Debug Tool
Copyright (C) 2018 Sony Interactive Entertainment Inc. All Rights Reserved.

ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info

ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info

SQL Server Data Tools 15.1.61901.03220
Microsoft SQL Server Data Tools

Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

ToolWindowHostedEditor 1.0
Hosting json editor into a tool window

TypeScript Tools 15.9.20918.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual C++ for Linux Development 1.0.9.28218
Visual C++ for Linux Development

Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: 6e26c5bacc8c4201e962f5bdde0a177f82f88691.
Microsoft Visual F# Tools 10.2 for F# 4.5

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

Visual Studio Tools for Universal Windows Apps 15.0.28307.208
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 4.12.3.78 (d15-9@a9bbf702f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 4.16.13 (45a16efd4)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 1.1.128 (6f5ebb2)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 9.1.5.0 (HEAD/4b951a3e7)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK 12.2.1.12 (65ec520)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

XNA Game Studio 4.0 1.0

and the complete AppCenter crash logs are attached. I put one of the raw here for helping search engines.

Package: hb.doom_and_destiny_advanced
Version Code: 18120
Version Name: 1.8.1.2
Android: 9
Android Build: PKQ1.180716.001
Manufacturer: OnePlus
Model: ONEPLUS A5000
CrashReporter Key: a14377cf-b89b-4ed7-9ead-e4413bc899aa
Date: undefined

Xamarin Exception Stack:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action action, System.Boolean allowInlining, System.Threading.Tasks.Task& currentTask) [0x00020] in :0
at System.Threading.Tasks.Task.FinishContinuations () [0x00052] in :0
at System.Threading.Tasks.Task.FinishStageThree () [0x0003c] in :0
at System.Threading.Tasks.Task1[TResult].TrySetResult (TResult result) [0x0004f] in <ab32d96ffa5647a891c44620288a35cb>:0 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[TResult].SetResult (TResult result) [0x0003d] in :0
at System.Net.WebCompletionSource`1+d__15[T].MoveNext () [0x000c5] in <8dd22d829ead48f79898d92306ca3be9>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) [0x00000] in :0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in :0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in :0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00024] in :0
at System.Threading.Tasks.AwaitTaskContinuation.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00008] in :0
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in :0
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in :0

Thread 2:
0 mono.java.lang.RunnableImplementor.n_run(RunnableImplementor.java:-2)
1 mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
2 android.os.Handler.handleCallback(Handler.java:873)
3 android.os.Handler.dispatchMessage(Handler.java:99)
4 android.os.Looper.loop(Looper.java:193)
5 android.app.ActivityThread.main(ActivityThread.java:6863)
6 java.lang.reflect.Method.invoke(Method.java:-2)
7 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
8 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Thread 9598:
0 java.lang.Object.wait(Object.java:-2)
1 java.lang.Daemons$ReferenceQueueDaemon.runInternal(Daemons.java:184)
2 java.lang.Daemons$Daemon.run(Daemons.java:109)
3 java.lang.Thread.run(Thread.java:764)

Thread 9599:
0 java.lang.Object.wait(Object.java:-2)
1 java.lang.Object.wait(Object.java:422)
2 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:188)
3 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:209)
4 java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:238)
5 java.lang.Daemons$Daemon.run(Daemons.java:109)
6 java.lang.Thread.run(Thread.java:764)

Thread 9600:
0 java.lang.Thread.sleep(Thread.java:-2)
1 java.lang.Thread.sleep(Thread.java:373)
2 java.lang.Thread.sleep(Thread.java:314)
3 java.lang.Daemons$FinalizerWatchdogDaemon.sleepFor(Daemons.java:353)
4 java.lang.Daemons$FinalizerWatchdogDaemon.waitForFinalization(Daemons.java:394)
5 java.lang.Daemons$FinalizerWatchdogDaemon.runInternal(Daemons.java:287)
6 java.lang.Daemons$Daemon.run(Daemons.java:109)
7 java.lang.Thread.run(Thread.java:764)

Thread 9612:
0 java.lang.Object.wait(Object.java:-2)
1 java.lang.Thread.parkFor$(Thread.java:2137)
2 sun.misc.Unsafe.park(Unsafe.java:358)
3 java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
4 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2059)
5 java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
6 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
7 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
8 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
9 com.google.android.gms.common.util.concurrent.zza.run
10 java.lang.Thread.run(Thread.java:764)

Thread 9615:
0 java.lang.Object.wait(Object.java:-2)
1 java.lang.Thread.parkFor$(Thread.java:2137)
2 sun.misc.Unsafe.park(Unsafe.java:358)
3 java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
4 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2059)
5 java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
6 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
7 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
8 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
9 com.google.android.gms.common.util.concurrent.zza.run
10 java.lang.Thread.run(Thread.java:764)

Thread 9616:
0 android.os.MessageQueue.nativePollOnce(MessageQueue.java:-2)
1 android.os.MessageQueue.next(MessageQueue.java:326)
2 android.os.Looper.loop(Looper.java:160)
3 android.os.HandlerThread.run(HandlerThread.java:65)

Thread 9618:
0 android.os.MessageQueue.nativePollOnce(MessageQueue.java:-2)
1 android.os.MessageQueue.next(MessageQueue.java:326)
2 android.os.Looper.loop(Looper.java:160)
3 android.os.HandlerThread.run(HandlerThread.java:65)

Thread 9619:
0 android.os.MessageQueue.nativePollOnce(MessageQueue.java:-2)
1 android.os.MessageQueue.next(MessageQueue.java:326)
2 android.os.Looper.loop(Looper.java:160)
3 android.os.HandlerThread.run(HandlerThread.java:65)

Thread 9628:
0 android.net.LocalSocketImpl.readba_native(LocalSocketImpl.java:-2)
1 android.net.LocalSocketImpl.access$300(LocalSocketImpl.java:36)
2 android.net.LocalSocketImpl$SocketInputStream.read(LocalSocketImpl.java:110)
3 com.qti.tcmclient.DpmTcmClient$TcmReceiver.run(DpmTcmClient.java:144)
4 java.lang.Thread.run(Thread.java:764)

Thread 9632:
0 java.lang.Object.wait(Object.java:-2)
1 com.android.okhttp.ConnectionPool$1.run(ConnectionPool.java:103)
2 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
3 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
4 java.lang.Thread.run(Thread.java:764)

Thread 9633:
0 java.lang.Object.wait(Object.java:-2)
1 com.android.okhttp.okio.AsyncTimeout.awaitTimeout(AsyncTimeout.java:311)
2 com.android.okhttp.okio.AsyncTimeout.access$000(AsyncTimeout.java:40)
3 com.android.okhttp.okio.AsyncTimeout$Watchdog.run(AsyncTimeout.java:286)

Thread 9640:
0 dalvik.system.VMStack.getThreadStackTrace(VMStack.java:-2)
1 java.lang.Thread.getStackTrace(Thread.java:1538)
2 java.lang.Thread.getAllStackTraces(Thread.java:1588)
3 com.microsoft.appcenter.crashes.Crashes.saveUncaughtException(Crashes.java:943)
4 com.microsoft.appcenter.crashes.WrapperSdkExceptionManager.saveWrapperException(WrapperSdkExceptionManager.java:50)


Video can not start after clicking the play button after stop button.

$
0
0

Help me.....
This is my Code.....

button = FindViewById(Resource.Id.btnplay);
button.Click += Button_Click;

        button1 = FindViewById<Button>(Resource.Id.btnstop);
        button1.Click += Button1_Click;
    }

    private void Button1_Click(object sender, System.EventArgs e)
    {
        var videoView = FindViewById<VideoView>(Resource.Id.SampleVideoView);
        videoView.StopPlayback();
    }

    private void Button_Click(object sender, System.EventArgs e)
    {
        var videoView = FindViewById<VideoView>(Resource.Id.SampleVideoView);
        videoView.Start();


    }

how to add,update and delete the item to listview using grouping. this is my code.........

$
0
0

public ObservableCollection news { get; set; }

    public MainPage()
    {
        InitializeComponent();

        news = new ObservableCollection<Listgrouping>();

        news.Add(
            new Listgrouping("A", "A")
            {
             new Data() { Name = "Aljazareen News", ShortDetail="Top_10", FullDetail="Report all the good news.", myimage="aljazeeranew.jpg"},
             new Data() { Name = "Amazing News" , ShortDetail="Good" , FullDetail="Show all of the world amazing news.", myimage="aljazeeranew.jpg"}
             });
        news.Add(
            new Listgrouping("B", "B")
            {
            new Data() { Name = "BBC News", ShortDetail="Hedline", FullDetail="Show the new news.", myimage="bbnew.png" },
             new Data() { Name = "Basic News" , ShortDetail="Short News" , FullDetail="Show the Short News Time to Time.", myimage="bbnew.jpg"}
             });
        news.Add(
            new Listgrouping("C", "C")
            {
                new Data() {Name="CIN News", ShortDetail="Ind", FullDetail="Like a cinima news.", myimage="cnimanew.jpg"},
                new Data() { Name="Code News", ShortDetail="Engnieer", FullDetail="Show all the Development Tools.", myimage="cnimanew.jpg"}
            });

}

private void Update_Clicked(object sender, EventArgs e)
{
}

Video can not start after clicking the play button after stop button.

$
0
0

Help me.......
This is My Code..................................
button = FindViewById(Resource.Id.btnplay);
button.Click += Button_Click;

        button1 = FindViewById<Button>(Resource.Id.btnstop);
        button1.Click += Button1_Click;
    }

    private void Button1_Click(object sender, System.EventArgs e)
    {
        var videoView = FindViewById<VideoView>(Resource.Id.SampleVideoView);
        videoView.StopPlayback();
    }

    private void Button_Click(object sender, System.EventArgs e)
    {
        var videoView = FindViewById<VideoView>(Resource.Id.SampleVideoView);
        videoView.Start();


    }

[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; }
    }
}

Change Button Text

$
0
0

I'm using Xamarin Forms to develop a Cross-Platform app.
I want to change the Text of the button "Start Job" to something like "Finish".
When clicking StartJob and then change to Finish Job.

Issue with committing project in Gitlab

$
0
0

I created a new xamarin forms project in Visual Studio(Not a new one, took a copy of my old project) and tried to commit the entire project to Gitlab. For that, I created a new project in Gitlab and enter the following commands.

cd project folder
git init
git remote add origin My project remote
git add .
git commit -m "Initial commit"
git push -u origin master

But when I push the new project, it gets committed to my old project. I have given the new project remote but it gets pushed to the old one(New project is a copy of old one).

Is there anyone faced this type of issue from Gitlab? Is there any file from gitlab to be saved to the old project? Why my new project commit redirect to the old one?

Are bugs going to be fixed ever in xamarin.ios storyboard designer?

$
0
0

Hi there,
there are millions of bugs, errors, half-done stuffs in the storyboard designer of xamarin.ios in VS (windows).
Menus which empty with empty submenus, or with default texts (clearly the programmer add it but never used it).
Icons with no image, which opens empty menus.
Multiple times I have to select and de-select the same controller to see the properties.
In one project it can see the images and show them in drop-down (for example for buttons), in other project it asks me to add the image. When I add the image, it ask again to add the image, and again...and again...but the image never added.
Constantly complaining because the storyboard is not saved (even straight after I saved it, or didn't even opened to change it)
Constrains set, and automatically unset within seconds. To change or set more then two constrains I have to set one, save, close and re-open the designer and set one again...etc.
It just change properties over sometimes randomly when I open it, or just clear the name of a controller randomly.
I need sometimes 10-15 mins to change the name of a simple UIImage box because it doesn't want to save it. I have to do it 4-5x times when once it gets saved.
I like Xamarin but that designer is the most bug-full software what I ever seen in my career.
I can't even get how a company can release something what is clearly not even in beta version.
So my question is that, is it going to be fixed, or at least fully finished ever ?


Reproduce carousel view behaviour/animation/transition to a horizontal scroll view.

$
0
0

Hey developers,
I have so far tried to use a carousel view due to its ease of use and of course its performance. But I tried to show the tail of each UI elements (let's say we've a bunch of cards) whatever the position is as shown in the picture. I've googled a lot and posted another question in this forum but since then I changed the project UI a little bit so I ignored the given solution and now I am on my own again, I resolved it (show the next card's tail or/and the previous), I'll write down the structure I used in XAML but first let me highlight my requirements.
I want to reproduce the behaviour, animation/transition on swiping of the carousel view to my view, because I am actually using a horizontal scroll view with a Flex layout inside.
Here is the structure :

Now I've tried two options :
1- Use of Scrolled event in the scroll view but that hasn't been a great option because it fire the events (animation or transition) after the scroll is done, in my case it should fire the event since scrolling started.
2- Use of SwipeGestureRecognizer on Scrollview, FlexLayout and BoxView : couldn't get a stable behaviour on the 2 first attempts but when I used a BoxView I couldn't get each StackLayout (the StackLayout is my card) inside the BoxView (It wasn't built for that).

Here is my UI after I used a horizontal scroll view :

here is the behaviour I wanted to reproduce to my view :
https://media.giphy.com/media/l0NwH3XDSYhQ6l4TC/giphy.gif

Issue in Xamarin Forms Carousel view in Android

$
0
0

Hi, I am trying to implement a carousel view in Xamarin.Forms. It is working fine on IOS but on Android I am getting an exception :
System.DivideByZeroException: Attempted to divide by zero.
I am stuck in this please suggest how can I resolve this.

xmlns:cv="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.CarouselView"

<cv:CarouselView ItemsSource="{Binding Event.EventImages}" Position="{Binding Position, Mode=TwoWay}" Margin="15,0,15,0" HeightRequest="240" HorizontalOptions="FillAndExpand"> <cv:CarouselView.ItemTemplate> <DataTemplate> <ff:CachedImage x:Name="BannerImage" HorizontalOptions="FillAndExpand" DownsampleUseDipUnits="True" DownsampleHeight="240" DownsampleWidth="240" Aspect="{Binding ImageAspect}" DownsampleToViewSize="True" LoadingPlaceholder="bigloadinggif.gif" Source="{Binding ImageURL}"> <ff:CachedImage.GestureRecognizers> <TapGestureRecognizer Tapped="Image_Tapped" NumberOfTapsRequired="1"/> </ff:CachedImage.GestureRecognizers> </ff:CachedImage> </DataTemplate> </cv:CarouselView.ItemTemplate> </cv:CarouselView>

I am unable to set the particular page in Carousel view

$
0
0

Hi, I am implemented the Carousel view using https://blog.xamarin.com/flip-through-items-with-xamarin-forms-carouselview/. And I am able to implement the Carousel,
**But My Problem I want to set the startup page while opening (I mean when page is loaded the carousel view should show 5th page or 4th index) **

Plugin Used
Xamarin.Forms.CarouselView (2.3.0-pre2)

What I tried
Case 1: I have used Data binding in xaml but it always showing first page or index of zero

Case 2: I have used Data binding from .cs file like CarouselView.ItemSource= Images; and CarouselView.Position=5; but is giving unhandled exception i.e, System.DivideByZeroException: Attempted to divide by zero.

Here is the Sample code

Case 1:

            <cv:CarouselView Position="{Binding Position, Mode=TwoWay}" ItemSelected="CarouselAlbumItems_ItemSelected" ItemsSource="{Binding AlbumItems}" x:Name="CarouselAlbumItems">
                <cv:CarouselView.ItemTemplate>
                    <DataTemplate>
                        <Grid  VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Image x:Name="imgAlbumItemName" Grid.RowSpan="2" Aspect="AspectFit" IsVisible="{Binding IsImage}" >
                                <Image.Source>
                                    <UriImageSource Uri="{Binding AlbumItemPath}" CacheValidity="14" />
                                </Image.Source>
                            </Image>
                        </Grid>
                    </DataTemplate>
                </cv:CarouselView.ItemTemplate>
            </cv:CarouselView>

Case 2:

    protected  override void OnAppearing()
    {
        base.OnAppearing();
        CarouselAlbumItems.ItemsSource = selectedItem.AlbumItems;
        CarouselAlbumItems.Position = position;            
    }

Can I keep a ListView Header in a fixed position?

$
0
0

Is there a way to force the ListView header to remain fixed at the top of the screen? On my Android emulator, its scrolling off the page.

How to download a file from url

$
0
0

Hi,
I need to download a file from url but I cannot do that, How can I?

Viewing all 204402 articles
Browse latest View live


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