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

Events are not uploading for XamarinForms iOS in firebase

$
0
0

I have implemented the firebase anlytics in my xamarin froms app. Events are uploaded and i can see events in firebase console for android.

the problem with ios is, while uploading the event is firebase i am getting this error in output window

NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://firebaselogging-pa.googleapis.com/v1/firelog/legacy/batchlog, NSErrorFailingURLStringKey=https://firebaselogging-pa.googleapis.com/v1/firelog/legacy/batchlog, NSErrorClientCertificateStateKey=0}
2020-07-31 16:42:05.289718+0530 TitleSnap.iOS[13584:207227] [GoogleDataTransport][I-GDTCOR000002] There was an error uploading events: Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?,

Because of this events are not uploaded in firebase and able to see the events in friebase console for firebase. Please help me to fix this issue,


Timer Speed is increasing on picker selection change

$
0
0

I am creating a timer which is working on a picker selection changed.Timer is working good until the times end to the "00:00:00".If i change the selection changed in the mid of time then the speed of timer is increased and if i again change selected index than timer run much fast. My problem is that timer should run on 1 sec dealy every time.
I am sharing my code below. Thanks in advance for help.

           private async void GName_SelectedIndexChanged(object sender, EventArgs e)
            {

            lblEndTime.Text = "00:00:10";

            StartTimmer();

            }

         public void StartTimmer()
          {
        Device.StartTimer(TimeSpan.FromSeconds(1), () =>
            {

            Device.BeginInvokeOnMainThread(() =>
          {
              TimeSpan timeSpan = TimeSpan.Parse(lblEndTime.Text);

              timeSpan -= TimeSpan.FromSeconds(1);

              if (lblEndTime.Text == "00:00:00")
              {
                  returnValue = false;

              }
              else
              {
                  lblEndTime.Text = Convert.ToString(timeSpan);

              }

          });

            return returnValue;
        });
     }

How do I 'move' the clipping rectangle on a SkiaSharp SKCanvas?

$
0
0

I think I am missing a trick with SkiaSharp. It's difficult to explain without diagrams but here goes...

Imagine I have a single canvas that I conceptually want to divide into three columns. Now imagine I want to draw different shapes into each of the three columns but I want the shapes to clip at the column boundaries. And finally I want to draw a shape that extends over the whole canvas.

I can change the clipping rectangle to draw in the first column. When it comes to drawing in the second, how do I do this? If I call ClipRect() again, the second rectangle is combined with the first (either subtracted or intersected). What I want to do is clear the first clip rectangle I set, or somehow reset the clipping rectangle to be the whole canvas.

And when it comes to drawing my final shapes that fill the whole canvas, I definitely need to put the clipping rectangle back to being the whole canvas.

How would I do this?

Kind wishes - Patrick

Change button more in Shell APP

$
0
0

How to change this more label for menu

How to upload a file from a Xamarin.Forms app to DropBox or OneDrive?

$
0
0

Has anybody implemented uploading a file from a Xamarin.Forms app to either DropBox or OneDrive? If so, could you share how you did it please? If you used a third-party component, which one (and would you use the same one again if you were to re-do that task)?

Many thanks,

John H.

XAML-based page crashing in UWP

$
0
0

As part of the training at Evolve 2016, the very basic app we developed was demonstrated on Android and iOS several times, and I tested it as well on my Android tablet. All was well and good. However, at the end I wanted to see it run on UWP on my Windows 10 laptop, but it wasn't working.

It showed the initial page just fine (a programmatic, non-XAML page), but displaying the XAML-based page caused it to just crash. Running it from Visual Studio, it stopped on a file not found exception and while there was no stacktrace, I had taken out any file IO from my app and using Debug.WriteLine, I managed to track it down to the call to InitializeComponent() in the code-behind for the XAML-page.

Neither trainer in my class could come up with an explanation other than UWP support was perhaps still in preview status, but they thought it ought to have worked and that it may be a bug.

I'm not really sure where to go from here, so anyone here know of this problem?

MVVM Navigation: How to navigate to "Next Quiz" or "Previous Quiz" using only one view?

$
0
0

Each quiz in my app is a unique MVVM object, and all of them lead to the same ResultsPage view. I'd like to have two buttons on this page, so users can navigate to next quiz or the previous one. However, how can I accomplish this given that the ResultsPage is the same view?

I tried passing a variable representint each page as a parameter from each ViewModel, "NQ" (for Next Quiz) and "PQ" (for Previous Quiz), but when I do the "NavigationPage page = new NavigationPage(new NQ())" in the ResultsPage this doesn't seem to work. Here's what I tried in detail. Thank you!

Quiz1 View Model

//...
NQ = Quiz2;
PQ = Quiz0
}

    private async Task ShowResults() => await Application.Current.MainPage.Navigation.PushAsync(new ResultsPage(PQ, NQ));

}

}


ResultsPage.xaml.cs

public ResultsPage(string PQ, string NQ)
{ this.NQ = NQ;
this.PQ = PQ;
//...

private void NextQuiz(object sender, EventArgs e)
{
NavigationPage page = new NavigationPage(new NQ());
App.Current.MainPage = page;

    }

    private void PreviousQuiz(object sender, EventArgs e)
    {
        NavigationPage page = new NavigationPage(new PQ));
        App.Current.MainPage = page;
    }

skiasharp - get SKBitmap from URL

$
0
0

Hello,

Can I know how can I get SKBitmap from URL ?

I tried like this but i didn't get it. It is null.

var bitmap = SKBitmap.Decode(url);

Thanks !!!


Bind a function on an item of a ListView

$
0
0

This is my starting point:

  • a DataModel Product which has some parameters like quantity, cost, type
  • a ViewModel which loads a list of products
  • a ContentPage which show the products in a ListView, the BindingContext is the ViewModel above

For each product I would like to show some fields like name, quantity, cost... and a calculated field which multiply quantity and cost, but also could have additional logic based on type or user parameters.
I could easily add a new field with only a getter "CalculatedCost" in the Product DataModel, but I don't like very much this, because I'd prefer keep the logic of this calculation outside.

The second idea is to create a static Converter to calculate this, but as far as I now, I could only pass a specific parameter to the converter, while I should make a calculation on the whole model, so how could I pass the whole object from the ListView item?
{Binding ??, Converter={StaticResource costCalculationConverter}}

Third idea, could I call a function of the ViewModel, passing the current Product in the list?

Any other idea to achieve this?
Thanks

Google authentication with oauth2 tutorial

$
0
0

Hello guys!

I am using xamarin for crossplatform ios/android about some moths now and also bought some tutorials in udemy about it. While a good portion of my app is completed i am wanted to use google calendar api and google authentication/sign in

I couldn't find a single completed tutorial how to do so and all the solutions i found online are either too complicated without structure or explanations , have details missing or refer to deleted links.

Is there someone who can provide me a good tutorial or example my top priority is to create a good working oauth2 google login and after that i can use i think easily google calendar with rest calls

Any help would be appreciated

here is one sample code i used that is not working

` Task OnLoginClickedAsync(object sender, EventArgs e)
{
string clientId = null;
string redirectUri = null;
string authorizeUri = Constants.AuthorizeUri;
string accessTokenUri = Constants.AuthorizeUri;
switch (Device.RuntimePlatform)
{
/* case Device.iOS:
clientId = Constants.iOSClientId;
redirectUri = Constants.iOSRedirectUrl;
break;*/

            case Device.Android:
                clientId = "152826923349-8n46ad52iub89udn4j7fds43nfmfc416.apps.googleusercontent.com";
                redirectUri = "com.companyname.manager:/oauth2redirect";
                break;
        }

        var authenticator = new OAuth2Authenticator(
            clientId,
            null,
            scope: "email",
            new Uri(authorizeUri),
            new Uri(redirectUri),
            new Uri(accessTokenUri),
            null,
            true);

        authenticator.Completed += OnAuthCompleted;
        authenticator.Error += OnAuthError;

        Xamarin.Auth.Authenticator auth = authenticator;

        var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
        presenter.Login(auth);

    }`

Detect if app is closed

$
0
0

Hi, Im a newbie in Xamarin.Forms. Is there a way to know if the app is close either manually or crashed? Thanks

How to change detail page to the other detail page?

$
0
0

I want to change detail page to the other detail page. The other words, when I click the masterpage's button, The detail page will be changed.

Here's my code:

void MyPageClicked(object sender, EventArgs e)
{
new MainPage().Detail = new MyPage();
((MasterDetailPage)Parent).IsPresented = false;
}

'((MasterDetailPage)Parent).IsPresented=false;' is worked, but 'new MainPage().Detail=new MyPage();' code isn;t worked. How do I change the code?

In a XF app DisplayAlert is hanging in UWP project?

$
0
0

DisplayAlert is hanging only in UWP and only in one app. Other apps don't have any issue. Even for this app no issues with Android and iOS.

I am calling it as follows:

await DisplayAlert("Pick a Photo", "No photo selected.", "OK");

What is missing here?

{x:Bind} isn't accepted - why?

$
0
0

I'm a beginner to Xamarin.Forms.

Trying to bind data using the "{x:Bind}" expression I get an error:

x:bind not supported

I don't understand ... why?

Need advice on my project

$
0
0

Hi, I am working on my project that will involve an app sending/receiving information from my database on the web, but I have no idea how to make it work. After some research it appears that I can use a Web API and a SQL server, but I still don't know the path that I have to take to achieve this.

Can someone please tell me how to:

  • Code an API
  • Connect the app with the API
  • Connect the API to the SQL server
  • Send and receive data from the app

Thank you so much for your help!


Right mouse click event

$
0
0

Is there any way to detect a right click event from a mouse when using Xamarin for a UWP app?

Failed to parse altool output: Failed to parse PList data type

$
0
0

It is happening when I attempt to deploy the application to the iOS app store. Before everything was ok. I tried to change App version and App code. I also updated VS Mac (8.6.8 build 2) and XCode (11.6).
Help me please!

Navigate to a Specific Screen

$
0
0

Good Day Everyone

i am using SignalOne for PushNotification and it works nicely. Now when the Notification is show a user can select it and i want to navigate to a specific Xamarin Form page than to start from Main Page.

Regards

Vuyiswa

Display placeholder image when image does not load of UriImageSource

$
0
0

Hi

I am using a remote uri as a source for an Image in Xamarin forms using a UriImageSource. I want to display a placeholder image/control when the remote image does not exist, but cant find a nice way to do this. I thought IsLoading might be the one but this is set to false once it succeeds or fails to load the image, do I have test if the remote image exists, seems a little over kill making another Http request just to determine if it doesn't exists and show a placeholder?

thanks

Is it possible to disable cut/copy/paste in an Effect?

$
0
0

I have a LongPress Effect applied to an Entry and have implemented it for Android. The Entry is initially read-only and I use the Effect to turn off the flag making the Entry editable. Unfortunately, the Entry is also enabled for Clipboard cut/copy/paste actions which is undesirable. I only want the user to be able to edit the text. When the keyboard is closed I turn the read-only flag back on. Is there a way, short of a custom renderer to disable the Clipboard on the Entry?

Viewing all 79144 articles
Browse latest View live