Solved

PLUGIN PROBLEM

Posted on 2012-12-21
19
189 Views
Last Modified: 2012-12-21
Hi All,

I usually call form using :

  Private Sub mnuSetupMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuSetupMenu.Click
        Dim strAppNo As String = ERV_Screen_Function.Get_App_No(sender, strMainMenuId, strMainMenuName)

        Dim clsFormAuthority As New clsFormAuthority(ERV_Global.strLoginUserID, _
                                                     strAppId, _
                                                     strMainMenuId, _
                                                     strMainMenuName, _
                                                     strAppNo, _
                                                     "TMUSERMENU", _
                                                     "USER MENU")

        If Not ERV_Global.Form_Active("frmTMUSERMENU", Me) Then
            If clsFormAuthority.blnAccess Then
                Dim frmTMUSERMENU As New frmTMUSERMENU()
                frmTMUSERMENU.clsFormAuthority = clsFormAuthority
                frmTMUSERMENU.MdiParent = Me
                frmTMUSERMENU.Show()
            End If
        End If
    End Sub

The form is inside the same project ?

Could I use the above method for form that came from plugin ?

The are several things that should aware at the plugin :

1. Connection.
2. Authority
3. Parameter

That usually there are no problem when it is inside the same project.

How could I  overcome this stuff ?

Thank you.
0
Comment
Question by:emi_sastra
  • 10
  • 9
19 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38712514
You can create and show a form from plugin the same way you can any other object.

Not sure what you mean by the 3 items you listed. Are these some variables that the form needs access to? Can you not pass these to the form?
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 38712528
The are several things that should aware at the plugin :

1. Connection.
    Usually the form get variable from main application.

2. Authority
    frmTMUSERMENU.clsFormAuthority = clsFormAuthority

3. Parameter
    We need to show certain data for example.

Thank you.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 38712530
Option Explicit On

Imports System.Data.SqlClient

Public Class frmTMUSERMENU

    Public clsFormAuthority As clsFormAuthority

End Sub
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38712543
Is frmTMUSERMENU from plugin? If not, plugin form would need you to pass that information the same way you are currently passing. Are you writing the plugin?
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 38712562
- Is frmTMUSERMENU from plugin?
Currently not, but I am trying to do so. The sample above does not using plugin.

-If not, plugin form would need you to pass that information the same way you are currently passing.
Ok. Thus, there is not changing code at the plugin form ?

-Are you writing the plugin?
Currently not, but I am trying to do so.

Thank you.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38712569
Can you elaborate more on your requirements and why you are writing plugin? From information given, does not look like you need to make much changes.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 38712579
- Can you elaborate more on your requirements and why you are writing plugin?
Generate different report for different company. I don't want to change the main application.

-From information given, does not look like you need to make much changes.
Why ?

Thank you.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38712604
>Why ?
Keep passing the same information to the form loaded from pluggin.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 38712620
Would you please explain :

1. Form compiled to dll
2. Form using plugin
3. MEF

What makes them different ?

Thank you.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38712632
1. Class in DLL just like any other class
2. A technique which can be implemented by 1 and 3
3. A framework to implement a plugin.


Would you have multiple plugins (companies) for each installation or is it one per installation?
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 38712642
-Would you have multiple plugins (companies) for each installation or is it one per installation?
Don't get it. What makes it different ?

Thank you.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38712661
>Don't get it. What makes it different ?

There is a difference between having a different but only one DLL per installation vs having the possibility to load an infinite number of DLLs from a plugins folder based on some configuration/condition.

If its a single DLL, you can just keep one DLL per installation and load a form from it. On the source side, you will maintain that DLL for each company separately and then copy the correct DLL for the company when deploying.

If its multiple DLLs per installation, you need to add logic to load the correct DLL in current situation (company drop down on a form for example).
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 38712687
Ok. I think single dll is more simple to deploy. Is it correct ?
Does it mean, we just have one main application for all of the companies ?
Anything different just replace the dll (the plugin) ?

Thank you.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38712760
Yes.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 38712779
Ok. Back to the pluging problem :

1. Connection.
2. Authority
3. Parameter

How to communicate among Main App, Plugin and DLL Forms for the above stuff ?

Thank you.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38712809
Reference the DLL, create the form from DLL, and assign these values to properties of form.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 38712821
- Reference the DLL
From where ? Main or Plugin ?

 - create the form from DLL
I am sorry, do not get it.

-and assign these values to properties of form.
I am sorry, do not get it too.

Thank you.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 38712878
- Reference the DLL
>From where ? Main or Plugin ?
Obviously from main. Why would you reference the DLL from DLL?

 - create the form from DLL
>I am sorry, do not get it.

Create a form!
Dim MyForm As New DLLName.NamespaceIfAny.FormName

-and assign these values to properties of form.
>I am sorry, do not get it too.

MyForm.Connection = SomeConnection
MyForm.Authority = SomeAuthority
MyForm.Parameter = SomeParameter
0
 
LVL 1

Author Closing Comment

by:emi_sastra
ID: 38712907
Great.

Thank you very much for your help.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
I need C# converted to VB.net 1 53
Custom auto number 6 51
Maintain selection of the datagrdview 8 20
Tabcontrol Caption? 1 24
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now