Hi all,
i want to make a ProgressDialog.
User clicks on button "Delete", then ProgressDialog opens and Progress should be shown.
This is my code for the dialog class:
The deletion progress works fine. Only the Progressbar isnt displayed.
ProgressDialog is started as a modal Dialog:
No need to check DialogResult, just for blocking thread stepping out of the using block.
Any suggestions why the ProgressBar isnt updated when function runs.
When work is completed the RadProgressBar shows the full Progress.
thx
i want to make a ProgressDialog.
User clicks on button "Delete", then ProgressDialog opens and Progress should be shown.
This is my code for the dialog class:
Public Class ProgressDialog Public Property MessstelleItems As New List(Of tblMessstelleVerzeichnisNeue) Public Property ZahlerItems As New List(Of tblZahler) Public Property MessstellenPage As MessstellenPage Public Property ZahlerPage As ZahlerPage Private _ctx As EnergieManagementDataContext Public Sub New(ByVal ctx As EnergieManagementDataContext) ' This call is required by the designer. InitializeComponent() _ctx = ctx ' Add any initialization after the InitializeComponent() call. End Sub Protected Overrides Sub OnShown(ByVal e As EventArgs) MyBase.OnShown(e) DoWork() End Sub Private Sub DoWork() RadProgressBar.Minimum = 0 If MessstelleItems.Count > 0 Then RadProgressBar.Maximum = MessstelleItems.Count For Each item In MessstelleItems Dim index = MessstelleItems.IndexOf(item) + 1 ProgressRadLabel.Text = "Lösche Messstelle " + index.ToString() + " von " + MessstelleItems.Count.ToString() RadProgressBar.Value1 = MessstelleItems.IndexOf(item) + 1 Me.Refresh() Dim tmp As New List(Of tblMessstelleVerzeichnisNeue) tmp.Add(item) MessstellenPage.CurrentMeasuringPoints = (From p In _ctx.tblMessstelleVerzeichnisNeues.ToList() Join r In tmp On p.MessstelleVerzeichnisID Equals r.MessstelleVerzeichnisID Select p).Distinct().ToList() MessstellenPage.DeleteCurrentMeasuringPoints() Next Else End If End SubEnd ClassProgressDialog is started as a modal Dialog:
Using dataContext = New EnergieManagementDataContext Dim dlo As New DataLoadOptions() dlo.LoadWith(Of tblMessstelleVerzeichnisVersion)(Function(r) r.tblMessstelleVerzeichnisZeiches) dlo.LoadWith(Of tblMessstelleVerzeichnisVersion)(Function(r) r.tblMessstelleVerzeichnisMessbereiches) dlo.LoadWith(Of tblMessstelleVerzeichnisVersion)(Function(r) r.tblMessstelleVerzeichnisStorungsbereiches) dlo.LoadWith(Of tblMessstelleVerzeichnisVersion)(Function(r) r.tblMessstelleVerzeichnisVersionZahlerKanals) dlo.LoadWith(Of tblMessstelleVerzeichnisVersion)(Function(r) r.tblMessstelleVerzeichnisVersionVerantwortliches) dlo.LoadWith(Of tblMessstelleVerzeichnisVersion)(Function(r) r.tblMessstelleVerzeichnisAreal) dlo.LoadWith(Of tblMessstelleVerzeichnisVersion)(Function(r) r.tblDokumentes) dlo.LoadWith(Of tblMessstelleVerzeichnisVersionZahlerKanal)(Function(r) r.tblZahlerKanal) dlo.LoadWith(Of tblZahlerKanal)(Function(r) r.tblZahlerVersion) dataContext.LoadOptions = dlo Dim progress As New ProgressDialog(dataContext) items = RadGridViewMessstellen.SelectedRows.Select(Function(c) CType(c.Tag, tblMessstelleVerzeichnisNeue)).ToList() progress.MessstellenPage = Me progress.MessstelleItems = items progress.ShowDialog()End UsingNo need to check DialogResult, just for blocking thread stepping out of the using block.
Any suggestions why the ProgressBar isnt updated when function runs.
When work is completed the RadProgressBar shows the full Progress.
thx
