Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Prism VS.NET to Delphi.NET Codesample (https://www.delphipraxis.net/111489-vs-net-delphi-net-codesample.html)

schwa226 4. Apr 2008 09:41


VS.NET to Delphi.NET Codesample
 
Hi,

ich habe eine Code für VS.NET und möchte ihn für Delphi.NET (CodeGear™ Delphi® 2007 für Microsoft® .NET Version 11.0.2902.10471) verwenden. Kann mir da jemand dabei helfen dies in die richtige Form zu bekommen?
Hab mit Delphi noch nicht viel Erfahrungen und bekomme es einfach nicht hin... :cry:

Code:
Zitat:

1) Open up vs.net and click New Project
2) Choose the language of your choise and create a new Class library project and call it MyPlugin
3) Add a reference to CoreInterfaces.dll located in your lcdstudio folder.
4) Paste the following code into class1.cs (C# is used but this code is that basic it shoudn't be hard to convert to VB.Net)

Code:
Code:
using System;
using LcdStudio.CoreInterfaces;

namespace MyPlugin

   public class Plugin : AbstractDataPlugin
   { 
      public override void RegisterData(IDataService ds)
      { 
         ds.RegisterVariable(Group,"MyPlugin.HelloWorld","MyPlugin\\Hello world");
         ds.RegisterVariable(Group,"MyPlugin.TimeMsg","MyPlugin\\Time");
         this.UpdateInterval = 10000; //Update every 10000ms (10 sec)
      } 
       
      public override void UpdateData(IDataService ds)
      { 
         ds.SetValue("MyPlugin.HelloWorld","Hello world");
         ds.SetValue("MyPlugin.TimeMsg",string.Format("The time is {0} ",DateTime.Now.ToShortTimeString()));
      } 

   } 
}


5) Compile your project and copy the resulting MyPlugin.dll to your LcdStudio folder
6) Create a file in your LcdStudio folder called MyPlugin.Plugin with the following lines

Code:
Code:
 
<?xml version="1.0" encoding="utf-8" ?>
<Plugins>
   <Plugin ID="My Plugin" Type="MyPlugin.Plugin, MyPlugin" Visible="Yes" >
      <Depends ID="DataService" />
      <Depends ID="DispatchService" />
   </Plugin>
</Plugins>


7) Run LcdStudio and add your Plugin in the config panel.

Can't make it any easyer to extend LcdStudio.
Hier ist das Programm LCDStudio zu finden: http://www.lcdstudio.com/site20/home.php

Kann mir das jemand für Delphi.NET übresetzen?

Alter Mann 4. Apr 2008 16:01

Re: VS.NET to Delphi.NET Codesample
 
Erst einmal Willkommen in der DP

Eine Möglichkeit
1. Menü->Datei->Neu->Weitere->C#->Klassenbiblothek
2. Name: MyPlugin, Pfad anpassen
3.
Delphi-Quellcode:
public class Class1
löschen
4. Referenz auf LcdStudio.CoreInterfaces hinzufügen (Projektfenster-Referenzen rechte Maustaste)
5. Code kopieren und einfügen
6. F5 drücken
7. Fertig

Gruß

Khabarakh 4. Apr 2008 17:15

Re: VS.NET to Delphi.NET Codesample
 
[ein wenig OT]
Wenn du das öfter machen willst bzw. das ein größeres Projekt wird und du selbst sagst, dass du in Delphi wenig Erfahrung hast (und in Delphi.Net wahrscheinlich überhaupt keine), wäre es dann nicht klüger, direkt C# zu lernen?
[/ein wenig OT]

@Alter Mann: Ich denke einmal, er will den Code noch selbst anpassen ;) . Man könnte höchstens die entstandene DLL in Lutz Roeders Reflector öffnen und den disassemblierten Delphi.Net-Code herauskopieren.

schwa226 4. Apr 2008 19:39

Re: VS.NET to Delphi.NET Codesample
 
Danke für die schnellen Antworten!

Ich möchte den Code nach Delphi.NET umändern, da ich schon einen anderen Code für Delphi habe.
Ansonsten müsste ich diesen anderen Code neu schreiben...

Und zur Info: habe nicht vor vieles in .NET zu machen. Für's erste halt nur so eine Plugin DLL. Das Programm LCDStudio versteht halt nur Plugins die auf .NET basieren.


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:31 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz