Xamarin Forms: When the Text and Display are Set to Large, So Does Everything Else - xamarin

I'm having a problem on xamarin ios and android.
if the device has set the text and display size to large, all the sizes in my app become enlarged.
how can I set the default size when opening the app?

add following code in main activity android
//For android
#region Reset Fonts to default
/// <summary>
/// Reset fonts.
/// </summary>
public override Resources Resources
{
get
{
Resources res = base.Resources;
Configuration config = new Configuration();
config.SetToDefaults();
res.UpdateConfiguration(config, res.DisplayMetrics);
return res;
}
}
#endregion
//

Related

How to load Image using Skiasharp in Tizen watch using C#

I'm using C# Xamarin, and SkiaSharp to render image from resource folder. But I cannot get the correct image location.
Where I can find this image when run project? I try to looking for but no result:
You can get resource directory path using DirectoryInfo
https://samsung.github.io/TizenFX/API4/api/Tizen.Applications.DirectoryInfo.html#Tizen_Applications_DirectoryInfo_Resource
Here is a example that how to use
https://github.com/xamarin/Xamarin.Forms/blob/b59bb767a4367240983e93ab8e1a9a050dfea23b/Xamarin.Forms.Platform.Tizen/ResourcePath.cs#L27-L30
Thank you #Seungkenun Le. Base on his comment, I write a simple function to get resource path in Tizen Watch for Xamarin:
/// <summary>
/// Gets the resource path.
/// </summary>
/// <returns></returns>
internal static string GetResourcePath()
{
Tizen.Applications.Application app = Tizen.Applications.Application.Current;
if (app != null)
{
string resourcePath = app.DirectoryInfo.Resource;
if (Directory.Exists(resourcePath))
{
return resourcePath;
}
}
return string.Empty;
}

Azure Media Services v3 - Preset for generating captions: Azure Media Indexer 2 Preview

Is there a Preset for generating captions like the v2 Azure Media Indexer 2 Preview media processor, found in V2?
Hypothetical example:
var transform = await _client.Transforms.GetAsync(ResourceGroup, AccountName, TranscribeTransformName);
if (transform == null)
{
var output = new[]
{
new TransformOutput
{
Preset = new BuiltInMediaIndexerPreset
{
PresetName = "Azure Media Indexer 2 Preview"
}
}
};
Found the solution by examining the code comments from Go To References.
var transform = await _client.Transforms.GetAsync(ResourceGroup, AccountName, TranscribeTransformName);
if (transform == null)
{
var output = new[]
{
new TransformOutput(new VideoAnalyzerPreset("en-US", InsightsType.AudioInsightsOnly))
};
transform = await _client.Transforms.CreateOrUpdateAsync(ResourceGroup, AccountName, TranscribeTransformName, output);
}
/// <summary>
/// Initializes a new instance of the VideoAnalyzerPreset class.
/// </summary>
/// <param name="audioLanguage">The language for the audio payload in
/// the input using the BCP-47 format of 'language tag-region' (e.g:
/// 'en-US'). The list of supported languages are, 'en-US', 'en-GB',
/// 'es-ES', 'es-MX', 'fr-FR', 'it-IT', 'ja-JP', 'pt-BR', 'zh-CN',
/// 'de-DE', 'ar-EG', 'ru-RU', 'hi-IN'. If not specified, automatic
/// language detection would be employed. This feature currently
/// supports English, Chinese, French, German, Italian, Japanese,
/// Spanish, Russian, and Portuguese. The automatic detection works
/// best with audio recordings with clearly discernable speech. If
/// automatic detection fails to find the language, transcription would
/// fallback to English.</param>
/// <param name="insightsToExtract">The type of insights to be
/// extracted. If not set then based on the content the type will
/// selected. If the content is audi only then only audio insights are
/// extraced and if it is video only. Possible values include:
/// 'AudioInsightsOnly', 'VideoInsightsOnly', 'AllInsights'</param>
public VideoAnalyzerPreset(string audioLanguage = null, InsightsType? insightsToExtract = null);
Does captioning work for videos encoded with "AdaptiveStreaming" as well?

Bing maps SDK Win8.1 - Adding Layers

I'm trying to get map layers working in my Windows 8.1 app, which is using the Bing Maps SDK. Following microsoft's documentation, I created this code, and it doesn't seem to be working. No errors are thrown, making this problem even more confusing.
MapTileLayer tileLayer = new MapTileLayer();
tileLayer.TileSource = string.Format("http://mesonet.agron.iastate.edu/cache/tile.py/1.0.0/nexrad-n0q-900913/{{zoomLevel}}/{{x}}/{{y}}.png?{0}", DateTime.Now.ToString());
rMap.TileLayers.Add(tileLayer);
The URI variables zoomLevel,x, and y represent where to load the tile. 0 is the subdomain (This code was ported from Windows Phone 8, where it works fine
The Windows Phone 8 and Windows 8 are not the same control at all as for WP8 it's provided by Here and on Win8 it's provided by Microsoft.
Anyway, you can do what you want by using the following code:
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
Bing.Maps.MapTileLayer layer = new Bing.Maps.MapTileLayer();
layer.GetTileUri += layer_GetTileUri;
this.map.TileLayers.Add(layer);
}
private async void layer_GetTileUri(object sender, Bing.Maps.GetTileUriEventArgs e)
{
e.Uri = this.ComposeMyCustomUri(e);
}
You will find e is a specific parameter object of type GetTileUriEventArgs, see:
http://msdn.microsoft.com/en-us/library/jj672952.aspx

How to I get access NavigationService in a WIndows Phone app without going through a PhoneApplicationPage?

How to I get access NavigationService in a Windows Phone app without going through a PhoneApplicationPage? My goal is to pass it to the application's primary view-model on startup, a technique that worked quite well for me in WPF and Silverlight.
You can get it from the app's PhoneApplicationFrame. It will be accessible from anywhere in the app since every Windows Phone app has a Frame.
((PhoneApplicationFrame)Application.Current.RootVisual).Navigate(...);
Another place to get it is from the RootFrame field in the default implementation of Application:
#region Phone application initialization
// Avoid double-initialization
private bool phoneApplicationInitialized = false;
// Do not add any additional code to this method
private void InitializePhoneApplication()
{
if (phoneApplicationInitialized)
return;
// Create the frame but don't set it as RootVisual yet; this allows the splash
// screen to remain active until the application is ready to render.
RootFrame = new PhoneApplicationFrame();
RootFrame.Navigated += CompleteInitializePhoneApplication;
// Handle navigation failures
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
// Ensure we don't initialize again
phoneApplicationInitialized = true;
}
// Do not add any additional code to this method
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
{
// Set the root visual to allow the application to render
if (RootVisual != RootFrame)
RootVisual = RootFrame;
// Remove this handler since it is no longer needed
RootFrame.Navigated -= CompleteInitializePhoneApplication;
}
#endregion

Silverlight 4 dynamically downloaded satellite assembly problem

I am dynamically downloading a XAP file that has an embedded resource assembly, with a single resource file (ApplicationStrings.fr-CA.resx). I am using WebClient to pull down the XAP file and using the following code to load the assembly, based on work done by Jeff Prosise in this post: http://www.wintellect.com/CS/blogs/jprosise/archive/2010/06/21/dynamic-localization-in-silverlight.aspx.
Note that I also manually create the XAP file from the fr-CA folder with assembly and the ApplicationManifest.xaml, as described by Guy Smith-Ferrier's steps listed in his presentation here http://www.guysmithferrier.com/post/2010/10/Building-Localized-XAP-Resource-Files-For-Silverlight-4.aspx.
// Get the application manifest from the downloaded XAP
StreamResourceInfo sri = new StreamResourceInfo(e.Result, null);
XmlReader reader = XmlReader.Create(Application.GetResourceStream(sri, new Uri("AppManifest.xaml", UriKind.Relative)).Stream);
AssemblyPartCollection parts = new AssemblyPartCollection();
// Enumerate the assemblies in the downloaded XAP
if (reader.Read())
{
reader.ReadStartElement();
if (reader.ReadToNextSibling("Deployment.Parts"))
{
while (reader.ReadToFollowing("AssemblyPart"))
{
parts.Add(new AssemblyPart() { Source = reader.GetAttribute("Source") });
}
}
}
// Load the satellite assemblies
foreach (AssemblyPart part in parts)
{
if (part.Source.ToLower().Contains("resources"))
{
Stream assembly = Application.GetResourceStream(sri, new Uri(part.Source, UriKind.Relative)).Stream;
part.Load(assembly);
}
}
// Change the culture
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
The assembly seems to load ok, and I have matched up namespaces with the default resource file (ApplicationStrings.resx) with the downloaded resource file (ApplicationStrings.fr-CA.resx). As seen the code, the culture is set for the current thread.
However, calls to ApplicationStrings.ResourceManager.GetString(...) do not return the resources for the set culture. For example, the following should return a string for the new culture (fr-CA), but always returns the default culture (en-US).
/// <summary>
/// Looks up a localized string similar to User Name:.
/// </summary>
public static string Label_UserName {
get {
return ResourceManager.GetString("Label_UserName", resourceCulture);
}
}
Any suggestions? Thanks.
** UPDATE
I figured it out...I had forgotten to reset my supported locals in my satellite assembly project file:
<SupportedCultures>fr-CA</SupportedCultures>
I also made my folder structure exactly as it is for the default resources in my main Silverlight application.

Resources