Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 79144 articles
Browse latest View live

How to print

$
0
0
I have decided to migrate an existing WinForm application to XF.

It’s basically a very simple invoicing software for a shop and I was really excited about the performance when I started the project and managed to create iOS, Android, UWP, WPF and macOS all using the same code base (98% of the code is shared)

My project is a shared project (NOT PCL) and all I want to be able to do now is to print the invoices (not necessarily silently like POS)

I have to say that I am baffled that I can’t find a single working example after spending 12 hours on it...

I had been thinking using Shared Code would be giving me more flexibility to access native functions thanks to the #if #endif compiler directives but now I have minimised my expectations and will be the happiest man alive if I can at least print an invoice in the UWP/WPF only ...

I decided to create a PDF first to make things easier and consistent in terms of invoicing layout and even that was a big issue (using iTextSharp failed) so I ended up posting data to a WebService and then leaving PDF generation to the backend

Now, my question is how can I print that PDF using the device’s installed printer? (For now only in UWP/WPF and if I succeed I will be looking for other platforms)

Current Release: Xamarin.Forms 4.3.0

$
0
0

We have officially released Xamarin.Forms 4.3.0 stable.

Release Notes

Highlights

  • CollectionView: Vertical, Horizontal, Grid, Custom. No more ViewCell wrapping.
  • CarouselView: based on the same foundation as CollectionView. AND join our challenge to get some swag!
  • HTML content type support for Label
  • Character spacing
  • Label padding
  • Entry clear button mode
  • ListView scrolled event
  • Display prompts (take entry on an alert modal)
  • Source link support
  • Android Support 28.0.0.3
  • Shell support for UWP (Preview)
  • And lots more!

We hope you enjoy taking advantage of all these new features. Should you encounter any issues, please file them on GitHub.

How to Attach Tapped event to a Custom control?

$
0
0

Hi,

I have a custom control with two images and one Label

I am setting the Label text with no issue using BindableProperty

But now how can I have a Tapped event for every image in the custom control?

Let's say MyImageLogo and MyImageClose as names

Here is my custom control XAML:

<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:d="http://xamarin.com/schemas/2014/forms/design"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:SyncfusionBorder="clr-namespace:Syncfusion.XForms.Border;assembly=Syncfusion.Core.XForms"
    mc:Ignorable="d"
    x:Class="Zeera.Controls.NavigationHeader">
    <Grid x:Name="GridNavigationHeader" ColumnSpacing="0" RowSpacing="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <SyncfusionBorder:SfBorder Grid.Column="0" BorderColor="Black" HorizontalOptions="Center" VerticalOptions="Center" CornerRadius="25">
                <Image Source="logo.png" WidthRequest="35" HeightRequest="35">
                    <Image.GestureRecognizers>
                        <TapGestureRecognizer NumberOfTapsRequired="1" />
                    </Image.GestureRecognizers>
                </Image>
            </SyncfusionBorder:SfBorder>

            <Label x:Name="LabelNavigationHeader" Grid.Column="1" Text="Country" TextColor="{DynamicResource NavBarSystemTextColor}" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalOptions="Center" />

            <Image Grid.Column="2" Source="Close.png" Margin="10" WidthRequest="35" HeightRequest="35" HorizontalOptions="End" VerticalOptions="Center">
                <Image.GestureRecognizers>
                    <TapGestureRecognizer NumberOfTapsRequired="1" />
                </Image.GestureRecognizers>
            </Image>
        </Grid>
</ContentView>

and this is the custom control CS:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace Zeera.Controls
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class NavigationHeader : ContentView
    {
        public static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(NavigationHeader), default(string), Xamarin.Forms.BindingMode.OneWay);
        public static readonly BindableProperty HeaderBackground = BindableProperty.Create(nameof(BackColor), typeof(Color), typeof(NavigationHeader), Color.White, Xamarin.Forms.BindingMode.OneWay);

        public string Title
        {
            get { return (string)GetValue(TitleProperty); }
            set { SetValue(TitleProperty, value); }
        }

        public Color BackColor
        {
            get { return (Color)GetValue(HeaderBackground); }
            set { SetValue(HeaderBackground, value); }
        }

        public NavigationHeader()
        {
            InitializeComponent();

            NavigationPage.SetHasNavigationBar(this, false);

            // LabelNavigationHeader.SetBinding(Label.TextProperty, new Binding())
        }

        protected override void OnPropertyChanged(string propertyName = null)
        {
            base.OnPropertyChanged(propertyName);

            if (propertyName == TitleProperty.PropertyName)
            {
                LabelNavigationHeader.Text = Title;
            }

            if (propertyName == HeaderBackground.PropertyName)
            {
                GridNavigationHeader.BackgroundColor = BackColor;
                // GridNavigationHeader.BackgroundColor = Color.Blue;
            }
        }
    }
}

Thanks,
Jassim

Does anyone have experience with SfRadialMenu?

$
0
0

I need a complex menu with multiple options so the toolbar is not really an option.
I have a Radial menu configured using SyncFusion's SfRadialMenu, but I am having SERIOUS issues trying to get it to display....
Every sample I can find just shows the menu as the only object on a page, so I've been doing a lot of experimenting, but would like to see if anyone has some sample code or advice to help with my issues?

I have created a ContentView that I have my menu built in so I can call it from multiple other pages, but because of my page layouts the menu is having 2 major issues.
1: The menu will not move, even with dragenabled turned on.
2: The menu has a Z layer below everything else, so some of my experimentation has the menu behind other controls.

Is there a way to specify a Z layer? and I assume that the lack of mobility has to do with the implementation constraining to the bounds of what ever control it's parent is. How can I place the menu and have it dragable over the rest of the page?
pseudo code for the implementation would look like this
[app.xaml]

    ...
    <ContentPage.Content>
            <StackLayout>
                    <ScrollView Orientation="Both">
                        <AbsoluteLayout>
                                <Grid>
                    <!-- this is my radial menu content.view -->
                                <converter:RadialMenuPage/>

                    <grid layout page conent.....>

Thanks again!

Xamarin.Forms Application failed to deploy and run in Release Mode

$
0
0

Hi guys,

I have faced with in issue that when I try to deploy or to run code in Release mode (Visual Studio 2019 16.3.5, Android) I get the following error:

Severity Code Description Project File Line Suppression State
Error ADB0000: Deployment failed
Mono.AndroidTools.InstallFailedException: Unexpected install output:
Exception occurred while executing:
android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space
at android.util.ExceptionUtils.wrap(ExceptionUtils.java:34)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:412)
at com.android.server.pm.PackageManagerShellCommand.doCreateSession(PackageManagerShellCommand.java:2465)
at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:930)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:166)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:23637)
at android.os.Binder.shellCommand(Binder.java:642)
at android.os.Binder.onTransact(Binder.java:540)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2804)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4427)
at com.android.server.pm.HwPackageManagerService.onTransact(HwPackageManagerService.java:432)
at android.os.Binder.execTransact(Binder.java:739)
Caused by: java.io.IOException: Requested internal only, but not enough space
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:241)
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:157)
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:172)
at com.android.server.pm.PackageInstallerService.createSessionInternal(PackageInstallerService.java:509)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:410)
... 11 more

at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in E:\A_work\275\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 345
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass95_0.b__0(Task1 t) in E:\A\_work\275\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 753 at System.Threading.Tasks.ContinuationTaskFromResultTask1.InnerInvoke()
at System.Threading.Tasks.Task.Execute() 0

Severity Code Description Project File Line Suppression State
Error ADB0010: Unexpected install output:
Exception occurred while executing:
android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space
at android.util.ExceptionUtils.wrap(ExceptionUtils.java:34)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:412)
at com.android.server.pm.PackageManagerShellCommand.doCreateSession(PackageManagerShellCommand.java:2465)
at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:930)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:166)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:23637)
at android.os.Binder.shellCommand(Binder.java:642)
at android.os.Binder.onTransact(Binder.java:540)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2804)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4427)
at com.android.server.pm.HwPackageManagerService.onTransact(HwPackageManagerService.java:432)
at android.os.Binder.execTransact(Binder.java:739)
Caused by: java.io.IOException: Requested internal only, but not enough space
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:241)
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:157)
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:172)
at com.android.server.pm.PackageInstallerService.createSessionInternal(PackageInstallerService.java:509)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:410)
... 11 more

at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in E:\A_work\275\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 345
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass95_0.b__0(Task1 t) in E:\A\_work\275\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 753 at System.Threading.Tasks.ContinuationTaskFromResultTask1.InnerInvoke()
at System.Threading.Tasks.Task.Execute() 0

Have anybody faced with the same issue and how to fix it ?

DB Locked in Android SQLite Xamarin Forms

$
0
0

I'm working on a App that have more than 50 tables and can work without internet connection, so in background the app can sync up with the API and get all the information and make the CRUD operation in local.

Sometimes when the app is sync up with the API, I'm getting the error "database is LOCKED", when I'm making another operation on the App.

So I need help to solve this, I know that there are a lot of post about this problem, but base on my implamentation with my database, it seems not to be enough to solve my problem.

Nugets:
Xamarin.Forms 3.0.0 482510
sqlite-net-pcl 1.5.166-beta

I use a class DataService.cs where that class connect with the DataContext.cs and make the connection with database and methods CRUD.
All methods in the DataService have the same way to connect with DataContext

//This is a resume of DataService.cs
    public class DataService 
        {
            public T Insert<T>(T model)
            {
                try
                {
                    using (var da = new DataContext())
                    {
                        da.Insert(model);
                        return model;
                    }
                }
                catch (Exception error)
                {
                    error.ToString();
                    return model;
                }
            }
    }

In DataContext.cs we have the connection with the local database and all the methods with the local database .
All methods have the collisionLock (to avoid conflict with database) and cnn.Dispose() (To close connection with the database and avoid the error Fatal signal 11 (SIGSEGV));

DataContext.cs

public interface IBusinessEntity
    {
        int ID { get; set; }
    }

  //This is a resume of DataContext.cs
    public class DataContext : IDisposable
    {
        #region Attributes
        public SQLiteConnection cnn;
        private static object collisionLock = new object();
        #endregion

        #region Constructors
        public DataContext()
        {
            cnn = DependencyService.Get<IConfiguracion>().GetConnection();
...
} 
        #endregion

        #region MetodosGenericosZulu
        public void Insert<T>(T model)
        {
            try
            {
                // Use locks to avoid database collisions
                lock (collisionLock)
                {
                    cnn.Insert(model);
                    cnn.Dispose();
                }
            }
            catch (Exception error)
            {
                Application.Current.MainPage.DisplayAlert(
                    "Error",
                    "Un error a ocurrido con la DB (Insert): " + error.Message.ToString(),
                    "Ok");
            }
        }

        public void Update<T>(T model)
        {
            try
            {
                lock (collisionLock)
                {
                    cnn.Update(model);
                    cnn.Dispose();
                }
            }
            catch (Exception error)
            {
                Application.Current.MainPage.DisplayAlert(
                                    "Error",
                                    "Un error a ocurrido con la DB (Actualizar): " + error.Message.ToString(),
                                    "Ok");
            }
        }

        ...
        #endregion
}
}

Implentation on Android project.

public class Configuracion : IConfiguracion
    {
        public Configuracion(){ }

        public SQLite.SQLiteConnection GetConnection()
        {
                var sqliteFileName = "FN_Desarrollo.db3";
                string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                var path = Path.Combine(documentsPath, sqliteFileName);
              var  conn = new SQLite.SQLiteConnection(path, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.SharedCache);

            return conn;
        }
    }

So I need your help guys to solve the problem (database locked) and review if my implementation with the SQLite is OK.

I'm hearing all the suggestions.

Thanks in advance.

SQlite Sum

$
0
0

I'm trying to calculate the sum total of a table column. I've tried using:

public Task GetFruitTotalForDayAsync(string day)
{
return _database.ExecuteScalarAsync("SELECT SUM(Fruit) FROM Order WHERE Day = ?", day);
}

but I get a syntax error near Order.

Listview slider

$
0
0
Hye guys.. anyone know how to make listview in horizontal or listview that can slide to right or left? any sample code that i can refer? Hope someone can help me.. thanks guys

Problems of implementing Localization

$
0
0

I have created localization resources file (like value1 = A, value2 =B till value50=......) and I hope to called it as

title.Text =AppResource.valueX";.

I will get the X from the parameter pass from outside based on different condition. Any idea of how to implement this?

I try

title.Text =AppResource.$"value{LocationCode}"; but it is not work.

DateTimePicker composite control design question

$
0
0

I decided to build my own DateTimePicker composite control that places a label, datepicker and timepicker in a frame and has a DateTime property to bind to. I'm fairly new to building components with Xamarin Forms and I ended up with something that works, but a few questions.

The first question is, is it a bad design to have a composite control that can be tapped in different places causing different things to happen? The label, datepicker, and timepicker sit horizontally in a row from left to right. If you click on the datepicker, the standard datepicker dialog opens. If you click on the timepicker the standard timepicker dialog opens.

For the next question I'll show the code.

Here is the xaml:

<?xml version="1.0" encoding="UTF-8"?>
<Grid xmlns="http://xamarin.com/schemas/2014/forms" 
      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
      xmlns:d="http://xamarin.com/schemas/2014/forms/design"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:effects="clr-namespace:Sandbox.Effects"
      xmlns:yummy="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView"
      mc:Ignorable="d"
      x:Class="Sandbox.Controls.DateTimePickerViewControl">
    <Grid.RowDefinitions>
        <RowDefinition Height="auto" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="90"/>
        <ColumnDefinition Width="200"/>
    </Grid.ColumnDefinitions>
    <Label Grid.Column="0"
           Margin="0,0,0,4"
           FontSize="16"
           TextColor="#797979"
           VerticalOptions="Center"
           BackgroundColor="Transparent"
           HorizontalOptions="Start"
           x:Name="placeholderLabel" />
    <yummy:PancakeView BackgroundColor="#F9F9F9"
                       Margin="0"
                       Padding="8, 2, 8, 2"
                       BorderColor="#D5D5D5"
                       BorderThickness="1"
                       CornerRadius="8"
                       Grid.Column="1"
                       VerticalOptions="Center">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="100"/>
            </Grid.ColumnDefinitions>

            <DatePicker
                Grid.Column="0"
                FontSize="16"
                HeightRequest="28"
                TextColor="#797979"
                x:Name="datePicker"
                PropertyChanged="DatePicker_PropertyChanged">
                <DatePicker.Effects> <!-- the effects are to get rid of the underline -->
                    <effects:PickerEffect />
                </DatePicker.Effects>
            </DatePicker>

            <TimePicker
                Grid.Column="1"
                FontSize="16"
                HeightRequest="28"
                TextColor="#797979"
                x:Name="timePicker" 
                PropertyChanged="TimePicker_PropertyChanged">
                <TimePicker.Effects> <!-- the effects are to get rid of the underline -->
                    <effects:PickerEffect/>
                </TimePicker.Effects>
            </TimePicker>
        </Grid>
    </yummy:PancakeView>
</Grid>

Here is the code behind:

namespace Sandbox.Controls
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class DateTimePickerViewControl : Grid
    {
        private bool _setDateTimeEnabled = true;
        public static readonly BindableProperty PlaceholderProperty =
            BindableProperty.Create(nameof(Placeholder)
                , typeof(string)
                , typeof(DateTimePickerViewControl)
                , default(string)
                , BindingMode.OneWay);

        public static readonly BindableProperty DateTimeProperty =
            BindableProperty.Create(nameof(DateTime)
                , typeof(DateTime)
                , typeof(DateTimePickerViewControl)
                , null
                , BindingMode.TwoWay);

        public string Placeholder
        {
            get => (string)GetValue(PlaceholderProperty);
            set => SetValue(PlaceholderProperty, value);
        }

        public DateTime DateTime
        {
            get => (DateTime)GetValue(DateTimeProperty);
            set => SetValue(DateTimeProperty, value);
        }

        public DateTimePickerViewControl()
        {
            InitializeComponent();

            placeholderLabel.Text = Placeholder;
        }

        protected override void OnPropertyChanged(string propertyName = null)
        {
            base.OnPropertyChanged(propertyName);

            if (propertyName == PlaceholderProperty.PropertyName)
            {
                placeholderLabel.Text = Placeholder;
            }
            else if (propertyName == DateTimeProperty.PropertyName)
            {
                //this is required to set the datePicker and timePicker when the DateTime property is updated by code
                try
                {
                    //do not set the DateTime property from this method. This method is called when the DateTime property changes.
                    _setDateTimeEnabled = false;
                    datePicker.Date = DateTime.Date;
                    timePicker.Time = DateTime.TimeOfDay;
                }
                finally
                {
                    _setDateTimeEnabled = true;
                }
            }
        }

        private void DatePicker_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == DatePicker.DateProperty.PropertyName)
                SetDateTime();
        }

        private void TimePicker_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == TimePicker.TimeProperty.PropertyName)
                SetDateTime();
        }

        private void SetDateTime()
        {
            if (!_setDateTimeEnabled)
                return;

            if (datePicker.Date == null)
                return;

            DateTime dt = datePicker.Date;
            if (timePicker.Time != null)
                dt += timePicker.Time;
            this.DateTime = dt;
        }
    }
}

OnPropertyChanged is called when the DateTime property is updated. It sets the individual datePicker and timePicker controls, but I don't want the DatePicker_PropertyChanged or TimePicker_PropertyChanged to try to re-update the DateTime property. So, I'm using a private bool instance variable (_setDateTimeEnabled) in the OnPropertyChanged method. This doesn't feel quite right. For one thing somebody else could update the code and add something to set the datePicker.Date or the timePicker.Time without first setting the _setDateTimeEnabled to false.

Is there a better way to manage being able to update a property and have the property, in turn, update the components? And then if either of the components is updated by the user, have the code update the property, but not go back and try to re-update the components again?

If anybody has any other comments about the code above, I would love to hear them. Thanks.

System.NotImplementedException: 'This functionality is not implemented in the portable version of th

$
0
0

I have added Plugin.MediaManager and Plugin.MediaManager.Forms into my xamarin forms project for playing video.

CrossMediaManager.Current.Init(this);

when I am trying to add above code, it shows error (No overload for method Init();)

But getting below exception on android when running the project with below line of code.

CrossMediaManager.Current.Init();

System.NotImplementedException: 'This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.'

IOS and UWP apps are working fine, only android project has this issue. Please help me to fix this.

Monotouch.Dialog to Xamarin.Forms

$
0
0

Hi,

We've a big commercial app (iOS) which is using old Monotouch.Dialog and we're in the planning process of moving it to Xamarin.Forms. As app is quite complex, I wonder if we could gradually convert each screen to Xamarin.Forms or is it best to create new Xamarin.Forms solution and starts from scratch?

Cheers.

Make Page.UseSafeArea() cross-platform

$
0
0

I think that Page.UseSafeArea should be made available as a cross plattform feature in Xamarin.Forms. Since Android P, there is a way to determine the safe area. Why isn't this implemented? Is there a workarround for this?

unexpected character encountered while parsing value , when linker properties set sdk linking only.

$
0
0

unexpected character encountered while parsing value path line 0 position 0 source , when linker properties set sdk linking only. its works fine during json parsing when linking set to none. why its come please help in this regards.

integrating amazon lex in xamarin app (ios and android)

$
0
0

hello,

i have xamarin app for ios and android platform and need to integrate Amazon Lex in to it.
i have created chatbot with identity pool with permission.
there is no proper solution exactly what to be done so that i can integrate chatbot into existing app.
please guide me on this.


Dynamic Tabbed View

$
0
0

Hi everyone
i'm new to xamarin
i need to create tabbed page but tabs should be dynamic
Tabbed Page ItemsSource ?
if not how should i do?
any sample code or tutorial link
thank in advance

How to await for Share.RequestAsync is completed?

$
0
0

Hello,

Is there any way to check if share dialog (from Xamarin.Essentials) is already closed?

await Share.RequestAsync(new ShareFileRequest()
{
 Title = title,
 File = new ShareFile(path)
});

tokenSource.Cancel();

I would like to cancel token after share dialog is closed, not just after it is open.

Is it possible without any custom platform share implementation?

Thanks in advance for any help!

Issue with ACR Bluetooth LE adapter not finding anything

$
0
0

SO I have been trying to replicate the example program from the ACRBLE plugin, and I am having trouble getting it to work on visual studio 2019. For the functionality of scanning for device, I have a similar setup as the scantoggle in the example program.

IAdapter adapter = CrossBleAdapter.Current;
    IDisposable scan;

    public ICommand ScanToggle { get; private set; }
    private ICommand FindAdapter { get; }

    [Reactive] public bool IsScanning { get; private set; }
    [Reactive] public string adapter_is_scanning { get; private set; }
    [Reactive] public string connected_devices { get; private set; }

    [Reactive] public string adapter_status { get; private set; }
    public IObservableCollection<ScanResultViewModel> Devices { get; }


this.ScanToggle = ReactiveCommand.Create(
                () =>
                {
                    if (!IsScanning) //when (Press to scan)
                    {
                        this.IsScanning = true;
                        this.scan = this.adapter.Scan().Buffer(TimeSpan.FromSeconds(1)).ObserveOn(RxApp.MainThreadScheduler).Subscribe(
                            results =>
                            {
                                this.connected_devices = results.Count().ToString();
                                this.adapter_is_scanning = this.adapter.IsScanning.ToString();
                                this.adapter_status = this.adapter.Status.ToString();

                                foreach (var r in results)
                                {
                                    var dev = this.Devices.FirstOrDefault(x => x.Uuid.Equals(r.Device.Uuid));

                                    if (dev != null)
                                    {
                                        dev.TrySet(r);
                                    }
                                    else
                                    {
                                        dev = new ScanResultViewModel();
                                        dev.TrySet(r);
                                    }
                                    Devices.Add(dev);
                                }

                            }
                        ).DisposeWith(this.DeactivateWith);


                    }
                    else
                    {
                        this.scan?.Dispose();
                        this.Devices.Clear();
                        this.IsScanning = false;
                        this.adapter_is_scanning = this.adapter.IsScanning.ToString();
                        this.adapter_status = this.adapter.Status.ToString();

                    }
                }


             );

============================================================================================
I am binding the text property of a label to connection_devices which should update how many results I get after each instance of scan.

this.connected_devices = results.Count().ToString();

However it always returns 0, and nothing gets added to the observablecollection Devices either. I tried using nRF Connect and the bluetooth peripheral could work just fine. What am I doing wrong?

Error tracing in Xamarin Forms any advice?

$
0
0

I feel stupid asking this question, but I’m honestly stumped!

I’m having a debug dilemma in Visual Studio (Windows version) and wondered if anyone could advise me on the best methods for bug tracing a physical device (Android).

Currently when running an app, execution terminates with the following error:

Unhandled Exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: element occurred

There’s no call stack data (making it impossible to find what method was called before the error occurred) and there’s also no cursor break at the problem area… so the app just crashes out with the above error.
Is there any tips, tricks or settings for discovering what’s causing this obscure error?

Thanks in advance!

How to pick a file from Device(iOS, Android)

$
0
0

Hi All,

I have deployed app using Xamarin Form.
I have some requirement to pick a file( images, documents, videos except .zip file) from device.
Can you please suggest? It is very urgent for me.

Viewing all 79144 articles
Browse latest View live


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