首页 \ 问答 \ 如何在android MvvmCross Xamarin中设置ProgressBar的可见性(How to set visibility for ProgressBar in android MvvmCross Xamarin)

如何在android MvvmCross Xamarin中设置ProgressBar的可见性(How to set visibility for ProgressBar in android MvvmCross Xamarin)

我正在尝试将ProgressBar visibility设置为GONE


在XML中

<?xml version="1.0" encoding="utf-8"?>
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    local:MvxBind="Visibility Visibility(ProgressVisibility)"
    android:background="@drawable/sel_custom_progress" />

ViewModel中

private bool _progressVisibility;
public bool ProgressVisibility
{
    get { return _progressVisibility; }
    set { _progressVisibility = value; RaisePropertyChanged(() => ProgressVisibility); }
}

我正在设置ProgressVisibility = false;


发生了什么 :视图仍然可见,而不是隐藏。 如何解决这个问题。


I am trying to set visibility for ProgressBar as GONE.


In XML

<?xml version="1.0" encoding="utf-8"?>
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    local:MvxBind="Visibility Visibility(ProgressVisibility)"
    android:background="@drawable/sel_custom_progress" />

In ViewModel

private bool _progressVisibility;
public bool ProgressVisibility
{
    get { return _progressVisibility; }
    set { _progressVisibility = value; RaisePropertyChanged(() => ProgressVisibility); }
}

I am setting ProgressVisibility = false;


What is happening: The view is still visible and not getting hidden. How to resolve this.


原文:https://stackoverflow.com/questions/44224694
更新时间:2022-12-02 20:12

最满意答案

一个用户/线程可能是一个很好的起点。 任何阻塞或可阻塞的东西都需要在自己的线程中运行,以避免被其他执行代码占用或阻塞。 如果电子邮件的实际处理将直接运行,则可以将其置于“可运行”中,以使用Java术语,并提交给线程池。 Java术语是ThreadPoolExecutor ,自己编写一个简单的术语并不难。 您希望每个可能的CPU核心都有一个线程可以从您的计算机中获得最多的工作。

如果每封电子邮件的工作不是很好,那么跳过线程池并在读者线程上完成工作可能会更简单,更快捷。 你已经支付了运行它的费用,你也可以从中获得所有的工作。

另一方面,如果处理电子邮件涉及阻止或被阻止,您可能需要为每封电子邮件启动一个新线程。 你最终可以获得很多线程,但它可以从你的计算机中获得最大的工作量。 您不希望落后于您的电子邮件,CPU使用率仅为5%。


One user/thread is probably a good starting point. Anything that blocks or can be blocked needs to run in its own thread to avoid holding up or being held up by other executing code. If the actual processing of an e-mail is going to run straight through, it can be placed in a "runnable", to use the Java term, and submitted to a thread pool. The Java term would be ThreadPoolExecutor, and it can't be that hard to write a simple one yourself. You'd want one thread for each likely CPU core to get the most work from your computer.

If the work per e-mail is not that great, it might be simpler and faster to skip the thread pool and just do the work on the reader thread. You've paid the cost to run it, you may as well get all the work out of it you can.

At the other extreme, if processing an e-mail involves blocking or getting blocked, you may want to fire up a new thread for each e-mail. You can end up with a lot of threads, but it will get the maximum amount of work out of your computer. You don't want to be falling behind on your e-mails with your CPU usage at only 5%.

相关问答

更多
  • 如果您创建了一个长时间运行的线程来执行轮询,您将不会注意到很多差异。 不可否认的是,你现在可能已经睡了一觉,所以你有很多时间需要多一个线程(与基于定时器的解决方案相比),但基本上没问题。 当你有很多短暂的操作时,线程池特别好。 开始一个线程并不是免费的,如果实际的工作是微不足道的,开销是相当大的。 线程池只是保持实际的线程在等待工作项目。 然后他们可以很少的开销执行这些工作项目。 通过一个长时间运行的任务,开销与任务本身所花费的时间相比微不足道,因此您不会注意到任何差异。 If you've created ...
  • 线程池是一种技术,它包含一个队列和一些从队列中取出作业并处理它们的线程。 这与每当新任务到达时才开始新线程的技术形成对比。 好处是线程的最大数量是有限的,以避免线程过多 ,并且任何新任务的开销都较小(线程已经运行并且接受任务,不需要启动威胁)。 这是否是一个好设计高度取决于你的问题。 如果你有很多短期工作以非常快的速度进入你的程序,那么这是一个好主意,因为较低的开销是一个好处。 如果你有大量的并发任务,这是一个好主意,让你的调度程序不必做太多的工作。 线程池有很多地方没有帮助。 所以你不能一概而论。 有时多 ...
  • 上下文切换的问题没有解决(由于其性质属于OS)。 但是当你使用ThreadPool正确的方式(异步)时,上下文切换不是问题。 由于新的TPL以及它必须解决的一些其他需求,.NET ThreadPool调度程序得到了改进。 尝试从CLR 4.0 ThreadPool改进开始 还要检查: CLR 4.0 ThreadPool中的限制并发和这个很棒的视频 Issues with context switching was not solved (due to its nature belongs to OS). ...
  • 恕我直言继承是这个错误的模型。 相反,我会有一个球员类和不同的角色。 这取决于玩家是否可以同时拥有多个角色。 我会使用战略模式。 IMHO inheritance is the wrong model for this. Instead I would have a player class and different roles for it. It depends if a player can have multiple roles at the same time. I would use a st ...
  • Singleton由于几个原因而不好,例如通常不能注入Mock对象。 如果你提供了一个机制(或不需要)来模拟测试它,那么我没有看到问题。 请注意,有很多优秀的连接池可供使用,我首先建议查看现有的连接池。 Singleton is bad for a few reasons e.g. usually you cannot inject a Mock object. If you provide a mechanism (or do not need) to mock test it, then I do no ...
  • 静态字段实际上并不在任何实例中,因此我假设您现在需要一个实例字段。 在这种情况下,您需要ThreadLocal : ThreadLocal store = new ThreadLocal( () => { // initializer, used when a new thread accesses the value return ... }); 这个商店和实例一样可以收集,任何内容也是如此(只要它们在任何其他地方都没有被引用,显然)。 A ...
  • 使用NSMapTable(例如iPhone上不可用)的替代方法是使用CoreFoundation等效项。 这些可以包含常规的非保留指针。 然而,你仍然需要从列表中抽出一些东西,但是这可以在对象的-dealloc方法中轻松完成。 一种可能是使用CFSet。 这将要求你的对象都适当地对-isEqual:和-hash做出响应,以便该组可以确定对象是否已经准确存在。 例如(注意,我没有编译过,但它应该至少90%正确): static id __uniqueObjects = nil; // GC uses N ...
  • 您可以通过将“对象关联关注点”移动到专用类中来简化操作。 这就是我的想法。 定义一个名为AssociationTable的类。 该类将维护一对对列表,其中每对包含对A对象的引用和对B对象的引用。 每个A对象(以及每个B对象)将保存对AssociationTable对象的引用。 A.Add(B)将实现为table.add(this,b); B.Add(A)将实现为table.add(a,this); 删除将实现为table.delete(this,b)或table.delete(a,this) class P ...
  • 一个用户/线程可能是一个很好的起点。 任何阻塞或可阻塞的东西都需要在自己的线程中运行,以避免被其他执行代码占用或阻塞。 如果电子邮件的实际处理将直接运行,则可以将其置于“可运行”中,以使用Java术语,并提交给线程池。 Java术语是ThreadPoolExecutor ,自己编写一个简单的术语并不难。 您希望每个可能的CPU核心都有一个线程可以从您的计算机中获得最多的工作。 如果每封电子邮件的工作不是很好,那么跳过线程池并在读者线程上完成工作可能会更简单,更快捷。 你已经支付了运行它的费用,你也可以从中获 ...
  • 对象(资源)池是一种设计模式 。 Tomcat中没有单个连接池,而是允许您定义多个池 。 然后,您可以通过服务提供程序控制范围和对每个池的访问权限,作为全局服务器,服务,引擎,主机或仅单个上下文 。 应用程序查找连接池,服务提供商确保维护定义的规则。 但是,你的问题如此开放,我们无法为你提出最合适的解决方案。 Object (Resource) Pool is a Design Pattern. There is not a single Connection pool in Tomcat, instead ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)