GithubHelp home page GithubHelp logo

xamarin / docs-archive Goto Github PK

View Code? Open in Web Editor NEW
565.0 186.0 1.5K 474.81 MB

Xamarin docs archive

Home Page: https://docs.microsoft.com/xamarin

License: Creative Commons Attribution 4.0 International

C# 43.07% HTML 1.90% CSS 4.06% F# 0.06% Java 48.37% JavaScript 2.55%
xamarin xamarin-ios xamarin-android xamarin-mac xamarin-forms

docs-archive's Introduction

Xamarin Docs Archive

The information in this repo has been archived. It is no longer current, nor is it supported or updated.

Current documentation

Visit docs.microsoft.com/xamarin.

Code of Conduct

This project uses the Microsoft Open Source Code of Conduct.

For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Legal Notices

Microsoft and any contributors grant you a license to the Microsoft documentation and other content in this repository under the Creative Commons Attribution 4.0 International Public License, see the LICENSE file, and grant you a license to any code in the repository under the MIT License, see the LICENSE-CODE file.

Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.

Privacy information can be found at https://privacy.microsoft.com/en-us/

Microsoft and any contributors reserve all others rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel or otherwise.

docs-archive's People

Contributors

ajgriesemer avatar albilaga avatar batchunag avatar bytesguy avatar conceptdev avatar cuchalin avatar davidbritch avatar flyingdeveloper avatar gdmarquez90 avatar harteex avatar jzeferino avatar kmullins-xam avatar lobrien avatar michaelnorman avatar nathancastle avatar ndastur avatar olegoid avatar profexorgeek avatar timeyoutakeit avatar topgenorth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docs-archive's Issues

Href link inside the PDF is not navigating

Hi,

I have a pdf with lot of herf link inside it.

  1. Navigating Event is not raised in the custom web view ,whereas it works fine in normal Webview
  2. This pdf herf links are not navigating, there is no action on it.

Camera Intent Exceptions

The Camera Intent recipe in recipes/Recipes/android/other_ux/camera_intent/take_a_picture_and_save_using_camera_app/ experiences some exceptions. When run with SDK 23 it throws an exception due to permissions having not been requested first. More importantly when run on SDK 28 it throws Android.OS.FileUriExposedException. Please update when possible.

Has any tried the "Display a Local PDF File in a WebView" recipe in a PRISM Forms App?

I'm struggling with convert the "Display a Local PDF File in a WebView" recipe to Prism. https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/controls/display-pdf/

The recipe runs fine with VS 2017 and Droid. My Forms/Prism application fails for both Droid and UWP(haven't tried iOS) with a can't find PDF error. Several of us in my group have looked the code over and it's a carbon copy of the sample.

Thanks for any thoughts.
-Mark

Cannot convert type

On this line: ((MapView)Control).GetMapAsync(this);
Cannot convert 'Android.Views.View' to 'Xamarin.Forms.Maps.Map'.
screen shot 2016-06-01 at 21 31 40

NetworkInfo.IsConnected Object reference not set to an instance of an object

Hi,

i'm having a System.NullReferenceException error when my smartphone is not connected on internet. But when i'm connected on wifi or roaming, there are no error.

NetworkInfo info = connectivityManager.ActiveNetworkInfo; bool isOnline = info.IsConnected; Console.WriteLine(isOnline);

How can i fix that?

The DisplayPDF iOS example does not work properly

The iOS example cannot possibly be rendering correctly. This is what I see in my iPhone 4S simulator and on my iPhone 6S device. No pages render full screen, they all tiled along the left side, and the last 4 pages never seem to load.

2015-12-09 13 10 21

PDF is shown as blank

I have implemented exactly the same project in my Xamarin.Forms project and I have also added the PDF in the Content Folder of iOS project. However, when I run the project, the PDF is shown as blank.

The fileName in my iOS renderer is generated properly as
/var/containers/Bundle/Application/47AB72F7-6881-40B9-BB0E-88E547752DA6/CrashAppiOS.app/Content/BookPreview2-Ch18-Rel0417.pdf"

But the screen is shown as blank. Any idea what can be the reason ?

Xamarin.android

I need to implement auto capture image without user interaction after some seconds. help me
lrfit

How exactly do we use this with SimpleIoc or dependencies?

I am trying to follow this example but how do I register ICredentialsService with simpleIOC or other dependency container if concrete implementations are in different projects(android, ios)? How do we know which concrete class to instantiate?? I get errors with your implementation, cannot instantiate..

Reverse Geocode Location

Hello,
I tried to test the sample "ReverseGeocode" but I can't get any address and I always get the message "Could not find any addresses."...

I have activated the different services that seem necessary:
INTERNET
ACCESS_FINE_LOCATION
ACCESS_COARSE_LOCATION
ACCESS_LOCATION_EXTRA_COMMANDS
ACCESS_MOCK_LOCATION
ACCESS_NETWORK_STATE
ACCESS_WIFI_STATE

Would there anything I have forgotten?

Load file from Application Folder

I'm trying to read a document I have stored in the LocalApplicationData folder.
I pass the document's location to the Webview through the URI property.
However, the web view displays the "file not found" error.
I think is due to the library not having access to this folder.
Is there any way I can read the file without having to store it in a public folder?

enhance add_an_autocomplete_text_input recipe

the recipe, add_an_autocomplete_text_input, is really basic. Microsoft Docs already has a basic example using a static arraylist, be nice if the recipe here showed how to fetch from an API of some sort.

The DisplayPDF Droid example does not work properly on older APIs

Here is a screenshot on my Android Emulator running API 17

screenshot 2015-12-10 10 55 23

However, it seems to work fine on my Moto X.

I'm guessing that this example only works on androids that use Chrome as the default browser?

This needs to be mentioned somewhere in the docs as this example is no good for people trying to support older versions and actually means we need another solution to deal with the older browser, especially since the example project targets API 15.

Call C# from JavaScrip

Hi, I'm a beginner using a Webview of Xamarin.
But I could not call C# from JavaScript.
JavaScript shows: ReferenceError: CSharp is not defined.
Here are some code below:

file:CallJavaScript.Droid/MainActivity.cs

//some code from:recipes/cross-platform/xamarin-forms/Controls/CallJavaScript/Droid/MainActivity.cs

//insert interface make JavaScript call CSharp.ShowToast()
WebView view = new WebView(this);
view.Settings.JavaScriptEnabled = true;
view.AddJavascriptInterface(new MyJSInterface(this), "CSharp");

And I wrote a interface to call from JavaScript.
file:CallJavaScript.Droid/MyJSInterface.cs

using Android.Content;
using Android.Webkit;
using Android.Widget;
using Java.Interop;

namespace CallJavaScript
{
    class MyJSInterface : Java.Lang.Object
    {
        Context context;

        public MyJSInterface(Context context)
        {
            this.context = context;
        }

        [Export]
        [JavascriptInterface]
        public void ShowToast() //JavaScript should trigger it, but not
        {            
            Toast.MakeText(context, "Hello from C#", ToastLength.Short).Show();
            
        }
    }
}

file:CallJavaScript/index.html

<html>
<body>
    <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
    <div id='multiplicationtable'></div>
    <button type='button' onClick='callCSharp()'>Call C#</button>
    <script type="text/javascript">
        function printMultiplicationTable(num, stop) {
            var number = parseInt(num);
            var stopNumber = parseInt(stop);

            $('#multiplicationtable').empty();
            for (var index = 1; index <= stopNumber; index++) {
                $('#multiplicationtable').append(number + ' x ' + index + " = " + number * index + '<br/>');
            }
        }
        function callCSharp() {
            try {
                CSharp.ShowToast();
            }
            catch (err) {
                var err = err.toString();
                $('#multiplicationtable').append(err);
            }
        }
    </script>
</body>
</html>

Do you have any advice? Thank you in advance.

DisplayPDF Android - Need to hide the top bar and enable pinch zoom

In my project I am displaying a PDF file from API call. I could able to display the PDF in my Android project, however it is showing black color top bar(title bar). I need to disable the title bar as well as I need to enable the pinch zoom functionality. is there any possible way to accomplish my changes?.

How to display only one page of a pdf at a time?

I want to display only one page at a time i.e. I do not want the scroll bar to load next page unless and until user clicks Next Page button (that is available on side menu).

Is their any configuration/setting available for that ? Or do I need to comment out certain code to achieve this behavior ?

The DisplayPDF Droid Example can fail to display PDF

If you do not see the PDF, check your debug output log for the following:

I/chromium(31570): [INFO:CONSOLE(0)] "XMLHttpRequest cannot load file:///android_asset/Content/pdf-test.pdf. Cross origin requests are only supported for protocol schemes: http, data, chrome, https.", source: file:///android_asset/pdfjs/web/viewer.html?file=file:///android_asset/Content/pdf-test.pdf (0)

To resolve, add

Control.Settings.AllowUniversalAccessFromFileURLs = true;

to your android web view renderer.

Record and play video tilt issue

Hi,
I am facing issue with record and play video example given. Here it works but with 90 degree tilt in video during both record and playback. I could fix the tilt for record with setCameraorientation
record.Click += delegate {

            video.StopPlayback ();
            var mCamera = GetCameraInstance();
            mCamera.SetDisplayOrientation(90);
            mCamera.Unlock();

            recorder = new MediaRecorder ();
            recorder.SetCamera(mCamera);
            recorder.SetVideoSource (VideoSource.Camera); 
            recorder.SetAudioSource (AudioSource.Mic);              
            recorder.SetOutputFormat (OutputFormat.Default);
            recorder.SetVideoEncoder (VideoEncoder.Default); 
            recorder.SetAudioEncoder (AudioEncoder.Default);      
            recorder.SetOutputFile (path);       
            recorder.SetPreviewDisplay (video.Holder.Surface);         
            recorder.Prepare ();
            recorder.Start ();      
        };

stop.Click += delegate {

            if (recorder != null) {
                recorder.Stop ();
                recorder.Release ();
                var mCamera = GetCameraInstance();
                mCamera.StopPreview();
                mCamera.Release();
            }
        };

With Camera orientation setting now recording works fine. But playback was crashing. So under stop i had to stop camera preview and release camera. But playback still plays tilted,
How do we resolve the playback to play correctly.

StoreCredential - Android proj is giving Java.Security error

While saving the account on Xiomi Redmi Note3 Player (Android 6.0 - API23), giving error - uncaught exception - Constructor on type 'Java.Security.KeyStore+SecretKeyEntry' not found. (Missin...)

on second line -
AccountStore store = AccountStore.Create();
store.Save(account, App.AppName);

Android app crashes when showing/scrolling a pdf

Our Android app crashes a lot when we try to open or scroll a pdf.
Sometimes it happens immediately, sometimes after a while.
I don't know what causes the crash, but I think it happens faster on slow devices and with larger pdf's.

I was able to reproduce the crash in your example.
I just replaced the App constructor by the following code:

    public App ()
	{
        //MainPage = new WebViewPageCS();

        MainPage = new NavigationPage(new ContentPage()
        {
            Content = new Button
            {
                Command = new Command(async () =>
                {
                    await Navigation.PushAsync(new WebViewPageCS());
                })
            }
        });

        Navigation = MainPage.Navigation;
    }

Do you know what te problem might be or how we can fix this?
Thanks in advance!

Custom Compound View starts with an error

The name of the package is "com.xamarin.recipes.customcompoundview"
File Main.axml references the wrong package.
Replace the line:
"<com.xamarin.recipes.compositecontrol.DatePickerTextView"
with this one:
"<com.xamarin.recipes.customcompoundview.DatePickerTextView"

The project "RecordVideo" give a error Visual Studio

Under Xamarin for Visual Studio 2015 the project "RecordVideo" cannot work!

record.Click += delegate {

                video.StopPlayback ();

                recorder = new MediaRecorder ();
                recorder.SetVideoSource (VideoSource.Camera); 
                recorder.SetAudioSource (AudioSource.Mic);              
                recorder.SetOutputFormat (OutputFormat.Default);
                recorder.SetVideoEncoder (VideoEncoder.Default); 
                recorder.SetAudioEncoder (AudioEncoder.Default);      
                recorder.SetOutputFile (path);       
                recorder.SetPreviewDisplay(video.Holder.Surface);
                recorder.Prepare();
                recorder.Start();
            };

The error is: Java.Lang.RuntimeException: start failed. at lcode: recorder.Start();

I tried in all ways to modify the project, replacing the video object, and delaying the start, so that the surface is created.

The problem is that in my version of Xamarin, the object video fails to create the surface. The surface is not created! Never!

I tried with virtual devices and real, and different versions of the API.

You can adjust the project and make it work with Visual Studio 2015 and the latest version of Xamarin?

HelloMultiScreenFinal And HelloMultiScreen are exactly the same code

I'm trying to learn how to obtain data back from a second activity to the first one through this page:

https://developer.xamarin.com/recipes/android/fundamentals/activity/start_activity_for_result/

There, aparead both examples, HelloMultiScreen and HelloMultiScreenFinal as examples to check in order to learn to use Intents and transition between activities, the thing is.

HelloMultiScreen and HelloMultiScreenFinal

have exactly the same code, and are lacking the StartActivityForResult example promised in here:
https://developer.xamarin.com/recipes/android/fundamentals/activity/start_activity_for_result/

I asume than the final was intended to bring data back to the first one, because well, is the last lession there, but still that's NOT something present in any of both, equals codes.

Thanks a lot.

how to make Download Progress forms

I am wanting to make a progress bar with the percentage of the download, but the problem with the HttpClient, I can not access the header to know the file size that is being downloaded. I'm currently using the PCL project AndHud, but I can not do this, any help?
I had already looked at that link, and also tried others, but could not really convert this stream to array.
below is the code I'm using, the problem is being in part [ ((read = stream_.Read(buffer, 0, buffer.Length)) > 0) ] always returns 0

public  async Task<int> CreateDownloadTask(string urlToDownload, IProgress<DownloadBytesProgress> progessReporter)
        {
            int receivedBytes = 0;
            int totalBytes = 0;
            WebClient client = new WebClient();
            Stream stream_;
            using (var stream = await client.OpenReadTaskAsync(urlToDownload))
            {
                byte[] buffer = new byte[4096];
                totalBytes = Int32.Parse(client.ResponseHeaders[HttpResponseHeader.ContentLength]);

                for (;;)
                {
                    int bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length);
                    if (bytesRead == 0)
                    {
                        await Task.Yield();
                        break;
                    }

                    receivedBytes += bytesRead;
                    if (progessReporter != null)
                    {
                        DownloadBytesProgress args = new DownloadBytesProgress(urlToDownload, receivedBytes, totalBytes);
                        progessReporter.Report(args);
                    }
                }


                stream_ = stream;
            }

             byte[] buffer = new byte[16*1024];
            using (MemoryStream ms = new MemoryStream())
            {
                int read;
                while ((read = stream_.Read(buffer, 0, buffer.Length)) > 0)
                {
                    ms.Write(buffer, 0, read);
                }
                //call method of saving in database
                SaveDataBase(ms.ToArray());
            }
            return receivedBytes;
        }

Chose a Photo From Gallery Sample crashed on iOS 10

Trying to run the sample here:

https://github.com/xamarin/recipes/tree/master/ios/media/video_and_photos/choose_a_photo_from_the_gallery

Will now crash when running on iOS 10 Simulators or devices with the following when pressing the Picker button:

2016-09-29 11:25:47.079 MapView[17760:556182] critical:
Native stacktrace:

2016-09-29 11:25:47.080 MapView[17760:556182] critical: 0 MapView 0x00203c5d mono_handle_native_sigsegv + 317
2016-09-29 11:25:47.080 MapView[17760:556182] critical: 1 MapView 0x0020da61 sigabrt_signal_handler + 161
2016-09-29 11:25:47.080 MapView[17760:556182] critical: 2 libsystem_platform.dylib 0x0b33f79b _sigtramp + 43
2016-09-29 11:25:47.080 MapView[17760:556182] critical: 3 ??? 0xffffffff 0x0 + 4294967295
2016-09-29 11:25:47.081 MapView[17760:556182] critical: 4 libsystem_c.dylib 0x0afdf137 abort + 141
2016-09-29 11:25:47.081 MapView[17760:556182] critical: 5 libsystem_sim_kernel.dylib 0x0b0a0fd7 __interposition_sim_fallback_abort_with_payload + 0
2016-09-29 11:25:47.081 MapView[17760:556182] critical: 6 libsystem_sim_kernel.dylib 0x0b0a0ff7 __interposition_sim_fallback_abort_with_payload + 32
2016-09-29 11:25:47.081 MapView[17760:556182] critical: 7 TCC 0x0c9a9621 CRASHING_DUE_TO_PRIVACY_VIOLATION + 236
2016-09-29 11:25:47.081 MapView[17760:556182] critical: 8 TCC 0x0c9a9535 CRASHING_DUE_TO_PRIVACY_VIOLATION + 0
2016-09-29 11:25:47.082 MapView[17760:556182] critical: 9 TCC 0x0c9ac6b9 __tccd_send_block_invoke + 292
2016-09-29 11:25:47.082 MapView[17760:556182] critical: 10 libxpc.dylib 0x0b1f179c _xpc_connection_reply_callout + 45
2016-09-29 11:25:47.082 MapView[17760:556182] critical: 11 libxpc.dylib 0x0b1e8a97 _xpc_connection_call_reply + 32
2016-09-29 11:25:47.082 MapView[17760:556182] critical: 12 libdispatch.dylib 0x0af006ef _dispatch_client_callout + 14
2016-09-29 11:25:47.082 MapView[17760:556182] critical: 13 libdispatch.dylib 0x0aee5c60 _dispatch_queue_override_invoke + 777
2016-09-29 11:25:47.083 MapView[17760:556182] critical: 14 libdispatch.dylib 0x0aee74bc _dispatch_root_queue_drain + 384
2016-09-29 11:25:47.083 MapView[17760:556182] critical: 15 libdispatch.dylib 0x0aee72d4 _dispatch_worker_thread3 + 134
2016-09-29 11:25:47.083 MapView[17760:556182] critical: 16 libsystem_pthread.dylib 0x0b34f25c _pthread_wqthread + 1050
2016-09-29 11:25:47.083 MapView[17760:556182] critical: 17 libsystem_pthread.dylib 0x0b34cf56 start_wqthread + 34
#2016-09-29 11:25:47.083 MapView[17760:556182] critical:

Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries

used by your application.

Other PDF files don't render on iOS sample project

I downloaded the sample project and it ran perfectly on iOS.
But, if I change the file and test with other PDF files, it doesn't work for me.

I've tested with a bunch of PDF files and the it only works with the file is in the sample project.

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.