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

Selection on a Map

$
0
0

Good morning, I'm looking on some advice as to how to approach this project I'm working on, it's just for fun, attempting to develop an app for the first time.

I'm currently attempting to do something along the lines of where I put an image of the world or a continent on the background. And then when the user selects a country or maybe province (if it's within a country), then have a little pop-up appear (the same type as right clicking a mouse) with information about that location they clicked: population, area, flag, name, etc. The image will also probably be too large for 1 screen, so drag and zoom would have to be implemented as well.

What I'm struggling with, is how to make the image interactive like this. Countries are not nice squares or circles... I can use a blank image with just outlines if it makes easier. Any suggestions on how to approach this? I'm just not sure how to create these boundaries and behave differently depending the coordinate of where they tapped.

Thank you.


How can I make a local storage storage file for mobile app

$
0
0

I'm building a Xamarin CrossPlatform app all of its database is in cloud api's, but I want a local storage file in mobile which stores all login credentials whenever someone is login.

Kindly help me through this!

How to change navigation bar background color for each content page?

$
0
0

I want to change xamarin forms app content page's navigation bar background color for each page instead of common color, has any plugin or default feature how can I change it?

I need to change for each page separately to match with content page's body.

Sharepoint client.PostAsync("Url", null) Gets 401 unauthorized error REST API Xamarin.Forms

$
0
0

I am developing a cross mobile app using Xamarin and I am trying to post some items to a SharePoint List.

I have created a windows form app just to test the SharePoint Rest API and it is working good, I have the following code:

        var username = "user";
        var password = "pass";
        var domain = "domain";

        var handler = new HttpClientHandler
        {
            Credentials = new NetworkCredential(username, password, domain)
        };

        var client = new HttpClient(handler);

        HttpResponseMessage content = client.PostAsync("/mysite/_api/contextinfo", null).Result;

the content variable (HttpResponseMessage) returns me a 200 Status code, which is OK and everything is working.

However I have the same code in my Xamrin Froms but it is not working it throws me a 401 unauthorized error

this is my Xamarin Code

    private async void BtnRestApi_OnClicked(object sender, EventArgs e)
    {
         var username = "user";
         var password = "pass";
         var domain = "domain";

         var handler = new HttpClientHandler
         {
             Credentials = new NetworkCredential(username, password, domain)
         };

          var client = new HttpClient(handler);

         HttpResponseMessage content = await client.PostAsync("/mysite/_api/contextinfo", null).Result;
    } 

How can I pass a ViewCell into custom control?

$
0
0

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

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

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

Should I use something like x:Arguments for it?

GC_MINOR: (Nursery full) -> Only on Galaxy S9 Plus of my friend

$
0
0

Hi to everyone,

a few days ago I installed my app on my friend's Samsung Galaxy S9 Plus.
Only on this device, the app is slow.
I think it's an absurd thing, considering that it is the last device released by the Samsung company.

I try to explain what happens, considering that in my app you can download multimedia content (2mb/5mb of files).

The problem appears when, after opening the page where it is possible to search and download the files (a list containing two icons and one label per line appears) I'm pressing the icon to start the download of file.
At that moment, the UI of the app freeze while all other Tasks continue to go (eg Task of download be able to download and save the file without problems).

I immediately thought that the problem was caused by too much work on the main thread (maybe caused by an animation that start as soon as the download starts). [Only on Galaxy S9 Plus of my friend?!]

I also tested the app on the Galaxy S9 Plus, available on browserstack.com, and on their devices, the application works perfectly without problems (even fast).
My friend's phone is fast and it's new (no root or similar).

I'll give you some examples with some images.

Steps:
1. List of files (icon on left, file name, icon on right. This list use FastCells)
2. Click on download (appear a new absolute layout with numer of downloads and progress bar, appear with an animation from bottom to top)
3. If you click on download info layout or swipe download info layout appear a list of separate progress for each file)

These animations work on all devices (Android and iOS), except on the Galaxy S9 Plus of my friend.

To manage the global percentage of downloads, I created an event (DownloadProgressChanged).

I show you some code.
Download method inside Android Service (called by DependencyService.Get().DownloadFile)

private void DownloadFile(string fileName, string url, string source, string id, string uniqueId)
{
    if (NetworkState == NetworkState.ConnectedData || NetworkState == NetworkState.ConnectedWifi)
    {
        // Used inside list of current downloads
        var downloadInfo = new DownloadInfo
        {
            FileName = fileName,
            Progress = 0,
            IsWriting = false, // used to show infinite progress or percentage progress
            UniqueId = uniqueId,
            DownloadStatus = DownloadStatus.Idle // waiting (infinite progress)
        };
        // Add to singleton public list of not exist
        if (!DownloadHandlers.Instance.AtomicCheck(uniqueId))
        {
            DownloadHandlers.Instance.AtomicAdd(downloadInfo);
        }
        else
        {
            downloadInfo = DownloadHandlers.Instance.CurrentDownloadsInfo.First(u => u.UniqueId == uniqueId);
        }
        // Invoke DownloadProgressEvent
        InvokeDownloadProgress();
        try
        {
            var handler = new NativeMessageHandler();
            var httpClient = new HttpClient(handler);
            handler.DisableCaching = true;

            // Change value of IsWriting field
            if (DownloadHandlers.Instance.AtomicCheck(uniqueId))
            {
                DownloadHandlers.Instance.AtomicWriting(uniqueId, true);
            }

            var webApiWrapper = new WebApiWrapper();
            Uri uri = new Uri(url);
            var credentials = XXXXXXXXXXXXXXXXXXXXXXX;
            httpClient = webApiWrapper.ExternalApiRequest(credentials?.access_token);

            // Only response header, because we download the file only after that the stream is ready to write file on disk
            using (var response = httpClient.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead).Result)
            {
                var filePath = string.Empty;
                // If file not exist, write file to disk
                if (string.IsNullOrEmpty(fileName)) fileName = "Unknown_" + Guid.NewGuid().ToString("N") + ".xxx";
                fileName = Utils.Normalize(WebUtility.HtmlDecode(fileName), true);

                // Get full path where to save file
                if (!DependencyService.Get<IFilesHandler>().GetFilePath(fileName, out filePath))
                {
                    // Based on exception, throw error or retry if 401 unauthorize (with new token)
                    if (!response.IsSuccessStatusCode)
                    {
                        // Check error code and choose what to do
                        _webApiWrapper.HandleWebException(response, () =>
                        {
                            DownloadFile(fileName, url, source, id, uniqueId);
                        }, out ErrorResponse error);

                        if (error != null)
                        {
                            throw new ApiException("Unable to download file", error.Code);
                        }
                        return;
                    }

                    // Open stream to write file
                    using (var stream = new FileStream(filePath, FileMode.Create, FileAccess.Write))
                    {
                        var copyTask = response.Content.CopyToAsync(stream);
                        // TOP ahah
                        var length = response.Content.Headers.ContentLength ?? 15000;
                        while (!copyTask.IsCompleted && !copyTask.IsFaulted && !copyTask.IsCanceled)
                        {
                            // While we receive file data, we calculate the percentage
                            var progress = (double)stream.Position / length;
                            Device.BeginInvokeOnMainThread(() =>
                            {
                                // Set single percentage for current download list
                                if (DownloadHandlers.Instance.AtomicCheck(uniqueId))
                                    DownloadHandlers.Instance.AtomicProgress(uniqueId, progress);

                                // Set status of current download
                                downloadInfo.DownloadStatus = DownloadStatus.Downloading;

                                // Invoke DownloadProgressEvent
                                InvokeDownloadProgress();
                            });

                            Thread.Sleep(100);
                        }
                        // Close stream and Delete file if CopyTask fail
                        if (stream.Length == 0 || copyTask.IsFaulted || copyTask.IsCanceled)
                        {
                            downloadInfo.IsWriting = false;
                            stream.Close();
                            if(File.Exists(filePath)) File.Delete(filePath);
                            throw new Exception("Download Error.");
                        }
                        // Max percentage
                        downloadInfo.Progress = 1d;
                        // Save other data
                        DependencyService.Get<IFilesHandler>().WriteInfoJson(fileName, source, id, uniqueId);
                    }
                }
                else
                {
                    response?.Dispose();
                    AlertError("WarningAlertTitle".Translate(), "FileAlreadyExist".Translate(), "OkButton".Translate());
                }
            }

            // Change value of IsWriting and Status field
            if (DownloadHandlers.Instance.AtomicCheck(uniqueId))
            {
                DownloadHandlers.Instance.AtomicWriting(uniqueId, false);
                DownloadHandlers.Instance.AtomicStatus(uniqueId, DownloadStatus.Done);
            }

            // Download finished
            // Decrease number of current downloads
            Console.WriteLine("INFO: Perfect Download.");
            if (_downloadNumber > 0) _downloadNumber--;
            if (_downloadNumber == 0) _isDownload = false;

            // Invoke DownloadProgressEvent
            InvokeDownloadProgress();
        }
        catch (Exception ex)
        {
            .............
        }
    }
    else
    {
        // No internet connection
    }
}

InvokeDownloadProgress method

private void InvokeDownloadProgress()
{
    // Calculate total progress
    var progress = DownloadHandlers.Instance.TotalProgress();
    // Invoke with EventArgs
    DownloadProgressChanged?.Invoke(null, new DownloadProgressChangedEventArgs
    {
        DownloadNumber = _downloadNumber,
        TotalProgress = progress
    });
}

On form side, page code (OnAppearing)

DependencyService.Get<IServerTasks>().DownloadProgressChanged += DownloadProgressChanged;

where DownloadProgressChanged method

private int _downloadNumber = -1;

private void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
    var downloadNumber = e.DownloadNumber;
    // Invoke main thread async for animation
    Device.BeginInvokeOnMainThread(async () =>
    {
        // Check current downloads
        if (Math.Abs(e.TotalProgress) < 0.0000001 || downloadNumber == 0)
        {
            progressBar.Progress = 0;
            return;
        }

        // Update progress bar value
        progressBar.Progress = e.TotalProgress / downloadNumber;

        // If there is at least one download, change value of label inside download info layout
        if (downloadNumber > 0 && _downloadNumber != downloadNumber)
        {
            _downloadNumber = downloadNumber;
            lbInfoDownload.Text = string.Format("MultipleDownloadInfoText".Translate(), downloadNumber);

            // If download info layout is not visible
            if (!infoDetailedView.IsVisible)
            {
                // Animate layout from bottom to top
                infoDetailedView.TranslationY = infoDetailedView.Height;
                infoDetailedView.IsVisible = true;
                await infoDetailedView.TranslateTo(0, infoDetailedView.Height - iosRow.Height.Value, 350, Easing.Linear);
            }

            // Change margin of List, so that by scrolling we can see all the elements hidden by download info layout
            layoutList.Margin = new Thickness(0, 0, 0, iosRow.Height.Value);
        }
    });
}

There are other methods used to animate the download info layout (touch and swipe) but it is not necessary to show them because the UI freeze before displaying this layout.

Xamarin Forms Map error on Andriod

$
0
0

I'm getting a Unhandled Exception when debug project.

/////////////////////////////////////////////////////////////////////////////////
Unhandled Exception:

Java.Lang.NumberFormatException: For input string: "@2131493172"
/////////////////////////////////////////////////////////////////////////////////

here the code :
LoadApplication(new App());
at MainActivity.cs

Please help me!

Google pay - This payment option is no longer available in this app

$
0
0

I'm trying to add Google Pay to my application as described in this tutorial: https://blog.xamarin.com/bring-android-pay-to-your-apps-with-stripe/ and in stripe.com docs - https://stripe.com/docs/mobile/android/google-pay
But when I click to "pay" button, the following message appears: "This payment option is no longer available in this app."
What option is no longer available - wallet?

var options = WalletFragmentOptions.NewBuilder()
                .SetEnvironment(WalletConstants.EnvironmentSandbox)
                .SetMode(WalletFragmentMode.BuyButton)
                .SetTheme(WalletConstants.ThemeLight)
                .SetFragmentStyle(new WalletFragmentStyle()
                    .SetBuyButtonText(BuyButtonText.BuyWithGoogle)
                    .SetBuyButtonAppearance(BuyButtonAppearance.Classic)
                    .SetBuyButtonWidth(Dimension.MatchParent))
                .Build();

            var fragment = SupportWalletFragment.NewInstance(options);

            var request = MaskedWalletRequest.NewBuilder()
                .SetPaymentMethodTokenizationParameters(
                    PaymentMethodTokenizationParameters.NewBuilder()
                        .SetPaymentMethodTokenizationType(PaymentMethodTokenizationType.PaymentGateway)
                        .AddParameter("gateway", "stripe")
                        .AddParameter("stripe:publishableKey", "<my_code_here>")
                        .AddParameter("stripe:version", "2018-11-08")
                        .Build())
                    .SetShippingAddressRequired(false)
                    .SetMerchantName("Xamarin")
                    .SetPhoneNumberRequired(false)
                    .SetShippingAddressRequired(false)
                    .SetEstimatedTotalPrice("10.00")
                    .SetCurrencyCode("USD")
                    .Build();

            fragment.Initialize(WalletFragmentInitParams.NewBuilder()
                .SetMaskedWalletRequest(request)
                .SetMaskedWalletRequestCode(111)
                .Build());

How to set the Selected Item of a Picker Control through View Model (MVVM)

$
0
0

Hi there,

I will try to explain this as best I can so please bare with me:

Background:

I have two pages that interact with each other - a customer page (CustomerPage) which stores a listing of customers and an edit page (CustomerEditPage) used to add new customers or edit customers passed in from the customer page list. I am able to pass the Customer class of the selected customer in the customer page to the edit customer page without issue. I am also able to set all of the Entry controls to the values through passing the values. In addition to the Entry controls I also have a Picker control used to store location name values (e.g. 123 West St, 85 George St, etc.). It has an ItemSource that loads successfully through the view model. However I have an issue when trying to specify the selected item from a value passed to the view model on load. The bound property fires and shows it being set, but the control does not show anything selected after load in the application. If I click on the control, my values are there but again nothing is selected.

Can someone help me explain how I can set the selected item?

Things I have tried:

  • Ensuring the ItemSource is loaded before the SelectedItem value is set
  • Put a break-point on the Handles_ItemSelected event to see when it is firing (*Note it only fires when I select an item from the list and NOT when set through code in the view model)
  • Adding an ID column to the CustomerLocation class to see if the Picker needed a key value

Item Selected from ListView in CustomerViewModel.cs

        ItemSelectedCommand = new Command(async () =>
        {
            await navigationService.NavigateModelAsync(PageNames.CustomerEditPage, Customer, true, false);
        });

This works as expected

Picker Control from CustomerEditPage.xaml

        <Picker ItemsSource="{Binding Locations}" 
                ItemDisplayBinding="{Binding LocationName}"
                SelectedItem="{Binding CustLocation, Mode=TwoWay}"
                SelectedIndexChanged="Handle_SelectedIndexChanged"/>

*Note that the SelectedIndexChanged was only set so I can see when it was firing

CustomerEditPage.xaml.cs

    public CustomerEditPage(CustomerEntry customer)
    {
        var vm = new ViewModels.CustomerEditViewModel(App.NavigationService);
        BindingContext = vm;

        if (customer != null || customer.ID > 0)
        {
            vm.EditCustomer = customer;
            vm.SetEditCustomer();
        }

        InitializeComponent();
    }

    void Handle_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        //Testing to see if we get to this break-point
    }

As you can see, I take in the CustomerEntry class object. I check if it is not null and has an ID > 0 and if so passes to the ViewModel to set the controls. Again, the Handle_SelectedIndexChange is only fired for testing purposes (using a breakpoint).

CustomerEditViewModel.cs

    private CustomerEntry editCustomer;
    public CustomerEntry EditCustomer
    {
        get { return editCustomer; }
        set
        {
            editCustomer = value;
            OnPropertyChanged("EditCustomer");
        }
    }

    private ObservableCollection<CustomerLocation> locations = new ObservableCollection<CustomerLocation>();
    public ObservableCollection<CustomerLocation> Locations
    {
        get { return locations; }
        set 
        {
            locations = value;
            OnPropertyChanged("Locations");
        }
    }

    private CustomerLocation custLocation;
    public CustomerLocation CustLocation
    {
        get { return custLocation; }
        set
        {
            custLocation = value;
            OnPropertyChanged("CustLocation");
        }
    }

    public CustomerEditViewModel(INavigationService navigationService)
    {
        SubmitCommand = new Command(async () =>
        {
            await OnSubmit();
            await navigationService.NavigateModelAsync(PageNames.CustomerPage, null, true, true);
        });

        CancelCommand = new Command(async () =>
        {
            await navigationService.GoBack();
        });

        LoadLocations();
    }

    public async Task LoadLocations()
    {
        List<CustomerLocation> loadLocations = await App.Database.GetLocationsAsync();
        Locations = new ObservableCollection<CustomerLocation>(loadLocations);
    }

    public void SetEditCustomer()
    {
        ID = EditCustomer.ID;
        CustomerName = EditCustomer.CustomerName;
        CustLocation = new CustomerLocation() 
        { 
            LocationName = EditCustomer.LocationName
        };
        Email = EditCustomer.Email;
        Notes = EditCustomer.Notes;
    }

The EditCustomer, Locations and CustLocation properties all fire. Properties for ID, CustomerName,Email and Note omitted for brevity.

Locations are loaded from a SQLiteAsyncConnection (database is located on device)

CustomerLocation.cs

public class CustomerLocation
{
    public string LocationName { get; set; }
}

As mentioned above, I put a mock ID column in this class (I didn't actually designate it as a key now that I think about it - I am not sure if that makes a difference).

CustomerEntry.cs

public class CustomerEntry
{
    [PrimaryKey, AutoIncrement]
    public int ID { get; set; }

    public string CustomerName { get; set; }
    public string LocationName { get; set; }
    public string Email { get; set; }
    public string Notes { get; set; }
    public DateTime TimeStamp { get; set; }
}

CustomerEntry class here for reference purposes.

Can I refresh the Master Content from a ViewModel?

$
0
0

Hello developers,

I am having a problem in my app. In the MasterViewModel I have a menu with some options to navigate inside the app and an image and a label that can be changed by the user in the configuration.
I have implemented the INotifyPropertyChanged interface in all my ViewModels, but I have noticed that the MasterViewModel is only executed once during the application lifetime (the constructor).

So, here is my question... How can I refresh the MasterViewModel from another ViewModel when the user changes some information which is also displayed in the Master?

Thank you so much in advance.

Regards!

Xamarin.Forms uploading to OneDrive and DropBox

$
0
0

Hi all,

I'm new to Xamarin.Forms. I've created my first app. It has an SQLite database local. I want an option to back this file up to OneDrive and/or DropBox.

Is there a recent example on how to do this? I have searched and found some older ones but I cannot get them to function correctly.

Much appreciate your time.

Thank you

Picker Custom Renderer not working properly!

$
0
0

I have implemented an custom android renderer for a Picker , just a basic one i found online. But the issue i have found, is when i click the picker to show the dialog options, on the first click it doesn't show the custom changes(default dialog) but when i close the picker option and then click the picker again to show the dialog option, then it shows my custom dialog changes.

I have tried using it with using PickerRenderer = Xamarin.Forms.Platform.Android.AppCompat.PickerRenderer; as well;

Any help would be appreciated thanks.

Stef

renderer added below:

using System;
using System.Linq;
using Android.App;
using Android.Content;
using Android.Widget;
using BindablePicker;
using BindablePicker.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using Color = Android.Graphics.Color;
using Orientation = Android.Widget.Orientation;

[assembly: ExportRenderer(typeof(CustomPicker), typeof(CustomPickerRenderer))]
namespace BindablePicker.Droid
{
public class CustomPickerRenderer : PickerRenderer//, ViewRenderer<Picker, EditText>
{

    IElementController ElementController => Element;


    public CustomPickerRenderer(Context context) : base(context)
    {
        AutoPackage = false;

    }


    private AlertDialog _dialog;


    protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
    {
        base.OnElementChanged(e);
        Control.Click += Control_Click;
    }


    protected override void Dispose(bool disposing)
    {
        if (disposing)
        {
            Control.Click -= Control_Click;
            //var picker = (Picker)Element;
            //picker.PropertyChanged -= Control_Click;
        }


        base.Dispose(disposing);
    }

    private void Control_Click(object sender, EventArgs e)
    {
        Picker model = Element;
        model.Title = "changed";

        var picker = new NumberPicker(Context);

        if (model.Items != null && model.Items.Any())
        {
            // set style here

            picker.MaxValue = model.Items.Count - 1;
            picker.MinValue = 0;

            picker.SetBackgroundColor(Color.Purple);
            picker.SetDisplayedValues(model.Items.ToArray());
            picker.WrapSelectorWheel = false;
            picker.Value = model.SelectedIndex;

        }


        var layout = new LinearLayout(Context) { Orientation = Orientation.Vertical };
        layout.AddView(picker);
        layout.SetBackgroundColor(Color.Purple);

        var titleView = new TextView(Context);

        titleView.Text = "hmmmm";
        titleView.SetBackgroundColor(Color.ForestGreen);

        ElementController.SetValueFromRenderer(VisualElement.IsFocusedProperty, true);

        var builder = new AlertDialog.Builder(Context);
        builder.SetView(layout);

        builder.SetTitle(model.Title ?? "");

        //builder.SetCustomTitle(titleView);
        builder.SetNegativeButton("Cancel  ", (s, a) =>
        {
            ElementController.SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
            // It is possible for the Content of the Page to be changed when Focus is changed.
            // In this case, we'll lose our Control.
            Control?.ClearFocus();
            _dialog = null;
        });
        builder.SetPositiveButton("Ok ", (s, a) =>
        {
            ElementController.SetValueFromRenderer(Picker.SelectedIndexProperty, picker.Value);
            // It is possible for the Content of the Page to be changed on SelectedIndexChanged.
            // In this case, the Element & Control will no longer exist.
            if (Element != null)
            {
                if (model.Items.Count > 0 && Element.SelectedIndex >= 0)
                    Control.Text = model.Items[Element.SelectedIndex];
                ElementController.SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                // It is also possible for the Content of the Page to be changed when Focus is changed.
                // In this case, we'll lose our Control.
                Control?.ClearFocus();
            }
            _dialog = null;
        });

        Control.Text = "Control";

        _dialog = builder.Create();
        _dialog.DismissEvent += (ssender, args) =>
        {
            ElementController?.SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
        };
        _dialog.Show();
    }

}

}

Master-Detail Page as a Navigation drawer?

$
0
0

I need a side navigation drawer in the application, the functionality provided by the Master-Detail Page is not compatible with my needs,
I need to have the drawer in the MainPage only and to behave like a NavigationPage: when any item in the master page is clicked, then replacing the hamburger button with a back button that navigate to the previous page.. is it possible with the Xamarin's Master-Detail page?

What I've tried so far:

  • setting
    MainPage = new NavigationPage(new MainPage()); //where MainPage is a MasterDetailPage

then set the NavigationPage.HasNavigationBar of the main page to False.

but I have two initial problems:
1- the title is beneath the back button.
2- when I navigate back, the menu is still opened.

There might be another problems of this workaround, that I'm not aware of at the moment

Xamarin.Android CI Builds on VSO

$
0
0

Anyone has success stories to share? I have my Xamarin.Android in VSO and I am trying to setup a build definition.

First I was getting this error
The specified solution configuration "Debug|BWS" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.

I resolved it and now I am getting this
The target "PackageForAndroid" does not exist in the project.

What am I missing? I am able to build the same SLN locally just fine.

Thanks in advance,
Pranav

Developing for Mac OS on Windows Visual Studio?

$
0
0

Is there a specific reason why Xamarin doesn't support building Mac apps from Visual Studio on Windows, the same way it pairs to a Mac to compile for iOS projects? I'm glad there is a path with Visual Studio for Mac, but I find it less productive (time-wise) for me personally than when I'm writing iOS apps on Visual Studio in Windows then compiling paired to a Mac.

I'm not trying to start an OS flame war discussion, they both have their strengths and weaknesses. Just asking if I'm the only one that would be interested in a feature to do paired compiling for other Xamarin platforms in addition to iOS, like Mac apps, TV OS, etc?


Update or delete a deployed app from the emulator

$
0
0

This is all within VS 2017. I deployed an app, called App3. It's on the Emulator and I can see when when it runs.

I made some changes to App3 (added a textbox). Compiled it and deployed it. But I still just see the previous App3.

What could I be doing wrong? Obviously I will need to update existing apps.

How to give gesturedetector for circle ?

$
0
0

Hii community
i need a solution or suggestion for Increase or decrease the values of circle like slider

How to do..
if any please suggest
thanks

February 21, 2019 - Minneapolis, MN - Offline Data Collection and Syncing with Xamarin

$
0
0

Join us for our February event sponsored and hosted by ILM Professional Services. This is a FREE event and a great opportunity for networking and the latest insights in mobile development.

RSVP Here: Minnesota Enterprise Mobile on Meetup

February Topic - Offline Data Collection and Syncing with Xamarin

Case study review of two mobile apps developed for the livestock industry to work offline in remote locations. Built on Xamarin using SQL Lite and Realm. We will review challenges encountered with data collection where no internet access is available and storing data offline and syncing process used.

Presented by J. Alan Childs (CTO Meta Farms, Inc. - Burnsville, MN)
Alan has been working at MetaFarms since 2001 designing and developing their AG Platform for Swine and Poultry producers. MetaFarms tracks over 20 million hogs in the North America.

About the Group
Led by local developers, the Minnesota Enterprise Mobile User Group is a place to come together to share knowledge, experiences, and lessons learned with the development community regarding enterprise mobile development, with a focus on mobile cross-platform application development and the Xamarin toolset. Our goal is to cover all areas of the Enterprise Mobile landscape.

Thursday, February 21st
5:30 - 6:00 PM - Social time featuring good food and beverages
6:00 - ~7:30 PM - Presentation and Discussion

Location
ILM Professional Services
5221 Viking Drive
Edina, MN 55435

Free on-site parking is available.

This meeting is hosted and sponsored by ILM Professional Services.

Challenges with shadows, primarily casting shadows on geometry with a Point Light

$
0
0

Hello,

I'm trying to get shadow casting working and I must be doing something wrong because regardless of what I try I cannot get shadows to draw. I found another thread (I don't have permission to post links, it's titled "UrhoSharp - Is casting shadows possible?") with a similar question, but the advice there hasn't helped me.

I'm using a point light configured as
cursorLight = LightNode.CreateComponent<Light>(); cursorLight.LightType = LightType.Point; cursorLight.Color = Color.White; cursorLight.Range = (.02f); cursorLight.ShadowIntensity = .5f; cursorLight.Brightness = 3f; cursorLight.CastShadows = true; cursorLight.ShadowBias = new BiasParameters(0.00025f, 0.5f); cursorLight.ShadowCascade = new CascadeParameters(10.0f, 50.0f, 200.0f, 0.0f, 0.8f); cursorLight.SpecularIntensity = 2f;

I'm testing with two box primitives.
var testBox = Scene.CreateChild(); testBox.SetWorldPosition(new Vector3(0, 0, 1f)); testBox.SetScale(.04f); var testBoxModel = testBox.CreateComponent<StaticModel>(); testBoxModel.CastShadows = true;

Additionally, I configured my renderer based on some of what I saw on GitHub and around Google results for this problem.
Renderer.ShadowMapSize *= 4;
Renderer.DrawShadows = true;

I can see the specular highlight of the light on the boxes, so I know it the light is working. But I cannot see a shadow. I expect the smaller box in front to cast a shadow on the box behind it. The front of the box lights properly, and the sides are darker, as I'd expect. But it does not project a shadow onto the geometry behind it. I've tried cranking the range on the light up much higher and that has no effect other than increasing the size of the specular highlight.

This is a HoloLens project. Are there known issues casting shadows using UrhoSharp in the HoloLens? I haven't encountered a problem like that yet. Something unusual I've noticed is that my lit textures appear illuminated from the front as if the scene has a directional light, but there are no other lights in my project. You can see in the screenshot that the front faces of the cubes appear more illuminated the other faces. Moving around the cubes etc doesn't alter this illumination. I experimented with placing my test shadow caster on one of the sides that is less illuminated, but that had no effect on the problem. I'm at my wit's end with this one - both the mysterious front illumination and the shadow problem. I'll be extremely grateful if anyone has an idea!

Edit: I "have to be around a little while longer to post links." I would like to share two imgur screenshots of this issue. Please let me know what to do in order to do that or send me a PM and I will send you the link. The slugs for the i.imgur URL of the images are AZVcbEn.png and E8fAG08.png.

Xamarin.Auth - Google OAuth don't close over UWP when IsUsingNativeUI is set to true

$
0
0

Hi,

I just implemented Xamarin.Auth on UWP, and I have a weird problem.
I begin by creating my OAuth object :

    public OAuth()
    {
        account = null;
        store = null;

        Scope = "";
        AuthorizeUrl = "";
        AccessTokenUrl = "";
        UserInfoUrl = "";

        clientId = "";
        clientSecret = null;
        redirectUri = "";
    }

    public OAuth Facebook()
    {
        // These values do not need changing
        Scope = "email";
        AuthorizeUrl = "https://www.facebook.com/v2.8/dialog/oauth";
        AccessTokenUrl = "https://graph.facebook.com/oauth/access_token";
        UserInfoUrl = "https://graph.facebook.com/me?fields=email,name,gender,picture";

        clientId = "xxxx";
        clientSecret = "xxxxx";
        redirectUri = "http://www.facebook.com/connect/login_success.html";

        isUsingNativeUI = false;

        OAuthParser = ParseFacebookResponse;

        return this;
    }

    public OAuth GooglePlus()
    {
        // These values do not need changing
        Scope = "https://www.googleapis.com/auth/userinfo.email";
        AuthorizeUrl = "https://accounts.google.com/o/oauth2/auth";
        AccessTokenUrl = "https://www.googleapis.com/oauth2/v4/token";
        UserInfoUrl = "https://www.googleapis.com/oauth2/v2/userinfo";

        clientId = "xxxxx";
        redirectUri = "xxxxxx";

        isUsingNativeUI = true;

        OAuthParser = ParseGooglePlusResponse;

        return this;
    }

On Android, either if isUsingNativeUI is set to true or false, after I connect myself, the webview/oauth get closed. Over UWP however, it doesn't work when isUsingNativeUI is set to true, the webview/oauth don't close, so I'm navigating on google and I am not able to come back on the app (UWP Desktop)...

Do you have any idea? Thank for any help !

Viewing all 204402 articles
Browse latest View live


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