Autor Beitrag
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 23.01.08 14:57 
Das wäre schon mal eine Lösung. Ich habe s jetzt so:
Interface Assembly:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
namespace PluginInterface
{
    public interface IPluginInterface
    {
        string Author();
        string Caption();
        Form theHostForm { get; set; }
    }
}


Plugin:
ausblenden volle Höhe C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
namespace HydraPlugin
{
    [Plugin, VisualPlugin]
    public partial class HydraPlugin : VisualPlugin, IPluginInterface 
    {
        private Form hostForm;
        public HydraPlugin()
        {
            InitializeComponent();
        }

        // Interface Implementation
        public string Author()
        {
            return "Michael Puff";
        }

        public string Caption()
        {
            return "[Hyra Plugin - Demo]";
        }

        public Form theHostForm
        {
            get
            {
                return hostForm;
            }
            set
            {
                hostForm = value;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string s;
                s = theHostForm.HostExepath();
                label2.Text = s;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}


aber dan bekom eich die Fehlermeldung:
Zitat:
'System.Windows.Forms.Form' does not contain a definition for 'HostExepath' and no extension method 'HostExepath' accepting a first argument of type 'System.Windows.Forms.Form' could be found (are you missing a using directive or an assembly reference?)
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 23.01.08 15:02 
Form ist die Stammklasse aller Formen. Du leitest Dir ja in der Hostanwendung eine Klasse davon ab, die musst Du nehmen.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 23.01.08 15:04 
Dann muss ich die Host-Anwendung aber referenzieren, richtig?
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 23.01.08 15:06 
Hast Du für das Plugin-Interface doch sowieso :nixweiss:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".