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

Forms9Patch: Simplify multi-device image management in your PCL Xamarin.Forms mobile apps

$
0
0

Announcement of Form9Patch

Xamarin Forms is great for developing apps on Android and iOS but it is missing two important tools for developers: scalable images and PCL multi-screen image management. Android developers use NinePatch bitmaps and the drawable directory naming convention for this purpose. Likewise, iOS developers use ResizeableImageWithCapInsets and the @2x, @3x, @4x file naming convention for this purpose.

Forms 9 Patch enhances Xamarin Forms to enable multi-resolution / multi-screen image management to PCL apps for iOS and Android.

What is it?

Simply stated, Forms9Patch is two separate elements (Image and ImageSource) which are multi-screen / multi-resolution extensions of their Xamarin Forms counterparts.

Forms9Patch.ImageSource

Xamarin Forms provides native iOS and Android multi-screen image management (described here). This requires storing your iOS images using the native iOS schema and storing your Android images using the Android schema. In other words, duplicative efforts to get the same results on both Android and iOS. Forms9Patch.ImageSource extends Xamarin.Forms.ImageSource capabilities to bring multi-screen image management to your PCL assemblies - so you only have to generate and configure your app's image resources once. Forms9Patch.ImageSource is a cross-platform implementation to sourcing multi-screen images in Xamarin Forms PCL apps as embedded resources.

Forms9Patch.Image

Forms9Patch.Image compliments Xamarin.Forms.Image to provide Xamarin Forms with a scaleable image element. Scalable images are images that fill their parent view by stretching in designated regions. The source image for the Forms9Patch.Image element can be specified either as a Forms9Patch.ImageSource or a Xamarin.Forms.ImageSource. Supported file formats are NinePatch (.9.png), .png, .jpg, .jpeg, .gif, .bmp, and .bmpf.

Example code

After adding the file bubble.9.png to your PCL project assembly as an EmbeddedResource, you can display it using something like the following:

var bubbleImage = new Forms9Patch.Image () {
    Source = ImageSource.FromResource("MyDemoApp.Resources.bubble.9.png"),
    HeightRequest = 110,
}
var label = new label () {
    Text = "Forms9Path NinePatch Image",
    HorizontalOptions = LayoutOptions.Center,
}

Example XAML

In Xamarin Forms, access to embedded resources from XAML requires some additional work. Unfortunately, Forms9Patch is no different. As with Xamarin Forms, you will need (in the same assembly as your embedded resource images) a simple custom XAML markup extension to load images using their ResourceID.

    [ContentProperty ("Source")]
    public class ImageMultiResourceExtension : IMarkupExtension
    {
        public string Source { get; set; }

        public object ProvideValue (IServiceProvider serviceProvider)
        {
            if (Source == null)
                return null;

            // Do your translation lookup here, using whatever method you require
            var imageSource = Forms9Patch.ImageSource.FromMultiResource(Source);

            return imageSource;
        }
    }

Once you have the above, you can load your embedded resource images as shown in the below example. Be sure to add a namespace for the assembly that contains both your MarkupExtension and your EmbeddedResources (local in the below example).

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:MyXamlDemo;assembly=MyXamlDemo"
    x:Class="MyXamlDemo.MyPage"
    Padding="5, 20, 5, 5">
    <ScrollView>
        <ScrollView.Content>
            <StackLayout>
            <Label Text="Xamarin.Image"/>
            <Image Source="{local:ImageMultiResource Forms9PatchDemo.Resources.image}"/>
            </StackLayout>
        </ScrollView.Content>
    </ScrollView>
</ContentPage>

Where to learn more

Project page: http://Forms9Patch.com
Nuget page: https://www.nuget.org/packages/Forms9Patch/0.9.1
Demo app repository: https://github.com/baskren/Forms9PatchDemo


read image from mysql

$
0
0

Hi, I'm a new developer and Ineed to know How I get image from mysql and show at image component. follow my code.

foreach (var s in _ret)
{
vwbt_classe.Text = s._dss_cls;
vwbt_subclasse.Text = s._dss_sls;
vwet_dss_rsm.Text = s._dss_rsm;
vwlb_cdn_prt.Text = s._cdn_prt.ToString();
vwet_dss_dtl.Text = s._dss_dtl;
vwet_nmd_vlr.Text = s._nmd_vlr.Replace(".", ",");
vwet_link_ext_prt.Text = s._dss_lnk_ext_prt;
//vwet_imb_prt_mnu.Text = s._imb_prt_mnu;
_img = new MemoryStream(s._imb_prt_mnu);

            }



            vwim_imb_prt_mnu.Source = ImageSource.FromStream(() => { return _img; });

What's the problem?

Datepicker: Possible to bind to Nullable date value?

$
0
0

Hi everybody!

I have a nullable date field in my object and I want to bind a date picker to it. When the value is null, I would just want to show no value in the picker. Is this possible?

I tried

datepicker.SetBinding (DatePicker.DateProperty, vm => vm.DueDate, BindingMode.TwoWay);

but this results in a NullValueException when the view is shown.

Any ideas?

Image filling the container and keeping aspect ratio

$
0
0

In case someone needs this as well, I want to share a simple implementation I made.

Unfortunately there’s no way to display the Image filling the container while keeping its aspect ratio without either clipping it or letterbox’ing it.
This is quite a common task so I created an ImageEx class derived from Image which has an extra Uniform value for Aspect property:

Using other Aspect values Fill, AspectFill, AspectFit works like for the Image class.

You can get a gist for ImageEx class from here: https://gist.github.com/nitescua/c907c2951a719ed3ac34

I wrote a blog post with more info here http://enginecore.blogspot.ro/2015/04/xamarin-forms-image-filling-container.html

Badge Scanner Mobile App using Microsoft PowerApps versus Xamarin.Forms

$
0
0

Hey guys,

I did a little experiment last night and created a badge scanner mobile app using PowerApps and then did the same using Xamarin.Forms with only 334 lines of code and 66% shared across iOS and Android. Check out my blog post for details: https://nimamazloumi.wordpress.com/2018/02/08/badge-scanner-mobile-app/

I used Azure for Active Directory Premium P1 for registering the app and granting permissions, Dynamics CRM 365 Online with some sample contacts in the Contact entity, Visual Studion Community Edition for Xamarin.Forms and the nuget packages ZXing.Net.Mobile.Forms for scanning, Newtonsoft.Json for using the CRM Web API and authentication, Microsoft.IdentityModel.Clients.ActiveDirectory for active directory 2FA.

Let me know what you think.

Target _BuildApkFastDev fails

$
0
0

Hi, I am using Visual Studio 2017 for Mac Community Version 7.3.3 (build 12) on macOS High Sierra 10.13.3.
I have created a Xamarin.Forms 2.5.0.122203 app using a shared project. Minimum Android version is configured API level 19 and target is API26. I am using the following nuget packages:

    1. ZXing.Net.Mobile.Forms
    1. Xam.Plugin.Settings
    1. Com.Airbnb.Xamarin.Forms.Lottie
    1. Newtonsoft.Json
    1. Microsoft.IdentityModel.Clients.ActiveDirectory

Deployment fails for Android with the following error. Any thoughts?

Target _BuildApkFastDev:
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018: The "BuildApk" task failed unexpectedly.
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018: Xamarin.Tools.Zip.ZipIOException: Stream is not a ZIP archive
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Tools.Zip.ZipArchive..ctor (System.IO.Stream stream, Xamarin.Tools.Zip.IPlatformOptions options, Xamarin.Tools.Zip.OpenFlags flags) [0x00133] in <e32885fa80124c1badcf1508ab795e19>:0
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Tools.Zip.UnixZipArchive..ctor (System.IO.Stream stream, Xamarin.Tools.Zip.UnixPlatformOptions options, Xamarin.Tools.Zip.OpenFlags flags) [0x00000] in <e32885fa80124c1badcf1508ab795e19>:0
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Tools.Zip.ZipArchive.CreateInstanceFromStream (System.IO.Stream stream, Xamarin.Tools.Zip.OpenFlags flags, Xamarin.Tools.Zip.IPlatformOptions options) [0x00014] in <e32885fa80124c1badcf1508ab795e19>:0
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Tools.Zip.ZipArchive.Open (System.IO.Stream stream, Xamarin.Tools.Zip.IPlatformOptions options) [0x00000] in <e32885fa80124c1badcf1508ab795e19>:0
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Android.Tasks.BuildApk.ExecuteWithAbi (System.String supportedAbis, System.String apkInputPath, System.String apkOutputPath) [0x002c2] in <a9f581d0c2a2409a88d42cf1050f6508>:0
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Android.Tasks.BuildApk.Execute () [0x00346] in <a9f581d0c2a2409a88d42cf1050f6508>:0
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/msbuild-15.4/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:631
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteInstantiatedTask>d__26.MoveNext () [0x0022d] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/msbuild-15.4/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:787
Done building target "_BuildApkFastDev" in project "BadgeScan.Droid.csproj" -- FAILED.

Done building project "BadgeScan.Droid.csproj" -- FAILED.

Build FAILED.

/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(2003,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018: The "BuildApk" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018: Xamarin.Tools.Zip.ZipIOException: Stream is not a ZIP archive
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Tools.Zip.ZipArchive..ctor (System.IO.Stream stream, Xamarin.Tools.Zip.IPlatformOptions options, Xamarin.Tools.Zip.OpenFlags flags) [0x00133] in <e32885fa80124c1badcf1508ab795e19>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Tools.Zip.UnixZipArchive..ctor (System.IO.Stream stream, Xamarin.Tools.Zip.UnixPlatformOptions options, Xamarin.Tools.Zip.OpenFlags flags) [0x00000] in <e32885fa80124c1badcf1508ab795e19>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Tools.Zip.ZipArchive.CreateInstanceFromStream (System.IO.Stream stream, Xamarin.Tools.Zip.OpenFlags flags, Xamarin.Tools.Zip.IPlatformOptions options) [0x00014] in <e32885fa80124c1badcf1508ab795e19>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Tools.Zip.ZipArchive.Open (System.IO.Stream stream, Xamarin.Tools.Zip.IPlatformOptions options) [0x00000] in <e32885fa80124c1badcf1508ab795e19>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Android.Tasks.BuildApk.ExecuteWithAbi (System.String supportedAbis, System.String apkInputPath, System.String apkOutputPath) [0x002c2] in <a9f581d0c2a2409a88d42cf1050f6508>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Xamarin.Android.Tasks.BuildApk.Execute () [0x00346] in <a9f581d0c2a2409a88d42cf1050f6508>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/msbuild-15.4/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:631
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(231,2): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteInstantiatedTask>d__26.MoveNext () [0x0022d] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/msbuild-15.4/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:787
    1 Warning(s)
    1 Error(s)

Time Elapsed 00:00:03.93

Maintainig "state" of page, when device back-button is used to navigate back to it?

$
0
0

Hi
Say there are 2 scrollable pages A and B, each having 100 items in a list, A being the one displayed when App starts.
User enters, scrolls down page A so that items 20-30 are displayed, then clicks button which navigates to B [Navigation.PushAsync(new Pages.B)]
Now user clicks the device's back button, and B is removed from the navigation stack (using Navigation.PopAsync ())
I would expect Page A to "maintain state" and remain at show items 20-30 again, but it does not happen (list displays items 1-10 again)
Does anyone know why? How can I switch between pages so that a page "preserves its state"?

MultiDex in Release Mode

$
0
0

Hello.
I have an issue with launching my app in Release mode.

Looks like I have reached my limit of 65k references, so I have enabled MultiDex for Debug and Release modes. When deploying in Debug mode, my app is working fine and everything OK. But when I launch it Release mode, it crashes at stratup. Here's a Device Log

Time    Device Name Type    PID Tag Message
06-25 13:36:02.311   4.5" KitKat (4.4) HDPI Phone   Error   7043    AndroidRuntime  java.lang.RuntimeException: Unable to instantiate application android.support.multidex.MultiDexApplication: java.lang.ClassNotFoundException: Didn't find class "android.support.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.kasianeko.myapp1-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.kasianeko.myapp1-1, /system/lib]]
    at android.app.LoadedApk.makeApplication(LoadedApk.java:507)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4301)
    at android.app.ActivityThread.access$1500(ActivityThread.java:135)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5001)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    at dalvik.system.NativeStart.main(Native Method)
06-25 13:36:03.563   4.5" KitKat (4.4) HDPI Phone   Warning 690 EGL_emulation   eglSurfaceAttrib not implemented
06-25 13:36:03.335   4.5" KitKat (4.4) HDPI Phone   Warning 461 ActivityManager Activity pause timeout for ActivityRecord{b32e4288 u0 com.kasianeko.myapp1/md5304a4440170d60bf491ab72e27e31f91.MainActivity t21 f}
06-25 13:36:02.311   4.5" KitKat (4.4) HDPI Phone   Error   7043    AndroidRuntime  Process: com.kasianeko.my-app1, PID: 7043
06-25 13:36:02.311   4.5" KitKat (4.4) HDPI Phone   Error   7043    AndroidRuntime  FATAL EXCEPTION: main
06-25 13:36:02.311   4.5" KitKat (4.4) HDPI Phone   Error   7043    AndroidRuntime  Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.kasianeko.myapp1-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.kasianeko.myapp1-1, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
    at android.app.Instrumentation.newApplication(Instrumentation.java:975)
    at android.app.LoadedApk.makeApplication(LoadedApk.java:502)
    ... 11 more
  Force finishing activity com.kasianeko.myapp1/md5304a4440170d60bf491ab72e27e31f91.MainActivity
06-25 13:36:02.307   4.5" KitKat (4.4) HDPI Phone   Debug   7043    AndroidRuntime  Shutting down VM
06-25 13:36:02.307   4.5" KitKat (4.4) HDPI Phone   Warning 7043    dalvikvm    threadid=1: thread exiting with uncaught exception (group=0xb2c92b20)

I tried to add some lines into multidex.keep:

        android/support/multidex/ZipUtil.class
        android/support/multidex/ZipUtil$CentralDirectory.class
        android/support/multidex/MultiDex$V14.class
        android/support/multidex/MultiDexExtractor$1.class
        android/support/multidex/MultiDexExtractor.class
        android/support/multidex/MultiDexApplication.class
        android/support/multidex/MultiDex.class
        android/support/multidex/MultiDex$V19.class
        android/support/multidex/MultiDex$V4.class
        mono/MonoRuntimeProvider.class
        mono/MonoPackageManager.class
        mono/MonoPackageManager_Resources.class
        mono/android/Seppuku.class
        mono/android/app/ApplicationRegistration.class
        mono/android/app/NotifyTimeZoneChanges.class
        md5b3cec4ec1831c6a7ac763d1a35a98e61/MyApp1GcmListenerService.class
        md5b3cec4ec1831c6a7ac763d1a35a98e61/MyApp1InstanceIDListenerService.class
        md5b3cec4ec1831c6a7ac763d1a35a98e61/RegistrationIntentService.class

No luck.

Another thing I found out is: in obj/Debug/android/big I have classes.dex and classes2.dex, but in obj/Release/android/bin/ I have only classes.dex.

I have also specified Android Build SDK to 25.0.3, and the minimum API level is 19 (to support KitKat 4.4.2). ProGuard specified for Release mode.
In AndroidManifest I specified this:

<application android:name="android.support.multidex.MultiDexApplication">
</application>

So, I have no any ideas what's going on with Android. Looks very weird for Windows dev.


How to change the MasterDetailPage.MasterBehavior depending on the width

$
0
0

Hello,

I write a Xamarin forms application for UWP and try to use an adaptive UI. On a small screen I want the MasterBehavior to be 'popover' and on a large screen it should be 'split'. I registered the SizeChanged event and change the MasterBehaviour but it does not work. What must I do to make it work?

public MainPage()
        {
            this.InitializeComponent();
            SizeChanged += OnSizeChanged;
        }

        private void OnSizeChanged(object sender, EventArgs e)
        {
            if ( Width < 700)
            {
                this.MasterBehavior = MasterBehavior.Popover;
                UpdateChildrenLayout();
            } else
            {
                this.MasterBehavior = MasterBehavior.Split;
                UpdateChildrenLayout();
            }
        }

How to write from byte array to Android and iOS devices?

$
0
0

Hi,

I want to create a file(.pdf, .docx, .jpeg etc.) from byte array in my application. I'm getting the byte array from web service. But I couldn't write this byte array to a file.

Here is my code;

string directory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string folderName = "BILPLASManagementSystem"; if (!File.Exists(Path.Combine(directory, folderName))) Directory.CreateDirectory(Path.Combine(directory, folderName)); string docName = "TempDoc" + ((Directory.GetFiles(Path.Combine(directory, folderName), "TempDoc*" + _selectedDocument.FileExtension).Length) + 1).ToString() + _selectedDocument.FileExtension; string tempDirectory = Path.Combine(directory, folderName, docName); File.WriteAllBytes(tempDirectory, _selectedDocument.DocumentBytes);

This code gets no error, but it doesn't create any file either.

What am I missing?

Thank you.

Avoiding Obsolete Default Constructor with Android Custom Renderers in 2.5

$
0
0

Can anyone explain how to avoid the obsolete default constructor for android custom renderers in xamarin forms 2.5?

An example of a custom renderer from 2.4

[assembly: ExportRenderer(typeof(AutoCompleteEntry), typeof(AutoCompleteEntryRenderer))]
namespace MyApp.Droid
{
    public class AutoCompleteEntryRenderer : ViewRenderer<AutoCompleteEntry, AutoCompleteTextView>
    {
        protected override void OnElementChanged(ElementChangedEventArgs<AutoCompleteEntry> e) {
            base.OnElementChanged(e);

            if (e.OldElement == null && this.Element != null) {
                // Perform initialization
            }
        }
    }
}

However adding a new constructor that takes a Context does not work with the ExportRenderer attribute, it will throw an exception on run.

public AutoCompleteEntryRenderer(Context context)
    : base(context) {
}

Referencing Forms.Context is also obsolete so I'm just not sure how to get a context reference in 2.5

MasterBehaviour on UWP is not working correctly.

$
0
0

Hello Everyone,
I'm developing an Xamarin.Form application for 3 platforms namely UWP, iOS & Android using MasterDetailPage.
I basically trying to get an adaptive UI on masterdetailpage by leveraging the MasterBehaviour Property of it.
But it doesnot seems to work fine dynamically when device's orientation is changing nor implementing on OnSizeChanged event.
Your suggestion would be a great help .
I would like to know on if i go with some custom render er on UWP , what would be the right approach as i dont have any UWP knowledge. ?

Thanks,
Vsh

Where is System.Net.Mail?

$
0
0

Dear all,

Trying to use SmtpClient and MailMessage here, however, the following situation occurs:
1) when hitting CTRL + . on any of them, it suggests to use System.Net.Mail
2) when accepting the suggestion, System.Net.Mail gets highlighted saying that System.Net does not contain Mail.

On closer inspection, actually typing System.Net.... does not reveal Mail or any other things.
Inspecting the .NET reference from the PCL project, and going to System.Net, all the things are there.

Did anyone bump into this in a Forms PCL project until now?

Thank you!

Problem with Rg.Plugin.popup plugin

$
0
0

So i've installed this plgin called rg.plugin.popup, and its needed to define it in mainActivity like this

Rg.Plugins.Popup.Popup.Init(this, bundle);

But the error is : "Severity Code Description Project File Line Suppression State
Error CS0234 The type or namespace name 'Popup' does not exist in the namespace 'Rg.Plugins.Popup' (are you missing an assembly reference?) CloudDMS.DemoMobileApp.Android"

Anyone had a similar problem with this plugin?

how to open slide menu without using action bar and masterdetailpage for android in xamarin.forms?

$
0
0

Hi,
I want to create my own slide menu, that will open on button click in xamarin.forms. I don't want to use master detail page and action bar for it. The button will be on page and when user click on it, it should open the slide menu. Is it possible in xamarin.forms that we can open slide menu without using master detail page and action bar? If no then how we can do this?

Regards,
Anand Dubey


Why is the set; never called on this variable when the collection is changed?

$
0
0

Hi! Ive been trying to get this code snippet to work for a while now, but cant figure out why the "Set;" is never called when i add items to the DropdownList, instead it just immidietly goes to the get; and then its done. Any ideas?

    public ObservableCollection<DropdownItem> DropdownList
    {
        protected set
        {
            if (_collection != value)
            {
            _collection = value;
            OnPropertyChanged();
            }
        }
        get { return _collection; }
    }

I have a similar object and the Set; works on this:

    public UInt16 U16Value
    {
        protected set
        {
            if (_UInt16val != value)
            {
                _UInt16val = value;
                OnPropertyChanged();
            }
        }
        get { return _UInt16val; }
    }

Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException

$
0
0

Facing Below issue.Please help me to resolve it

Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (1), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).

Native stack trace:

0   CoreFoundation                      0x0000000102e4612b __exceptionPreprocess + 171

1   libobjc.A.dylib                     0x0000000110717f41 objc_exception_throw + 48

2   CoreFoundation                      0x0000000102e4b2f2 +[NSException raise:format:arguments:] + 98

3   Foundation                          0x0000000103a75d69 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193

4   UIKit                               0x00000001074dc209 -[UITableView _endCellAnimationsWithContext:] + 19416

5   UIKit                               0x00000001074f7075 -[UITableView endUpdates] + 75

6   AutoCompleteExample.iOS             0x00000001027679f9 xamarin_dyn_objc_msgSend + 217

7   ???                                 0x0000000130a75362 0x0 + 5111239522

What's InvalidRegistration

$
0
0

I'm trying to send a notification. My App is running and i have this console to send:

using System.Threading.Tasks;
using FirebaseNet.Messaging;
using System;

namespace MessageSender
{
    class MessageSender
    {



        static void Main(string[] args)
        {
            Task t = new Task(async () =>
            {
                await foo();
            });
            t.Start();


            Console.ReadLine();
        }

        public static async Task<IFCMResponse> foo()
        {
            FCMClient client = new FCMClient("AAAAx6rZ8I8:APA91bEAXEDGanoON2gKV2sAblRwZqe9lNCAFsD0r_FAg_P_Zq3C3JANTCDWbMo18pAzDy4wJ0720sQLsKUhOpoNdT9QERe3H6D9kb7y59_fO7ucwrdYg6Mu9x8HgUN9YLpiznLFxNRP"); //as derived from https://console.firebase.google.com/project/
            var message = new Message()
            {
                To = "857564901519", //topic example /topics/all
                Notification = new AndroidNotification()
                {
                    Body = "great match!",
                    Title = "Portugal vs. Denmark",
                }
            };
            var result = await client.SendMessageAsync(message);
            return result;
        }
    }
}

I putted a break point and when the cursor arrive in return result, fire this message:

InvalidRegistration

see below the screenshot

My Server Key:

AAAAx6rZ8I8:APA91bEAXEDGanoON2gKV2sAblRwZqe9lNCAFsD0r_FAg_P_Zq3C3JANTCDWbMo18pAzDy4wJ0720sQLsKUhOpoNdT9QERe3H6D9kb7y59_fO7ucwrdYg6Mu9x8HgUN9YLpiznLFxNRP

and Sender_ID:

857564901519

below the Constant class. Is correct or lack something?

using Android.App;


[assembly: Permission(Name = "com.inetglobal.autorizador.br.permission.C2D_MESSAGE")] //, ProtectionLevel = Android.Content.PM.Protection.Signature)]
[assembly: UsesPermission(Name = "com.inetglobal.autorizador.br.permission.C2D_MESSAGE")]
[assembly: UsesPermission(Name = "com.google.android.c2dm.permission.RECEIVE")]

//GET_ACCOUNTS is only needed for android versions 4.0.3 and below
[assembly: UsesPermission(Name = "android.permission.GET_ACCOUNTS")]
[assembly: UsesPermission(Name = "android.permission.INTERNET")]
[assembly: UsesPermission(Name = "android.permission.WAKE_LOCK")]


namespace Gcm.Client
{
    public class Logger
    {
        public static bool Enabled = false;

        public static void Debug(string msg)
        {
            if (Enabled)
                Android.Util.Log.Debug ("GCM-CLIENT", msg);
        }
    }

    public class Constants
    {
        public const string SENDER_ID = "857564901519";
        //Enter Sender id listed in settings of your app in firebase console
        //https://console.firebase.google.com/
        //Sender ID of your application

        public const string INTENT_TO_GCM_REGISTRATION = "com.google.android.c2dm.intent.REGISTER";

        /*      *
        * Intent sent to GCM to unregister the application.
        */
        public const string INTENT_TO_GCM_UNREGISTRATION = "com.google.android.c2dm.intent.UNREGISTER";

        /*      *
        * Intent sent by GCM indicating with the result of a registration request.
        */
        public const string INTENT_FROM_GCM_REGISTRATION_CALLBACK = "com.google.android.c2dm.intent.REGISTRATION";

        /*      *
        * Intent used by the GCM library to indicate that the registration call
        * should be retried.
        */
        public const string INTENT_FROM_GCM_LIBRARY_RETRY = "com.google.android.gcm.intent.RETRY";

        /*      *
        * Intent sent by GCM containing a message.
        */
        public const string INTENT_FROM_GCM_MESSAGE = "com.google.android.c2dm.intent.RECEIVE";

        /*      *
        * Extra used on {@link #INTENT_TO_GCM_REGISTRATION} to indicate the sender
        * account (a Google email) that owns the application.
        */
        public const string EXTRA_SENDER = "sender";

        /*      *
        * Extra used on {@link #INTENT_TO_GCM_REGISTRATION} to get the application
        * id.
        */
        public const string EXTRA_APPLICATION_PENDING_INTENT = "app";

        /*      *
        * Extra used on {@link #INTENT_FROM_GCM_REGISTRATION_CALLBACK} to indicate
        * that the application has been unregistered.
        */
        public const string EXTRA_UNREGISTERED = "unregistered";

        /*      *
        * Extra used on {@link #INTENT_FROM_GCM_REGISTRATION_CALLBACK} to indicate
        * an error when the registration fails. See constants starting with ERROR_
        * for possible values.
        */
        public const string EXTRA_ERROR = "error";

        /*      *
        * Extra used on {@link #INTENT_FROM_GCM_REGISTRATION_CALLBACK} to indicate
        * the registration id when the registration succeeds.
        */
        public const string EXTRA_REGISTRATION_ID = "registration_id";

        /*      *
        * Type of message present in the {@link #INTENT_FROM_GCM_MESSAGE} intent.
        * This extra is only set for special messages sent from GCM, not for
        * messages originated from the application.
        */
        public const string EXTRA_SPECIAL_MESSAGE = "message_type";

        /*      *
        * Special message indicating the server deleted the pending messages.
        */
        public const string VALUE_DELETED_MESSAGES = "deleted_messages";

        /*      *
        * Number of messages deleted by the server because the device was idle.
        * Present only on messages of special type
        * {@link #VALUE_DELETED_MESSAGES}
        */
        public const string EXTRA_TOTAL_DELETED = "total_deleted";

        /*      *
        * Permission necessary to receive GCM intents.
        */
        public const string PERMISSION_GCM_INTENTS = "com.google.android.c2dm.permission.SEND";

        /*      *
        * @see GCMBroadcastReceiver
        */
        public const string DEFAULT_INTENT_SERVICE_CLASS_NAME = ".GCMIntentService";

        /*      *
        * The device can't read the response, or there was a 500/503 from the
        * server that can be retried later. The application should use exponential
        * back off and retry.
        */
        public const string ERROR_SERVICE_NOT_AVAILABLE = "SERVICE_NOT_AVAILABLE";

        /*      *
        * There is no Google account on the phone. The application should ask the
        * user to open the account manager and add a Google account.
        */
        public const string ERROR_ACCOUNT_MISSING = "ACCOUNT_MISSING";

        /*      *
        * Bad password. The application should ask the user to enter his/her
        * password, and let user retry manually later. Fix on the device side.
        */
        public const string ERROR_AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED";

        /*      *
        * The request sent by the phone does not contain the expected parameters.
        * This phone doesn't currently support GCM.
        */
        public const string ERROR_INVALID_PARAMETERS = "INVALID_PARAMETERS";
        /*      *
        * The sender account is not recognized. Fix on the device side.
        */
        public const string ERROR_INVALID_SENDER = "INVALID_SENDER";

        /*      *
        * Incorrect phone registration with Google. This phone doesn't currently
        * support GCM.
        */
        public const string ERROR_PHONE_REGISTRATION_ERROR = "PHONE_REGISTRATION_ERROR";

    }
}

Loading popup showing incorrectly

$
0
0

I have a WorkOrder List page, when user tap any list it will open a details page
Inside the details page I implement a popup(for load data from service using RgPlugin) which show loading indicator, but problem is that when user click on list item it will open popup very first so that loading popup showing over list page,then details page complete to load.

so I want loading popup should open after details page finish to load.

How to solve this?

How to remove default Blue Splash screen from Xamarin.Forms App , specifically in iOs app.

$
0
0

I want to remove default blue colored splash screen from Xamarin Forms App.
Can you please suggest , how to do this..

Viewing all 89864 articles
Browse latest View live


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