|
Imports System.ComponentModel
Public Class SolverPresenter
Private ReadOnly m_SolverViewModel As SolverViewModel
Private ReadOnly m_Solver As AsynchronousSolver
Public Sub New(ByVal solver As AsynchronousSolver)
m_Solver = solver
AddHandler m_Solver.AsyncCompleted, AddressOf Solver_AsyncCompleted
m_SolverViewModel = New SolverViewModel(solver)
m_SolverViewModel.InitializeBoundProperties()
End Sub
Public Event FindAsyncCompleted As AsyncCompletedEventHandler
Public ReadOnly Property SolverViewModel As SolverViewModel
Get
Return m_SolverViewModel
End Get
End Property
Public Sub FindClicked()
With SolverViewModel
.Answer = String.Empty
.Validate()
If .IsValid Then
.UpdateModel()
.ProgressBarVisible = True
.ControlsEnabled = False
m_Solver.FindSumOfMultiplesOfSeedsBelowMaxAsync()
End If
End With
End Sub
Public Sub CancelClicked()
m_Solver.CancelAsync()
End Sub
Protected Overridable Sub OnFindAsyncCompleted(ByVal e As AsyncCompletedEventArgs)
RaiseEvent FindAsyncCompleted(Me, e)
End Sub
Private Sub Solver_AsyncCompleted(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs)
OnFindAsyncCompleted(e)
With SolverViewModel
.ProgressPercentage = 0
.ProgressBarVisible = False
.ControlsEnabled = True
End With
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
He started his career as a PDP-11 assembly language programmer in downtown Tokyo, learning what "patience" in real life means by punching a 110 baud ASR-33 Teletype frantically. He used to be able to put in the absolute loader sequence through the switch panel without consulting the DEC programming card.
Since then, his computer language experiences include 8051 assembly, FOCAL, BASIC, FORTRAN-IV, Turbo/MS C, VB. VB.NET, and C#.
Now, he lives with his wife, two grown-up kids (get out of my place!), and two cats in Westerville, Ohio.