473,782 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Progress Bars and Remoting

I'd just like a sanity check on my thinking. I'm attempting to create
a progress bar for a file upload to an ASPX page. I'm adding an HTTP
Module, which would then call into a "Progress Handler", a remoting
object created as a singleton object, which would keep track of all
file uploads by an id. Does this make sense?

I haven't seen this implementation of a progress bar mentioned
anywhere. Am I missing something? Thanks for the input!!

Joel Cade, MCSD
Brinster, Inc.

Here's the paired down code:

-- The HTTP Module ---

Imports System.Web

Public Class progressModule
Implements IHttpModule

Dim oHandler As ProgressHandler .ProgressHandle r
Dim context As HttpContext
Dim currentId As String

Public Sub Init(ByVal application As Web.HttpApplica tion)
Implements IHttpModule.Ini t
AddHandler application.Beg inRequest, AddressOf
Me.Application_ BeginRequest
AddHandler application.End Request, AddressOf
Me.Application_ EndRequest
End Sub

Public Sub Dispose() Implements IHttpModule.Dis pose
End Sub

Private Sub Application_Beg inRequest(ByVal source As Object, ByVal
e As EventArgs)
Dim application As HttpApplication = CType(source,
HttpApplication )
context = application.Con text

oHandler = Activator.GetOb ject(GetType(Pr ogressHandler.P rogressHandler) ,
"")
currentId = Guid.NewGuid.To String

Dim timer As New Timers.Timer(50 0)
AddHandler timer.Elapsed, AddressOf OnTimerTick
End Sub

Private Sub Application_End Request(ByVal source As Object, ByVal e
As EventArgs)
Dim application As HttpApplication = CType(source,
HttpApplication )
Dim context As HttpContext = application.Con text
End Sub

Private Sub OnTimerTick(ByV al source As Object, ByVal e As
Timers.ElapsedE ventArgs)
oHandler.Update Values(currentI d,
context.Request .ContentLength, context.Request .TotalBytes)
End Sub
End Class

--- The Handler (Remoted) ---

Imports System.Runtime. Remoting

Public Class ProgressHandler
Inherits MarshalByRefObj ect

Dim dtProgressValue s As DataTable

Public Sub New()
dtProgressValue s = New DataTable()

dtProgressValue s.Columns.Add(" Id", GetType(String) ,
vbNullString)
dtProgressValue s.Columns.Add(" BytesTotal", GetType(Integer ),
0)
dtProgressValue s.Columns.Add(" BytesFinished",
GetType(Integer ), 0)

dtProgressValue s.PrimaryKey(0) = dtProgressValue s.Columns(0)
End Sub

Public Sub UpdateValues(By Val Id As String, ByVal BytesTotal As
Integer, ByVal BytesFinished As Integer)
Dim dRow As DataRow

dRow = dtProgressValue s.Rows.Find(Id)

If dRow Is Nothing Then
dRow = dtProgressValue s.NewRow

dRow(0) = Id
dRow(1) = BytesTotal
dRow(2) = BytesFinished

dtProgressValue s.Rows.Add(dRow )
Else
dRow(1) = BytesTotal
dRow(2) = BytesFinished
End If
End Sub

Public Function GetBytesTotal(B yVal Id As String) As Integer
Dim dRow As DataRow

dRow = dtProgressValue s.Rows.Find(Id)

If dRow Is Nothing Then
Return 0
Else
Return dRow("BytesTota l")
End If
End Function

Public Function GetBytesFinishe d(ByVal Id As String) As Integer
Dim dRow As DataRow

dRow = dtProgressValue s.Rows.Find(Id)

If dRow Is Nothing Then
Return 0
Else
Return dRow("BytesFini shed")
End If
End Function
End Class
Nov 17 '05 #1
0 1481

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
24998
by: Paul | last post by:
i have been working with vb6 for a while but never had the pleasure of using progress bars. That is until now, one of the programs i have written has just been modified so that large csv files of 100,000+ lines can be imported into a database. the import works fine but the progress bar feature is not working correctly. The progress bar is set to a max value of the number of records in the csv file, the records are then imported and the...
0
1460
by: Martin Platt | last post by:
Hi, I'm looking into various options for a fairly simple backup utility for our application. I have no problems being able to backup, find restorable backup files, and restore then. What I'd like to be able to do is hook into some event in Sql that would allow me to show progress of these tasks.
2
1570
by: Jack Addington | last post by:
I am working on app that currently all resides on the same machine but plan to pull the database off and try to move all the datafunctionality to a remote machine. I have a data function that is processing a loop of rows and calling a stored proc for each row. All is encapsulated within a single oracle transaction. I have a logic class that is making a call to the dataaccess class and passing the rows. I can serialize the dataobject...
1
4249
by: Xarky | last post by:
Hi, I am trying to use progress bars, where the progress is seen as vertical. I am succeding to manage progess bars, where progress is increasing horizontally, but not vertically. Can someone help me out Thanks in Advance
5
7385
by: Søren Reinke | last post by:
Hi there I am working on a program where the user should be able to import some CSV files. With my set of test data, it takes about 2 minutes to import, while it is importing the program sort of freezes. Therefore i would like to open a little window with a progress bar in it that shows how far the import has come.
6
2515
by: Kyle | last post by:
I want to do a single pix update bar instead of the big block that progress bars usually use. I can't seem to find any info on how to do this. Thanks in advance for any help, Kyle
2
2956
by: Robert Smith | last post by:
Hello, I have a problem with my progress bar, as shown in the attached code, the values on the bar are incremented within a threaded timer event. The timer works fine and ticks all the way through. However when you Add a new status bar to the form with a Progress bar and then immediately perform some intense programming that uses a lot of processor resources, the bars in the progress bar are not displayed, even though the timer appears to...
5
2425
by: Keith Rebello | last post by:
I have a couple of progress bars that indicate the progress of a math-intensive application. They are working well. The only problem is that the progress indicator is gray in color. Is it possible to change the color of the bars - they're usually blue in other applications? Any help would be greatly appreciated. I'm using VB.Net Standard, 2003.
3
8674
by: Ritesh Raj Sarraf | last post by:
Hi, I have a small application, written in Python, that uses threads. The application uses function foo() to download files from the web. As it reads data from the web server, it runs a progress bar by calling an install of a progress bar class. When using threads, I get the problem that the progress bar gets over-written by the download progress of files from other threads.
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.