Tag: xamarin

便携式项目上是否有AppDomain.GetAssemblies的替代方案?

我试图获得程序集列表。 但我在portable UWP项目中面临例外。 以下代码适用于 .netframework Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); Xamarin portable var currentdomain = typeof(string).GetTypeInfo().Assembly.GetType(“System.AppDomain”).GetRuntimeProperty(“CurrentDomain”).GetMethod.Invoke(null, new object[] { }); var getassemblies = currentdomain.GetType().GetRuntimeMethod(“GetAssemblies”, new Type[] { }); var assemblies = getassemblies.Invoke(currentdomain, new object[] { }) as Assembly[]; 但是相同的上述代码在UWP portable不起作用。 (我认为便携式设备也在UWP中工作) 我在点击第一行时遇到以下问题 ‘typeof(string).GetTypeInfo()。Assembly.GetType(“System.AppDomain”)。GetRuntimeProperty(“CurrentDomain”)。GetMethod.Invoke(null,new object [] {})’引发了类型’System’的exception。出现InvalidOperationException” 数据:{System.Collections.ListDictionaryInternal} HResult:-2146233079 HelpLink:null InnerException:null消息:“API’System.AppDomain.get_CurrentDomain()’不能在当前平台上使用。请参阅http://go.microsoft。 com / fwlink /?LinkId = 248273获取更多信息。“ […]

当我接听电话时如何获得活动

你能帮我理解如何检测是否接听来电(我需要记录从接听到接听的呼叫)? 我可以检测到来电但不是外拨。 所以请帮忙。

如何在android MvvmCross Xamarin中设置ProgressBar的可见性

我正在尝试将ProgressBar visibility设置为GONE 。 在XML中 在 ViewModel中 private bool _progressVisibility; public bool ProgressVisibility { get { return _progressVisibility; } set { _progressVisibility = value; RaisePropertyChanged(() => ProgressVisibility); } } 我正在设置ProgressVisibility = false; 发生了什么 :视图仍然可见,而不是隐藏。 如何解决这个问题。

由于Android上的权限问题,我的应用正在终止

我正在编写此代码以获取gps位置,我在Android属性上标记了ACCESS_COARSE_LOCATION和ACCESS_FINE_LOCATION,我还确认它是否在AndroidManifest.xml中,但应用程序正在终止: 10-08 19:52:50.048 I / mono-stdout(2905):目前没有位置权限,请求权限当前没有位置权限,请求权限 位置权限被拒绝,无法获取位置async.10-08 19:52:50.103我/ mono-stdout(2905):位置权限被拒绝,无法获取位置异步。 如果我转到配置>应用程序>权限并提供位置权限,它可以正常工作,但它不会在安装时请求权限。 代码: using Plugin.Geolocator; using Plugin.Geolocator.Abstractions; using System; using Xamarin.Forms; namespace AppName { public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); } Position position; private async void GetPosition(object sender, EventArgs e) { try { var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 50; position = […]

在后台加载整个ListView并在每个ListItem中获取一个UIControl

我需要完全加载ListView并在每个ListItem中获取一个UIControl,即使项目视图没有显示在屏幕上也是如此。 我尝试了ChildViewAdded事件,但只有在屏幕上显示ListItem时才会引发它。 因此,在显示之前,我需要一种以编程方式准备UI ListView的方法。 在此先感谢您的帮助。

使用mvvm在xamarin表单中的视图之间传递数据

我正在尝试在页面之间导航并同时绑定数据。 这是我尝试过的: public ICommand GetIdeasCommand { get { return new Command(async () => { Ideas = await _apiServices.GetIdeasAsync(); await Application.Current.MainPage.Navigation.PushAsync(new IdeasSinglePage(Ideas)); }); } } 假设Ideas是我从json获得的数组列表。 但是这个方法对我没有帮助,因为我得到一个空白页面。 此外,如果我在页面内调用此function一切都很好。 这篇文章给了我一个想法: 如何在Xamarin.Forms中将参数从一个页面传递到另一个页面? 我的看法 : 代码背后: public partial class IdeasSinglePage : ContentPage { public IdeasSinglePage(List ideas) { InitializeComponent(); this.BindingContext = new IdeasSinglePage(ideas); //the app breaks here } } 谢谢。

Android相当于Windows Phone的Deployment.Current.Dispatcher.BeginInvoke?

我可以用于Android应用程序的Deployment.Current.Dispatcher.BeginInvoke有一个快速和脏的替代品吗? 它为我的Windows手机应用程序工作华丽,但我正在使用xamarin尝试复制我的Android应用程序,我无法找到解决方案。 这是使用它的代码: TextView txtUSN = FindViewById (Resource.Id.txtUserName); TextView txtpwd = FindViewById (Resource.Id.txtPassword); string usn = txtUSN.Text; string pwd = txtpwd.Text; string requestToken = “http://192.168.0.10/cschome/webdb1.aspx?cmd=login&usn=” + user + “&pwd=” + pass; //var request = (HttpWebRequest)WebRequest.Create(new Uri(requestToken)); var request = (HttpWebRequest)WebRequest.Create (new Uri (requestToken)); request.BeginGetResponse (r => { var httpRequest = (HttpWebRequest)r.AsyncState; var httpResponse = (HttpWebResponse)httpRequest.EndGetResponse(r); […]

为什么我的POST方法返回“未授权”? C#

http://static.pmmlabs.ru/OpenPeriscope/ 我按照“身份validation”下的文档提供示例和错误响应。 我在调用POST方法时收到此错误消息: 401 Unauthorized This endpoint requires authentication and no cookie value was provided, or is invalid 令牌应该绝对包含正确的值,所以我认为它必须是代码。 这是我目前的代码: var client = new HttpClient(); client.DefaultRequestHeaders.TryAddWithoutValidation(“Content-Type”, “application/json; charset=utf-8”); string json = “{” + “\”bundle_id\”:\”\”,” + “\”phone_number\”:\”\”,” + “\”session_key\”:\”” + key + “\”,” + “\”session_secret\”:\”” + secret + “\”,” + “\”user_id\”:\”” + userid + “\”,” + […]

Xamarin Test Recorder选项有错误。 无法记录自动测试

“选项 – > Xamarin-> Xamarin测试记录仪”中的所有设置都有错误。 我在桌面上安装了Visual Studio 2015(Enterprise)以及Xamarin和Xamarin Test Recorder插件。 我无法设置此选项。 有关错误,请参见附图。 [Xamarin测试记录器选项页] [1] [1]: http : //i.stack.imgur.com/dJJEd.jpg 此外,允许用户记录测试的闪电螺栓不会出现在UITest(Test.cs)页面中。 我相信这两者是相关的,并且有兴趣解决第一个问题,这个问题应该解决第二个问题。 (我想?)任何帮助将不胜感激。 先感谢您。 🙂

C#Xamarin Android无法获得ID

更新Xamarin后,我无法得到id。 如您所见,我将其命名为passwordEditText 现在你可以看到我无法在Resource.Id中找到passwordEditText 这是列表中的更多内容 有人能帮我吗?