I've followed the Xamarin forms tutorial for making use of oauth and identity providers and downloaded the repo. Running the code as is with the provided client ID on the scheme interceptor works fine but changing to my id from the google console keeps redirecting to google.com even though the rest of the OnAuthCompleted method gets executed.
How do i solve failed redirect for oauth
Connection Refused when trying to postAsync with restful api
I am trying to do an api post from xamarin android app but keep getting Connection refused error. I have enabled internet permissions in manifest and I can access api url from device/emulator web browser. I have also tested this code with a wpf application and is recieved by api so the calling code is correct. it is definately an emulator/xamarin issue
async void RegistrationFrom(object sender, EventArgs args)
{
try
{
System.Net.Http.HttpClient client = new System.Net.Http.HttpClient();
DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(UserRegistration));
UserRegistration user = new UserRegistration();
user.FirstName = UserName.Text;
user.LastName = LastName.Text;
user.Username = UserName.Text;
user.Password = Password.Text;
user.PostCode = PostCode.Text;
user.Email = Email.Text;
MemoryStream stream1 = new MemoryStream();
jsonSerializer.WriteObject(stream1, user);
stream1.Position = 0;
StreamReader sr = new StreamReader(stream1);
var content = sr;
string json = sr.ReadToEnd();
StringContent jsonContent = new StringContent(json, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync("httpIPaddressWithPortnumber(cant post links)/api/Home", jsonContent);
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
}
stack trace:
at System.Net.Http.HttpClientHandler+d__63.MoveNext () [0x004ab] in <7736395a6c71409691a34accfc621095>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 at System.Net.Http.HttpClient+<SendAsyncWorker>d__49.MoveNext () [0x000ca] in <7736395a6c71409691a34accfc621095>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 at System.Runtime.CompilerServices.TaskAwaiter
1[TResult].GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at App.Registration+d__1.MoveNext () [0x00184] in C:\Users\User\source\repos\App\App\App\Registration.xaml.cs:49
inner Exception: **Error: ConnectFailure (Connection refused)"**
at System.Net.HttpWebRequest.EndGetRequestStream (System.IAsyncResult asyncResult) [0x0003a] in <6c708cf596db438ebfc6b7e012659eee>:0
at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func
2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task
1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
WebClient - Error getting response stream (ReadDone2)
Hello,
Is there a known issue with using WebClient over cellular networks? I have an app that's loading some content with WebClients, and everything seems to work fine on wi-fi. But, take the app out on 3G and it starts to have problems loading the content. It works most of the time, but
about, say, one out of twenty times it instead returns with this error
{System.Net.WebException: Error getting response stream (ReadDone2):
ReceiveFailure ---> System.Exception: at
System.Net.WebConnection.ReadDone(IAsyncResult result) at
System.Net.WebConnection.HandleError (WebExceptionStatus st, System.Exception e, System.String where) [0x0003a] in
/Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebConnection.cs:399
/ --- End of inner exception stack trace --- at
/ --- System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)
/ --- [0x00065] in
/ --- /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:854
/ --- / at System.Net.HttpWebRequest.GetResponse () [0x0000e] in
/ --- / /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:860
/ --- / / at System.Net.WebClient.GetWebResponse (System.Net.WebRequest
/ --- / / request) [0x00000] in
/ --- / / /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebClient.cs:1473
/ --- / / / at System.Net.WebClient.ReadAll (System.Net.WebRequest request,
/ --- / / / System.Object userToken) [0x00000] in
/ --- / / / /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebClient.cs:896
/ --- / / / / at System.Net.WebClient.DownloadDataCore (System.Uri address,
/ --- / / / / System.Object userToken) [0x0000a] in
/ --- / / / / /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebClient.cs:256
/ --- / / / / / }
This happens more or less immediately, so I can work around this by simply checking "if connecting-time < 0.5 sec { try again }", but I thought I'd see if someone else have had the same issue and/or a better solution?
Mysql or MSSql from Xamarin Forms
I'm building an cross-platform app with Xamarin Forms. Im having a lot of trouble loading packages to access databases.
I don't seem to be able to install either System.Data.SqlClient or MySQL...... or Pomelo.
Seems to be something to do with .NetPortable, and profile 259.
Example:
Could not install package 'Pomelo.Data.MySql 1.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Time Elapsed: 00:00:16.2248820
========== Finished ==========
Help? What am I doing wrong?
FreshMvvm and 2 x Observable collections. Issues with View not updating.
Hi all,
Ive been stuck on this for a little while and would really appreciate some help. Ive got a page with a Carousel view on top, then underneath it a horizontal scrollview using this implementation (fabiocozzolino.eu/a-little-and-simple-bindable-horizontal-scroll-view/. The Carousel view's itemsource (Observable collection) is populated using a Rest API call and is working fine and is displaying as expected.
However the issues comes with the horizontal scroll view, which has an itemsource (Also an Observable collection) based on some logic performed on the observable collection which feeds the carousel view. Basically i've tried to reduce API calls by using the data from the Carousel view to feed my horizontal scrollview itemsource and then update the view.
I have manually called the 'RaisePropertyChanged' events for both collections, but still only the Carousel view displays data. I have checked the horizontal scrollview itemsource when debugged and the collection is getting populated with data but just doesn't seem to display in the view. Code is below, it is really frustrating because I thought my biggest issue would be with the layout and not refreshing the view.
Any help you could provide would be hugely appreciated.
Page code:
<ContentPage.Content> <ScrollView> <StackLayout Spacing="5"> <cv:CarouselView x:Name="FeaturedUsers" ItemsSource="{Binding Users}" HeightRequest="150"> <cv:CarouselView.ItemTemplate> <DataTemplate> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Image Grid.RowSpan="2" Aspect="AspectFill" Source="{Binding ImageURL}"/> <StackLayout Grid.Row="1" BackgroundColor="#80000000" Padding="12"> <Label TextColor="White" Text="{Binding FullName}" FontSize="16" HorizontalOptions="Center" VerticalOptions="CenterAndExpand"/> </StackLayout> </Grid> </DataTemplate> </cv:CarouselView.ItemTemplate> </cv:CarouselView> <Label Text="Users Sub Set" FontAttributes="Bold" TextColor="White" FontSize="Small" Margin="5,10,0,0"></Label> <controls:TLScrollView Orientation="Horizontal" ItemsSource="{Binding UsersSubSet}" ItemSelected="Handle_ItemSelected" HeightRequest="180"> <controls:TLScrollView.ItemTemplate> <DataTemplate> <ViewCell> <Grid Padding="6"> <Grid.RowDefinitions> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <ffimageloading:CachedImage HeightRequest="180" WidthRequest="100" Aspect="AspectFill" Opacity="0.5" DownsampleHeight="100" DownsampleUseDipUnits="false" LoadingPlaceholder="image_loading.png" ErrorPlaceholder="image_error.png" Source="{Binding ImageURL}"/> <Label x:Name="Label" Margin="15" HorizontalOptions="Fill" HorizontalTextAlignment="Center" VerticalOptions="End" TextColor="White" FontSize="10" Text="{Binding FullName}"/> </Grid> </ViewCell> </DataTemplate> </controls:TLScrollView.ItemTemplate> </StackLayout> </ScrollView>
PageModel
``
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Threading.Tasks;
using FreshMvvm;
using Newtonsoft.Json;
using Project.Models;
using Project.Services;
using Xamarin.Forms;
namespace Code.PageModels
{
public class OptionsPageModel : FreshBasePageModel
{
IDatabaseService _databaseService;
public OptionsPageModel(IDatabaseService databaseService)
{
_databaseService = databaseService;
}
public ObservableCollection<User> Users { get; set; }
public ObservableCollection<User> UserSubSet { get; set; }
public async override void Init(object initData)
{
Users = new ObservableCollection<User>(await DependencyService.Get<IService>().GetUserNames());
UserSubSet = new ObservableCollection<User>();
foreach (var item in Users)
{
switch (item.Category)
{
case "MyCase":
UserSubSet.Add(item);
break;
default:
break;
}
}
RaisePropertyChanged("Users");
RaisePropertyChanged("UserSubSet");
}
protected override void ViewIsAppearing(object sender, EventArgs e)
{
base.ViewIsAppearing(sender, e);
}
public override void ReverseInit(object value)
{
}
}
}
``
Error when running tests on Android
Hi,
I am getting the following error when trying to run the tests on Android:
Error creating directory info from path: ""
Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: path
at System.IO.DirectoryInfo.CheckPath (System.String path) [0x0005d] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/corlib/System.IO/DirectoryInfo.cs:476
at System.IO.DirectoryInfo..ctor (System.String path, System.Boolean simpleOriginalPath) [0x00006] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/corlib/System.IO/DirectoryInfo.cs:59
at System.IO.DirectoryInfo..ctor (System.String path) [0x00000] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/corlib/System.IO/DirectoryInfo.cs:53
at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:.ctor (string)
at Xamarin.UITest.Shared.Dependencies.PotentialLocation..ctor (System.String path, System.String source) [0x00006] in <352a0be97b1c43028133e9951999d5f3>:0
Error creating directory info from path: ""
Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: path
at System.IO.DirectoryInfo.CheckPath (System.String path) [0x0005d] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/corlib/System.IO/DirectoryInfo.cs:476
at System.IO.DirectoryInfo..ctor (System.String path, System.Boolean simpleOriginalPath) [0x00006] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/corlib/System.IO/DirectoryInfo.cs:59
at System.IO.DirectoryInfo..ctor (System.String path) [0x00000] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/corlib/System.IO/DirectoryInfo.cs:53
at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:.ctor (string)
at Xamarin.UITest.Shared.Dependencies.PotentialLocation..ctor (System.String path, System.String source) [0x00006] in <352a0be97b1c43028133e9951999d5f3>:0
I am using UITest 2.1.0. Has anybody else encountered this issue and have a solution?
Thanks,
Jonathan
Using a JSON Element to create a User Interface in Xamarin.Forms
Using a JSON Element to create a User Interface in Xamarin.Forms. I have two jason file and I want to create a dynamic UI using json element in Xamarin.Forms.
About 3rd-party app use xamarin.uitest
hi,
I'm a newbie here. I'm just want to test a app which were downloaded from internet and then installed on my device.
when my code set :
app = ConfigureApp
.Android
.LaunchableActivity("apk launchable activity")
//.InstalledApp("package name")
.ApkFile(@apk path)
.StartApp();
I can 100% confirm that parameters are right, but when I debug the test case:
[Test]
public void AppLaunches()
{
app.Screenshot("First screen.");
app.Back();
}
It always throw me an exception:
发生了 System.Exception
HResult=0x80131500
Message=Timed out waiting for result of ClearAppData2
Source=Xamarin.UITest
StackTrace:
在 Xamarin.UITest.Shared.Android.Commands.CommandAdbClearAppData.ExecuteLocally(Func2 adbShell) 在 Xamarin.UITest.Shared.Android.Commands.CommandAdbClearAppData.Execute(AdbProcessRunner processRunner) 在 Xamarin.UITest.Shared.Execution.Executor.Execute[TDep1](ICommand
1 command)
在 Xamarin.UITest.Shared.Android.LocalAndroidAppLifeCycle.EnsureInstalled(ApkFile appApkFile, ApkFile testServerApkFile)
在 Xamarin.UITest.Android.AndroidApp..ctor(IAndroidAppConfiguration appConfiguration, IExecutor executor)
在 Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp(AppDataMode appDataMode)
在 UITest1.Tests.BeforeEachTest() 在 C:\Users\hanzy2\source\repos\UITest1\UITest1\Tests.cs 中: 第 36 行
============================================================
OUTPUT:
Xamarin.UITest Information: 0 : Skipping IDE integration as important properties are configured. To force IDE integration, add .PreferIdeSettings() to ConfigureApp.
Xamarin.UITest Information: 0 : Android test running Xamarin.UITest version: 2.1.3
“vstest.executionengine.x86.exe”(CLR v4.0.30319: test-domain-UITest1.dll): 已加载“C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\mscorlib.resources\v4.0_4.0.0.0_zh-Hans_b77a5c561934e089\mscorlib.resources.dll”。模块已生成,不包含符号。
Xamarin.UITest Information: 0 : Initializing Android app on device 0123456789ABCDEF with apk: d:\apk\gong_4.6.2.485.apk
Xamarin.UITest Information: 0 : Skipping local screenshots. Can be enabled with EnableScreenshots() when configuring app.
Xamarin.UITest Information: 0 : Signing apk with Xamarin keystore.
it show me a warning dialog menas singed check failed.
My Question is : Can I use Xamarin.Uitest to test app which I dont have any source code? of courese I can't build it and resign it at all.
thanks ,please help
Best way to create Thumbnails of images
Hi,
I need the function in my app, that the user can pick an image from the image gallery and a Thumbnail of this Image should the be stored in a Zip-File.
I have no problem accesing a stream of the just picked image through the MediaPlugin and I can write into a ZIP-File via a Stream.
What's the easiest way to get a Thumbnail image from the selected image?
All the best
Thomas
How to increase Memory usage for Xamarin forms Winphone 8.1?
I heard about "ID_FUNCCAP_EXTEND_MEM" and "ID_REQ_MEMORY_300" to do that.
But I don't know how to implement in Xamarin forms WinPhone 8.1.
Please help me.
Message "Unfortunately, AppName has stopped" at first launch application
Hi everyone!
I build release signed apk of my android app. There is no problem when I install package on my phone with command
adb install package.apk
But after the successful publication of the package on Google Play and install app from there, the following problem happens:
- at first launch application I see error "Unfortunately, AppName has stopped", but the application continues to work
- there is no error at second launch
- there is crash report in my google play console:
java.lang.UnsatisfiedLinkError:
at md5e03b4490aea638ea6c88558d50493b43.MainApplication.n_onCreate (Native Method)
at md5e03b4490aea638ea6c88558d50493b43.MainApplication.onCreate (MainApplication.java:34)
at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1014)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:4806)
at android.app.ActivityThread.access$1600 (ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1452)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:234)
at android.app.ActivityThread.main (ActivityThread.java:5526)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:616)
(but I'm not sure that these errors are interrelated)
Does anyone have any idea why this happened?
Can I inspect an app not created using Xamarin?
Hello,
Can I inspect an app not created using Xamarin? If yes, how? Once I drag my app and drop into the emulator, it install normally and I can use it, but the "View Inspector" tab still got the "Xamarin Workbooks App" view...
How to create and dynamic UI from jason in Xamarin. Forms
UI still freezes when the long operation is defined using IExecutor
I want to add 1500 views to a LinearLayout in Xamarin.Android. Since adding this large a number of views will freeze UI, I tried to add first 20 views in the UI thread and add the rest of the views in a separate thread using IExecutorService. But still the UI stays frozen until the 1480 iterations I have added in the IRunnable.Run method complete. Why the UI freezes since I defined the long operation in a separate thread?
internal class LinearLayoutEx : LinearLayout, IDisposable
{
MyRunnable runnable;
internal LinearLayoutEx(Context context) : base(context)
{
runnable = new MyRunnable(this);
exec = Executors.NewSingleThreadExecutor();
for(int i = 0; i < 20; i++)
{
//20 views are being added to the LinearLayout
}
exec.Execute(runnable);
}
}
internal class MyRunnable : Java.Lang.Object, Java.Lang.IRunnable
{
internal LinearLayoutEx linearLayout;
private MyHandler myHandler;
internal MyRunnable(LinearLayoutEx ll)
{
myHandler = new MyHandler(Looper.MainLooper);
linearLayout = ll;
}
public void Run()
{
Message msg = myHandler.ObtainMessage(1, linearLayout);
msg.SendToTarget();
}
}
internal class MyHandler : Handler
{
LinearLayoutEx linearLayout;
internal MyHandler(Looper looper):base(looper)
{
}
public override void HandleMessage(Message msg)
{
linearLayout = msg.Obj as LinearLayoutEx;
for(int i = 20; i < 1500; i++)
{
//1480 views are being added to the LinearLayout
}
base.HandleMessage(msg);
}
}
Can I inspect an app not created using Xamarin?
Hello,
Can I inspect an app not created using Xamarin? If yes, how? Once I drag my app and drop into the emulator, it install normally and I can use it, but the "View Inspector" tab still got the "Xamarin Workbooks App" view...
How to create and dynamic UI from jason in Xamarin. Forms
UI still freezes when the long operation is defined using IExecutor
I want to add 1500 views to a LinearLayout in Xamarin.Android. Since adding this large a number of views will freeze UI, I tried to add first 20 views in the UI thread and add the rest of the views in a separate thread using IExecutorService. But still the UI stays frozen until the 1480 iterations I have added in the IRunnable.Run method complete. Why the UI freezes since I defined the long operation in a separate thread?
internal class LinearLayoutEx : LinearLayout, IDisposable
{
MyRunnable runnable;
internal LinearLayoutEx(Context context) : base(context)
{
runnable = new MyRunnable(this);
exec = Executors.NewSingleThreadExecutor();
for(int i = 0; i < 20; i++)
{
//20 views are being added to the LinearLayout
}
exec.Execute(runnable);
}
}
internal class MyRunnable : Java.Lang.Object, Java.Lang.IRunnable
{
internal LinearLayoutEx linearLayout;
private MyHandler myHandler;
internal MyRunnable(LinearLayoutEx ll)
{
myHandler = new MyHandler(Looper.MainLooper);
linearLayout = ll;
}
public void Run()
{
Message msg = myHandler.ObtainMessage(1, linearLayout);
msg.SendToTarget();
}
}
internal class MyHandler : Handler
{
LinearLayoutEx linearLayout;
internal MyHandler(Looper looper):base(looper)
{
}
public override void HandleMessage(Message msg)
{
linearLayout = msg.Obj as LinearLayoutEx;
for(int i = 20; i < 1500; i++)
{
//1480 views are being added to the LinearLayout
}
base.HandleMessage(msg);
}
}
Check login information
Hi,
First of thanks for Xamarin community for this wonderful platform. I am trying to implement identity login into my cross-platform app. I have created Azure SQL database and configured API services in my app. Everything working fine, I can register / login users. However, I want to check if the user loggedin or not and display dialog boxes (you successfully registered/logged in, or password does not match/wrong etc.). And if it is success, I want to navigate user to mainpage of the app. Could you please advise me how to achieve this? Thank you for your support.
Here is what have done so far
apiservices.cs
public class ApiServices { public async Task RegisterUserAsync(string email, string password, string confirmPassword) { var client = new HttpClient(); var success = false; var model = new RegisterBindingModel { Email = email, Password = password, ConfirmPassword = confirmPassword }; try { var json = JsonConvert.SerializeObject(model); HttpContent content = new StringContent(json); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); if (email != null || password != null) { success = true; Acr.UserDialogs.UserDialogs.Instance.ShowSuccess(string.Format("You are now signed-in as {0}.", email)); var response = await client.PostAsync( Constants.BaseApiAddress + "api/Account/Register", content); Debug.WriteLine(response); Debug.WriteLine(await response.Content.ReadAsStringAsync()); Debug.WriteLine(response.StatusCode); } } catch (Exception ex) { Acr.UserDialogs.UserDialogs.Instance.ShowError(string.Format("Authentication Failed: {0}", ex.Message)); } } }
registerViewModel.cs
public class RegisterViewModel { public string Email { get; set; } public string Password { get; set; } public string ConfirmPassword { get; set; } public ICommand RegisterCommand { get { return new Command(async () => { ApiServices apiServices = new ApiServices(); await apiServices.RegisterUserAsync(Email, Password, ConfirmPassword); }); } } }
loginViewModel.cs
public class LoginViewModel { public string Email { get; set; } public string Password { get; set; } public ICommand LoginCommand { get { return new Command(async () => { ApiServices apiServices = new ApiServices(); await apiServices.LoginUserAsync(Email, Password); }); } } }
Regarding Live Video Streaming From Camera Using An I.P Address.
I want to make an app that will show the video that has been recorded by my camera at my home. Is there any
samples anyone can help me out in it. Basically it will be a live video streaming app.
iOS simulator on VS Enterprise stopped working
My iOS simulator was working great, then all of a sudden I get a small rectangle that tries to connect and then reports a fatal error. I uninstalled and reinstalled the Remoted iOS Server (https://developer.xamarin.com/guides/cross-platform/windows/ios-simulator/) but no go. It does open the simulator on the mac when I turn the local one off, but when I come back to the local (remoted) simulator it never expands to the full simulator.
Have you seen this? Any ideas from our friends at Xamarin?