Click here to Skip to main content
15,889,096 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionWindows application certain GUI elements do not work / display as expected Pin
Johan Hakkesteegt8-Oct-14 3:21
Johan Hakkesteegt8-Oct-14 3:21 
AnswerRe: Windows application certain GUI elements do not work / display as expected Pin
Eddy Vluggen8-Oct-14 7:59
professionalEddy Vluggen8-Oct-14 7:59 
GeneralRe: Windows application certain GUI elements do not work / display as expected Pin
Johan Hakkesteegt8-Oct-14 20:56
Johan Hakkesteegt8-Oct-14 20:56 
GeneralRe: Windows application certain GUI elements do not work / display as expected Pin
Eddy Vluggen9-Oct-14 0:29
professionalEddy Vluggen9-Oct-14 0:29 
QuestionAjax call with RadioButtonList Pin
byka6-Oct-14 6:52
byka6-Oct-14 6:52 
SuggestionRe: Ajax call with RadioButtonList Pin
Eddy Vluggen6-Oct-14 8:18
professionalEddy Vluggen6-Oct-14 8:18 
AnswerRe: Ajax call with RadioButtonList Pin
sankarsan parida7-Oct-14 18:11
professionalsankarsan parida7-Oct-14 18:11 
QuestionWindows Service, design question, threading, how to write a delegate Pin
jkirkerx5-Oct-14 12:26
professionaljkirkerx5-Oct-14 12:26 
This is the same program as the post below

I designed my windows service to run on a timer, and check the queue for email jobs.
So a job is queued, and I run the job on a new thread.

Question: Is this dumb to do and a waste of time?

I have the thread working now, but I need to be able to stop the thread or check on it's progress if the net stop is called, or power down while running. So I guess I need a delegate.

So this leads to the next question; how to write a delegate.

I used this post, http://tech.xster.net/tips/multi-threading-in-vb-net/[^]
but I don't understand where to place the code.

So I have a service code file, and a thread code file.
I call the thread here in the timer

[smtpMessenger.vb]
jRUN = New messageSender()
Dim dwRCode As Integer = jRUN.messageSender(
    sJOBS(idx),
    G_JOB_TIMER
)


And then this is my thread
[messageSender.vb]
Public Class messageSender
    Inherits send_Message_Broadcast_Record
    Implements IDisposable

    Dim disposed As Boolean = False

    Public M_RUNNING As Boolean
    Public M_MAILINGLIST_ID As Integer
    Public m_EMAILS_SENT As Integer
    Public m_STOP As Boolean

    Private mJOB As structure_CRM_JOBS
    Private mList() As structure_MailingList_Array
    Private M_JOBTIMER As System.Timers.Timer    

    Public Function messageSender( _
        ByVal pJOB As structure_CRM_JOBS,
        ByRef P_JOBTIMER As System.Timers.Timer) As Integer

        Dim dwExitCode As Integer = 2

        Dim ms_Container As messageSender = New messageSender()
        ms_Container.mJOB = pJOB
        ms_Container.M_JOBTIMER = P_JOBTIMER
        ms_Container.m_STOP = False

        Dim eLoader As New email_address_loader()
        Dim e_count As Integer = eLoader.get_malingList_Count()
        ReDim ms_Container.mList(e_count - 1)

        eLoader.load_mailingList_Array(ms_Container.mList)

        If Not (M_JOBTIMER Is Nothing) Then
            M_JOBTIMER.Stop()
        End If

        Dim msThread As Thread = New Thread(New ThreadStart(AddressOf ms_Container.messageSender_Proc))
        msThread.Priority = ThreadPriority.Lowest
        msThread.IsBackground = True
        msThread.Start()
        msThread.Join()

        Return dwExitCode

    End Function


I could really use some help here, perhaps just some remarks like delegate here, this there to get a better understanding of how to use the delegate on my current code.
AnswerRe: Windows Service, design question, threading, how to write a delegate Pin
Kornfeld Eliyahu Peter6-Oct-14 1:03
professionalKornfeld Eliyahu Peter6-Oct-14 1:03 
QuestionRe: Windows Service, design question, threading, how to write a delegate Pin
Richard Deeming6-Oct-14 1:24
mveRichard Deeming6-Oct-14 1:24 
GeneralRe: Windows Service, design question, threading, how to write a delegate Pin
jkirkerx6-Oct-14 6:39
professionaljkirkerx6-Oct-14 6:39 
QuestionWindows Service, Little help getting started Pin
jkirkerx2-Oct-14 11:35
professionaljkirkerx2-Oct-14 11:35 
AnswerRe: Windows Service, Little help getting started [solved] Pin
jkirkerx2-Oct-14 12:35
professionaljkirkerx2-Oct-14 12:35 
AnswerRe: Windows Service, Little help getting started Pin
Kornfeld Eliyahu Peter6-Oct-14 1:01
professionalKornfeld Eliyahu Peter6-Oct-14 1:01 
QuestionWindows Service that sends emails Pin
jkirkerx1-Oct-14 10:23
professionaljkirkerx1-Oct-14 10:23 
AnswerRe: Windows Service that sends emails Pin
Garth J Lancaster1-Oct-14 10:55
professionalGarth J Lancaster1-Oct-14 10:55 
GeneralRe: Windows Service that sends emails Pin
jkirkerx1-Oct-14 11:04
professionaljkirkerx1-Oct-14 11:04 
GeneralRe: Windows Service that sends emails Pin
Garth J Lancaster1-Oct-14 13:46
professionalGarth J Lancaster1-Oct-14 13:46 
GeneralRe: Windows Service that sends emails Pin
PIEBALDconsult1-Oct-14 11:32
mvePIEBALDconsult1-Oct-14 11:32 
GeneralRe: Windows Service that sends emails Pin
jkirkerx1-Oct-14 11:38
professionaljkirkerx1-Oct-14 11:38 
GeneralRe: Windows Service that sends emails Pin
PIEBALDconsult1-Oct-14 11:44
mvePIEBALDconsult1-Oct-14 11:44 
GeneralRe: Windows Service that sends emails Pin
jkirkerx1-Oct-14 11:45
professionaljkirkerx1-Oct-14 11:45 
AnswerRe: Windows Service that sends emails Pin
jschell3-Oct-14 9:11
jschell3-Oct-14 9:11 
GeneralRe: Windows Service that sends emails [Update on my progress] Pin
jkirkerx3-Oct-14 11:05
professionaljkirkerx3-Oct-14 11:05 
Questionasp:Menu select based on URL Pin
byka1-Oct-14 3:15
byka1-Oct-14 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.