Better Idea to Maintain User wise Form Open/Close Log In WCF Based Windows Application. RRS feed

  • Question

  • I Have WCF Based SDI Windows Forms Application.

    In This Application I Maintain User wise Form Open/Close Log to avoid Mutual Exclusion.

    in application there is one base form And all forms are inherited from base form. now if i write logic for log in base Form then For each form it will go to service side and Update Log. For ex. 5 Forms are open then it will go 5 times to service side.

    to Avoid above  i use One form(Main Menu Form) with Background Worker. But with Background Worker When IsBusy Property become True then there will be some issue Happens.

    can any one suggest me other batter Idea For Maintain User wise Form Open/Close Log.

    Monday, July 23, 2018 7:29 AM

All replies

  • If I understand your question correctly, you want to ensure that only the base form instance does the logging and that other forms which inherit from the base form do not perform the logging.

    If that is correct, you can have your logging method check its own type before executing:

    Public Class BaseForm
        Inherits Form
        Public Sub SomeLoggingRoutine()
            If Me.GetType Is GetType(BaseForm) Then
                'execute the logging
            End If
            'otherwise, calling this method will do nothing
        End Sub
    End Class
    Public Class InheritedForm
        Inherits BaseForm
    End Class
    In the above example, calling SomeLoggingRoutine() will execute the code in the If-Then block when called on an instance of BaseForm, but calling the same method from an instance of InheritedForm will do nothing.

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Monday, July 23, 2018 4:11 PM