标签: progress-bar

WPF如何在进度条上显示文本

我有一个 DataGrid,其中一列旨在显示下载百分比。下面是我的代码:

<DataGridTemplateColumn Header="Percent" IsReadOnly="True" Width="*">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <DockPanel>
                <Button Margin="5,0,0,0" DockPanel.Dock="Right" VerticalContentAlignment="Center" Style="{StaticResource BasicButtonStyle}" Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGrid}}, Path=DataContext.StopButtonClickCommand}" >
                    <Image Height="12" Source="/Client;component/Resources/Images/stop.png" />
                </Button>
                <ProgressBar Value="{Binding Path=Percent, Mode=OneWay}" Minimum="0" Maximum="100" />
                <TextBlock Text="{Binding Path=Percent , StringFormat={}{0}%}" HorizontalAlignment="Center" ></TextBlock>
            </DockPanel>
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
Run Code Online (Sandbox Code Playgroud)

我想在进度条上显示文本,同时将按钮保留在右侧。我应该如何修改我的代码?

c# wpf xaml datagrid progress-bar

1
推荐指数
1
解决办法
2694
查看次数

根据值更改垫进度条颜色

我有一个进度条,它从数组中获取其值,如下所示:

    users = [
    {
      "name": "Tim Jones",
      "email": "timjones_1965@gmail.com",
      "photo": "assets/images/tim-jones.jpg",
      "progress": "50"
    },
Run Code Online (Sandbox Code Playgroud)

还有进度条

    <mat-progress-bar mode="determinate" value="{{user.progress}}"></mat-progress-bar>
Run Code Online (Sandbox Code Playgroud)

我想根据进度值显示不同的颜色:

Progress from 0% to 20% = red<br>
Progress from 21% to 50% = yellow<br>
Progress from 51% to 100% = green<br>
Run Code Online (Sandbox Code Playgroud)

感谢您的帮助!

progress-bar angular-material angular

1
推荐指数
1
解决办法
9058
查看次数

使用 kotlin 在 WebView 中显示进度条

我使用此代码显示进度条,同时在 WebView 中加载要加载的 url,但应用程序在 WebView 页面启动几秒钟后崩溃,并给出错误:

java.lang.IllegalArgumentException:指定为非 null 的参数为 null:方法 kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull,参数 favicon

  val progressBar = findViewById<ProgressBar>(R.id.prg)
    val url: String = intent.getStringExtra("targetURL") ?: ""


    webView.webViewClient = object : WebViewClient() {

        override fun onPageStarted(view: WebView, url: String, favicon: Bitmap) {
            super.onPageStarted(view, url, favicon)
            view.visibility =View.INVISIBLE
            progressBar.visibility = View.VISIBLE
        }

        override fun onPageFinished(view: WebView, url: String) {
            super.onPageFinished(view, url)
            view.visibility =View.VISIBLE
            progressBar.visibility = View.INVISIBLE
        }

    }
    webView.settings.javaScriptEnabled = true

    val settings = webView.settings
    settings.domStorageEnabled = true

    webView.loadUrl(url)
Run Code Online (Sandbox Code Playgroud)

android kotlin progress-bar android-studio

1
推荐指数
1
解决办法
3321
查看次数

how to fill a 100% progress bar according to the time specified by the user

I'm creating a progress bar to use in a pomodoro. The idea is that this bar is filled 100% according to the time specified in the pomodoro. Example if it is 30 min then at 30 minutes it must reach 100%.

let progressBar = document.getElementById("progressBar");
let value = 30
let seconds = 120

let dataValue = progressBar.setAttribute("data-value", `${value}`)

dataAttribute = progressBar.getAttribute('data-value');
console.log(dataAttribute)

let bar = 0


progressBar.style.width = bar;

let id = setInterval(function(){
    bar++;
    progressBar.style.width = bar + "%"
    if …
Run Code Online (Sandbox Code Playgroud)

html javascript css countdowntimer progress-bar

1
推荐指数
1
解决办法
6217
查看次数

reportProgress 在生产中不起作用

当我上传视频文件时,它在本地(开发模式)下正常工作。但是当我将其上传到服务器(产品)时,它不起作用。
这是服务:

uploadVideo(id: String, file, imageId) {
        let formData = new FormData();
        formData.append('video', file);
        formData.append('imageId', imageId);
        return this.http.post<any>(`.../${id}/video`, formData, {reportProgress: true, observe: 'events'})
                .pipe(map(response => {
                        return response;
                }));
    }
Run Code Online (Sandbox Code Playgroud)

这是组件 ->

this.arrivalProductService.uploadVideo(this.data.id, this.selectedFile, imageId)
      .pipe(
        map((event) => {
          console.log('event', event);
          if(event.type === HttpEventType.UploadProgress){
            const percentDone = Math.round(100 * event.loaded / event.total);
            return { status: 'progress', message: percentDone };
          }
          if (event.type === HttpEventType.Response) {
            return event.body;
          }
        }),
        catchError(error => {
          return throwError(error);
        }),
        finalize(() => {
          console.log('completed');
        }) …
Run Code Online (Sandbox Code Playgroud)

production file-upload progress-bar typescript angular

1
推荐指数
1
解决办法
2047
查看次数

ReactJS 中堆叠进度条中的进度条工具提示

我正在尝试使用react-bootstrap 在堆叠进度条的各个条上添加工具提示。使用 OverlayTrigger 可以吗?这是我开始的代码:

<ProgressBar>
    <ProgressBar variant='success' now={7} max={21}></ProgressBar>
    <ProgressBar variant='danger' now={7} max={21}></ProgressBar>
    <ProgressBar variant='secondary' now={7} max={21}></ProgressBar>
</ProgressBar>
Run Code Online (Sandbox Code Playgroud)

我尝试在内部 ProgressBar 周围使用 OverlayTrigger,但在浏览器中呈现时,它们不会出现,因为每个 ProgressBar 都被视为较大进度条内的单独进度条。例如:

<div class="progress">
    <div class="progress">
        <div role="progressbar" class="progress-bar bg-success" aria-valuenow="33" aria-valuemin="0" aria-valuemax="100" style="width: 33%;"></div>
    </div>
    <div class="progress">
        <div role="progressbar" class="progress-bar bg-danger" aria-valuenow="33" aria-valuemin="0" aria-valuemax="100" style="width: 33%;"></div>
    </div>
    <div class="progress">
        <div role="progressbar" class="progress-bar bg-secondary" aria-valuenow="33" aria-valuemin="0" aria-valuemax="100" style="width: 33%;"></div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我可以通过对每个 ProgressBar 使用 Overlay,然后在每个 ProgressBar 上指定 onMouseEnter 和 onMouseLeave 来解决这个问题。还为每个 ProgressBar 创建 ref 和显示状态变量。这是唯一的方法吗?许多重复的代码将由 OverlayTrigger 处理。我不想使用 title …

progress-bar reactjs react-bootstrap

1
推荐指数
1
解决办法
1770
查看次数

在ThreadPoolexecutor进程中使用concurrent.futures创建进度条

我有一个 python 脚本,它连接到多个远程主机并执行 Linux 命令来获取信息。今天的主机数量约为 400 台主机,在这种情况下,我使用 aThreadPoolExecutor来在尽可能短的时间内完成所有任务。

一切顺利,我在 100 秒左右获得了所有数据。问题是我不知道这段时间进程的状态是什么,我想添加一个进度条,当所有的Threads完成时结束。

在我这边,我添加了新代码,使这个进度条成为我的脚本,使用睡眠时间,但正如我所看到的,进度条与线程进程不同步(进度条在线程进程之前几秒钟结束)。

对此有更好的解决方案吗?当这一切运行良好时,我想将这个进度条迁移到 Django 网站中。

这里有我的代码脚本的一部分。

for host in lista_hosts:
        res_versiones[host] = val_defecto
    # print(res_versiones)     
    
LENGTH = len(lista_hosts) # Number of iterations required to fill pbar 
pbar = tqdm(total=LENGTH, desc='consulta_comando') # Init pbar
    
    with ThreadPoolExecutor(200) as executor:    
    
        for host in lista_hosts:
            host_dns = add_dns_cc.add_dns_concesion(host)
         
            res_command_remote = executor.submit(comando_remoto.comando_remoto_hosts, host_dns, comando, res_versiones, user, clave_rsa, passwd)
            
            time.sleep(0.2)
            pbar.update(n=1) # Increments counter
        end = time.time() print(f"Runtime of the program is …
Run Code Online (Sandbox Code Playgroud)

python multithreading python-multithreading python-3.x progress-bar

1
推荐指数
1
解决办法
3437
查看次数

单击按钮上的进度条

在我的应用程序中,只需单击一个按钮,应用程序就可以进行一些处理,通过网络发送一些数据然后停止.由于需要一些时间,我试着加入进度条.进度条的代码位于按钮的onclick侦听器的开头.在进度条形码之后,通过网络处理和发送数据.但进度条根本不可见.我是否需要在单独的线程中显示进度条?

这就是我用来显示进度条的内容

final ProgressDialog pd=new ProgressDialog(this);
pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pd.setMessage("Please wait..");
pd.setCancelable(true);
pd.setIndeterminate(true);
pd.show();
Run Code Online (Sandbox Code Playgroud)

android onclick progress-bar

0
推荐指数
1
解决办法
3779
查看次数

具有超过100个要上载的文件的进度条

我目前正在开发一个进度条(使用Winforms),它将在电子邮件上传时显示.现在问题是,如果我上传超过100封电子邮件,进度条将无法加载.

这里是用于设置每个电子邮件填写进度条的金额的方法(如果有2个电子邮件给我2倍50%,如果有4个在25%步骤中进行... .......):

        public StatusUpload(int uploadAmount)
    {
        InitializeComponent();
        progressBar1.Step = 100 / uploadAmount;
    }
Run Code Online (Sandbox Code Playgroud)

有谁知道我怎么能解决这个问题?非常感谢提前,你的帮助是赞赏的

c# progress winforms progress-bar

0
推荐指数
1
解决办法
380
查看次数

实施进度条Winform

我正在尝试在C#Winform中实现进度条.但是我从未实现此功能.

我的应用程序发送了大量的电子邮件,我希望实现一个进度条,在每个发送的电子邮件中递增.电子邮件数量从16 - 50不等.

这可以实施吗?如果是的话怎么样?

请帮忙

感谢您的回答,可以找到更多帮助:如何在Windows应用程序中显示进度条?

c# loops winforms progress-bar

0
推荐指数
1
解决办法
1万
查看次数