Thank You @alper
but I'm not using UWP for Windows phone development, but for Windows 10 App Store Application.
So what do you suggest me to do? I use WPF? And How to reuse Xamarin Shared Project In a desktop Application. Or have you a sample implementing the use of Session and Services?
Thanks in advance.
Hello,
I'm trying to implement an UWP application on the Xamarin Shared project.
After doing:
ApplicationBootstrapper.InitializeIfNeeds<MY_PROJECTXamarinUwpModule>();
...
Xamarin.Forms.Forms.Init(e);
...
ConfigureFlurlHttp();
in the App.xaml.cs
And:
LoadApplication(new MY_PROJECT_NAMESPACE.App());
in the MainPage.xaml.cs
the module:
namespace MY_PROJECT
{
[DependsOn(typeof(MY_PROJECTXamarinSharedModule))]
public class MY_PROJECTXamarinUwpModule : AbpModule
{
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(MY_PROJECTXamarinUwpModule).GetAssembly());
}
}
}
and the Locale.cs:
public class Locale : ILocale, ISingletonDependency
{
public void SetLocale(CultureInfo ci)
{
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
}
public CultureInfo GetCurrentCultureInfo()
{
var netLanguage = "en";
if (Windows.System.UserProfile.GlobalizationPreferences.Languages.Count > 0)
{
var pref = Windows.System.UserProfile.GlobalizationPreferences.Languages[0];
netLanguage = UwpToDotnetLanguage(pref);
}
// this gets called a lot - try/catch can be expensive so consider caching or something
System.Globalization.CultureInfo ci = null;
try
{
ci = new System.Globalization.CultureInfo(netLanguage);
}
catch (CultureNotFoundException e1)
{
// iOS locale not valid .NET culture (eg. "en-ES" : English in Spain)
// fallback to first characters, in this case "en"
try
{
var fallback = ToDotnetFallbackLanguage(new PlatformCulture(netLanguage));
Console.WriteLine(netLanguage + " failed, trying " + fallback + " (" + e1.Message + ")");
ci = new System.Globalization.CultureInfo(fallback);
}
catch (CultureNotFoundException e2)
{
// iOS language not valid .NET culture, falling back to English
Console.WriteLine(netLanguage + " couldn't be set, using 'en' (" + e2.Message + ")");
ci = new System.Globalization.CultureInfo("en");
}
}
return ci;
//return new CultureInfo(Windows.System.UserProfile.GlobalizationPreferences.Languages[0]);
}
string UwpToDotnetLanguage(string androidLanguage)
{
Console.WriteLine("Android Language:" + androidLanguage);
var netLanguage = androidLanguage;
//certain languages need to be converted to CultureInfo equivalent
switch (androidLanguage)
{
case "ms-BN": // "Malaysian (Brunei)" not supported .NET culture
case "ms-MY": // "Malaysian (Malaysia)" not supported .NET culture
case "ms-SG": // "Malaysian (Singapore)" not supported .NET culture
netLanguage = "ms"; // closest supported
break;
case "in-ID": // "Indonesian (Indonesia)" has different code in .NET
netLanguage = "id-ID"; // correct code for .NET
break;
case "gsw-CH": // "Schwiizertüütsch (Swiss German)" not supported .NET culture
netLanguage = "de-CH"; // closest supported
break;
// add more application-specific cases here (if required)
// ONLY use cultures that have been tested and known to work
}
Console.WriteLine(".NET Language/Locale:" + netLanguage);
return netLanguage;
}
string ToDotnetFallbackLanguage(PlatformCulture platCulture)
{
Console.WriteLine(".NET Fallback Language:" + platCulture.LanguageCode);
var netLanguage = platCulture.LanguageCode; // use the first part of the identifier (two chars, usually);
switch (platCulture.LanguageCode)
{
case "gsw":
netLanguage = "de-CH"; // equivalent to German (Switzerland) for this app
break;
// add more application-specific cases here (if required)
// ONLY use cultures that have been tested and known to work
}
Console.WriteLine(".NET Fallback Language/Locale:" + netLanguage + " (application-specific)");
return netLanguage;
}
}
It compiles perfectly but when I try to exectute the program, I get "System.ArgumentNullException : 'Value cannot be null.'" in the:
return new AsyncCommand(new Command(async () => await func()));
line 31 of the MY_PROJECT.Mobile.Shared\Core\Threading\AsyncCommand.cs file
and here is the stacktrace: [Code externe]
MY_PROJECT.Mobile.Shared.dll!MY_PROJECT.Core.Threading.AsyncCommand.Create.AnonymousMethod__0() Ligne 31 C# [Code externe] MY_PROJECT.Mobile.Shared.dll!MY_PROJECT.Core.Threading.AsyncCommand.Execute(object parameter) Ligne 26 C# MY_PROJECT.Mobile.Shared.dll!MY_PROJECT.Commands.HttpRequestCommand.Execute(object parameter) Ligne 27 C# MY_PROJECT.Mobile.Shared.dll!MY_PROJECT.Behaviors.InvokeCommandAction.Execute(object sender, object parameter) Ligne 58 C# MY_PROJECT.Mobile.Shared.dll!MY_PROJECT.Behaviors.EventHandlerBehavior.OnEvent(object sender, object eventArgs) Ligne 104 C# [Code externe]
please Help
Thanks in advance
Thank you Maliming,
I have found this in documentation. But I cant find the "AbpWebApi" or the "DynamicApiControllerBuilder" in the "Modules" of the object "Configuration".
I have also found this Microsoft article but not "config.MapHttpAttributeRoutes()"
Please help
Hello,
I'm using Asp.net Zero Core 2 + Angular (last version 5.4.1)
Can i specify the routes using the dynamic api method? I want to use url parameters.
To better explain i have the following:
foo/create foo/edit foo/action1 foo/action2 foo/action3
I would like to have it:
foo/create foo/edit foo/action1/{id}/{param1}/{param2}/... foo/action2/{id}/{param1}/{param2}/... foo/action3/{id}/{param1}/{param2}/...
Instead of passing the id and the other parameters through the input object parameter
thanks in advance
Hello,
thank you alper for your quick response. But, I can't find how to authenticatate without password. Can you please give me an example of the implimentation of the "TryAuthenticateAsync" method;
thanks in advance.
Hello,
We tried to make authentification from WPF Application using RFID Tags. When we pass the RFID, we succeeded to get the user. So we try to sign it in. But, we have no access to AccountController in the Web project. So we try to impliment the SignInAsync Method. The problem is in the IocManager in Microsoft.OWIN.Security, The HttpContext throws NullRefernceException.
Is there a way to do the SignIn without password or to get the palin text password from the hashed one. Any suggestion will be apreciated.
Thanks in advance
Hello,
We have created a project using aspnetzero v5.3.0 Asp.Net Core & angular, all is working good in visual studio. But when we publish the project on IIS, we have always Error 500: Internal server error. We tried the project on debug mode in the server (Visual studio), it's working good. We tried to publish the project in Debug mode on IIS, and we find in the Logs.txt the following bug:
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): Le chemin réseau n’a pas été trouvé
Sql Server is running and the connection string is working perfectly!!!!????
Please help Thank you
<cite>ismcagdas: </cite> Hi @DFIELEC,
Does your angular app's configuration contains "/SubDirectory" for appBaseUrl ?
Hello, yes, it contains.
Hello,
When we deploy our site on iis with *.Web.Host appsettings.json:
"App": { "ServerRootAddress": "http://www.domainname.com/SubDirectory/", "ClientRootAddress": "http://www.domainname.com/SubDirectory/", "CorsOrigins": "http://www.domainname.com/SubDirectory/" } without /SubDirectory/
thanks in advance
Thank you very much