如何显示进度条或旋转圆圈,直到完成任何过程? [英] How to show Progress Bar or spining circle until any process gets completed?

查看:76
本文介绍了如何显示进度条或旋转圆圈,直到完成任何过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在我的Web应用程序中,页面上的常规流程如下所示:

-每当用户单击任何按钮时,我需要向他们显示三个弹出消息,其中包括:1)询问用户确认,如果用户单击确定,则执行相关过程,否则不执行任何操作. 2)在获得来自用户的确认消息后,我的网页实际上正在进行SSH调用并在此脚本调用中执行脚本,我正在传递控制值,然后等待脚本响应(如成功或失败).单个脚本的执行时间为分钟.在此期间的30分钟内,我需要在网页上显示进度栏或旋转圆圈,以便用户可以了解后台进程,还希望使所有控件的可访问性变为false. 3)获取脚本响应后,进度栏应消失,并且需要在另一个消息框中弹出相关的成功或失败消息以供用户确认.

谁能给我一些基本的代码思路?

Hi All,

In my web application , a regular flow on page is like below:

-- Whenever User clicks on any button , I need to show them three pop-up messages with 1) Asking confirmation of user , if user click OK execute related process else do nothing. 2) After having OK confirm message from user my web page is actually making SSH call and executing script in this script call I am passing control values and then waiting for scripts response like success or failure. Execution time of single script is min. 30mins during this time I need to show Progress Bar or Spinning Circle on web-page so User can have knowledge of background process and also want to make all controls accessibility to false. 3) After Getting script response Progress Bar should disappear and related success or failure message need to pop-up in another message box for user acknowledgment.

Can anyone provide me some basic code idea?

推荐答案

单个脚本的执行时间为分钟. 30分钟
:omg:
您真的认为值得尝试吗?甚至进度条也可以解决您的问题并使用户等待?我真的很怀疑即使有进度条,如果最多花费3-4分钟以上的时间,我也会关闭应用程序并重新启动,前提是出了点问题.

在建议使用Progressbar之前,我想请您考虑一下,重新设计并使您的应用程序花费更少的时间.在这里,您将用户界面阻塞了30分钟,这是不可接受的.


现在,如何放置进度条:
1.由于脚本一直在运行,因此您已经在需要的位置有了事件/处理程序来处理客户端Java脚本
2.只需在页面顶部放置一个div(以阻止所有控件访问),并在流程开始时通过Javascript显示图像(正在进行的工作)
3.在过程结束时隐藏div和图像(成功与失败)

这是一个简单的过程,以防万一只需要Google使用Javascript显示div/图像.
Execution time of single script is min. 30mins
:omg:
Do you really think it''s worth a try? Or even a Progress bar can resolve your issue and keep the user waiting? I really doubt. Even if there is a progress bar, if it takes more than 3-4 min maximum, I will close the application and restart, assuming something went wrong.

Before suggesting Progressbar thing, I would ask you to think, re-design and make your application such that it takes much less a time. Here, you keep the UI blocked for 30 odd minutes, unacceptable.


Now, how to put progress bar:
1. Since it''s script running and all, you already have a event/handler to client side Javascript at the needed points
2. Just put a div at the top of your page(to block all controls access) and show an image(progressing work) via Javascript when process starts
3. Hide the div and image when the process ends (success & failure)

It''s a simple process, in case needed just Google for showing a div/image using Javascript.


我已经解决了类似的问题.用户通过aspx页面开始冗长的数据导出.在服务器端,将创建一个后台工作程序,以报告其进度.服务器需要记住哪个用户开始了哪种导出.后台工作者使用OnProgressChanged或ReportProgress方法提供其当前状态.服务器端跟踪后台工作进程的状态信息.用户现在可以注销或执行他喜欢的任何操作.当用户稍后返回时,他可以显示所有已启动进程的列表以及它们的当前状态:正在运行以及相应的进度或该进程已完成.
显示进程列表当前状态的页面使用AJAX调用来检索有关进程当前状态的信息.在我的情况下,一个进程由UserID和ProcessID标识,因为一个用户可以启动多个进程.

干杯!
I''ve solved something similar. The user starts a lengthy data export via an aspx page. On the server side a background worker is created that reports its progress. The server needs to remember which user started what kind of exports. The background worker uses the OnProgressChanged or ReportProgress methods to give its current status. Server side tracks the status information of of the background worker processes. The user can now logoff or do whatever he pleases. When the user comes back at a later time he can display a list of all the processes he started and what their current state is: Running and the respective progress or that the process has finished.
The page that displays the current status of the process list uses AJAX calls to retrieve the information about the current state of a process. In my case a process was identified by UserID and ProcessID since one user was able to start more than one process.

Cheers!


我解决了.我在按钮单击中使用了线程,并显示了其中包含进度条的弹出窗口.

非常感谢您的支持.
I solved it. I used thread in my button click and showing pop-up window having progress bar in it.

Thank you so much for all support.


这篇关于如何显示进度条或旋转圆圈,直到完成任何过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆