SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
www.inqu.de




.NET User Group Dresden

            Real World Scenario
 Deeplinking in eine WinForms-Anwendung

               01.03.2012
         InQu Informatics GmbH
             Marco Wagner
www.inqu.de


die vorhandene Anwendung

 unternehmensinternes Bestellsystem
 WinForms-Client auf Terminalserver




                            Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


das Ziel

 Migration ins Web
 neue Features
 Einsparung Terminalserver




                              Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


das (Zwischen)Ergebnis

 Bestellansicht




                         Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Herausforderung

 2 Systeme
 Medienbruch Win/Web
 „nicht aus einem Guß“

 Mindestanforderung: Navigation zwischen beiden Systemen




                            Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Navigation zwischen Win & Web



      vonnach   Win                          Web
      Win        Nav zw. Modulen              Hyperlink
      Web        ?                            Hyperlink




                       Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Nachrichten vom Web ins Win?

 Skype?
 MSDN?




                     Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Custom URL Protocol

 eigenen URL-Protokollhandler registrieren und
  implementieren

 http://
 ms-help://
 skype://

 shop://

   MSDN: http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx



                                       Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


URL-Protokoll registrieren

 siehe shop.reg in MessageDispatcher.csproj




                              Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Windows Registry

HKEY_CLASSES_ROOT     COM-Registrierung; Dateitypen / Erweiterungen
HKEY_CURRENT_USER     Profil aktueller User
HKEY_LOCAL_MACHINE    Nutzerübergreifende Einstellungen
HKEY_USERS            Nutzerstamm
HKEY_CURRENT_CONFIG   Profil aktuelle Hardware




                                   Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Kommunikation über Prozessgrenzen hinweg

 Problem
    Prozesse haben separate Adressräume

 Lösungen
      Pipes
      Events / Nachrichten
      Funktionsaufrufe / Remote Procedure Calls
      Shared Memory




                                       Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Navigation von Web nach Win (auch) per Hyperlink




                        Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Demo Prototyp

 siehe Solution




                   Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Übersicht Prototyp




                     Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Pause?




         Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


URL



      shop://component=Bestellungen;id=2




                      Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Nachricht

 Nachrichtentyp: WM_COPYDATA
    http://msdn.microsoft.com/en-
     us/library/windows/desktop/ms649011(v=vs.85).aspx
 Nachrichtenstruktur: COPYDATASTRUCT
    http://msdn.microsoft.com/en-
     us/library/windows/desktop/ms649010(v=vs.85).aspx

 siehe Shared




                                    Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


URL via Dispatcher weiterreichen
(Nachricht senden)
 vgl. MessageDispatcher.Program
        [DllImport("user32.dll")]
        public static extern int SendMessage(
               IntPtr hWnd,
               int Msg,
               IntPtr wParam,
               ref WndMessage lParam);

 SendMessage schickt direkt ans Ziel und wartet bis
  Abarbeitung (Message Loop; synchron)
 PostMessage legt Message in Queue und kehrt sofort zurück
  (Message Queue; asynchron)
                             Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


URL/ Parameter im Legacy Shop verarbeiten
(Nachricht empfangen)
 siehe WndProc in LegacyShop


protected override void WndProc(ref Message m)

…

var messageData = (WndMessage)Marshal
       .PtrToStructure(m.LParam, typeof(WndMessage));

var message = Marshal.PtrToStringUni(messageData.lpData);




                               Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


proprietäre Nachrichteninterpretation

              shop://component=Bestellungen;id=2



var formatPattern =
       @"shop://component=(?<componentKey>w+);id=(?<id>d+)";
var match = Regex.Match(message, formatPattern);

var componentKey = match.Groups["componentKey"].Value;
var idText = match.Groups["id"].Value;




                               Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Fragen?




          Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
www.inqu.de


Slides & Code

 demnächst auf
    http://raumwolken.de
    http://dd-dotnet.de/

 Fragen
    marco.wagner@inqu.de




                            Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de

Weitere ähnliche Inhalte

Ähnlich wie Deeplinking in eine WinForms-Anwendung

Service oriented alerting
Service oriented alertingService oriented alerting
Service oriented alertinggeekQ
 
Einsatz eines Unternehmens-Wikis für das Wissensmanagement
Einsatz eines Unternehmens-Wikis für das WissensmanagementEinsatz eines Unternehmens-Wikis für das Wissensmanagement
Einsatz eines Unternehmens-Wikis für das WissensmanagementCommunardo GmbH
 
Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Jürg Stuker
 
OSDC 2010 | IT Service Management mit Open Source Software „OpenITSM“ by Juli...
OSDC 2010 | IT Service Management mit Open Source Software „OpenITSM“ by Juli...OSDC 2010 | IT Service Management mit Open Source Software „OpenITSM“ by Juli...
OSDC 2010 | IT Service Management mit Open Source Software „OpenITSM“ by Juli...NETWAYS
 
20040921 Serviceorientierte Architektur für WebSphere und WebSphere Portal
20040921 Serviceorientierte Architektur für WebSphere und WebSphere Portal20040921 Serviceorientierte Architektur für WebSphere und WebSphere Portal
20040921 Serviceorientierte Architektur für WebSphere und WebSphere PortalFrank Rahn
 
IKT-Trends und deren Bedeutung für eHealth
IKT-Trends und deren Bedeutung für eHealthIKT-Trends und deren Bedeutung für eHealth
IKT-Trends und deren Bedeutung für eHealthFraunhofer AISEC
 
Vortrag zu Apps AppPlusMobile, Kreativamt Gladbeck
Vortrag zu Apps AppPlusMobile, Kreativamt GladbeckVortrag zu Apps AppPlusMobile, Kreativamt Gladbeck
Vortrag zu Apps AppPlusMobile, Kreativamt GladbeckAppPlusMobile.info
 
Industrie 4.0
Industrie 4.0Industrie 4.0
Industrie 4.0GESIS
 
Nagios Conference 2006 | Automatisierung von Performancecharts mit dem Nagios...
Nagios Conference 2006 | Automatisierung von Performancecharts mit dem Nagios...Nagios Conference 2006 | Automatisierung von Performancecharts mit dem Nagios...
Nagios Conference 2006 | Automatisierung von Performancecharts mit dem Nagios...NETWAYS
 
Cloud Native Computing
Cloud Native ComputingCloud Native Computing
Cloud Native ComputingAarno Aukia
 
TeamProQ - Die Arbeitsplattform für den gesamten Immobilien-Lebenszyklus!
TeamProQ - Die Arbeitsplattform für den gesamten Immobilien-Lebenszyklus!TeamProQ - Die Arbeitsplattform für den gesamten Immobilien-Lebenszyklus!
TeamProQ - Die Arbeitsplattform für den gesamten Immobilien-Lebenszyklus!TeamProQ GmbH
 
Knockin' on heaven's door - Die Praxis zu Besuch beim W3C
Knockin' on heaven's door - Die Praxis zu Besuch beim W3CKnockin' on heaven's door - Die Praxis zu Besuch beim W3C
Knockin' on heaven's door - Die Praxis zu Besuch beim W3CJens Grochtdreis
 
TechCommToGo + Kisters 3DVS | GO MOBILE
TechCommToGo + Kisters 3DVS | GO MOBILETechCommToGo + Kisters 3DVS | GO MOBILE
TechCommToGo + Kisters 3DVS | GO MOBILEGeorg Eck
 
PIM2Print mit Xactuell
PIM2Print mit XactuellPIM2Print mit Xactuell
PIM2Print mit XactuellUnic
 

Ähnlich wie Deeplinking in eine WinForms-Anwendung (20)

Service oriented alerting
Service oriented alertingService oriented alerting
Service oriented alerting
 
Einsatz eines Unternehmens-Wikis für das Wissensmanagement
Einsatz eines Unternehmens-Wikis für das WissensmanagementEinsatz eines Unternehmens-Wikis für das Wissensmanagement
Einsatz eines Unternehmens-Wikis für das Wissensmanagement
 
Continuous Delivery in ADF Projekten
Continuous Delivery in ADF ProjektenContinuous Delivery in ADF Projekten
Continuous Delivery in ADF Projekten
 
Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Top 10 Internet Trends 2006
Top 10 Internet Trends 2006
 
OSDC 2010 | IT Service Management mit Open Source Software „OpenITSM“ by Juli...
OSDC 2010 | IT Service Management mit Open Source Software „OpenITSM“ by Juli...OSDC 2010 | IT Service Management mit Open Source Software „OpenITSM“ by Juli...
OSDC 2010 | IT Service Management mit Open Source Software „OpenITSM“ by Juli...
 
20040921 Serviceorientierte Architektur für WebSphere und WebSphere Portal
20040921 Serviceorientierte Architektur für WebSphere und WebSphere Portal20040921 Serviceorientierte Architektur für WebSphere und WebSphere Portal
20040921 Serviceorientierte Architektur für WebSphere und WebSphere Portal
 
IKT-Trends und deren Bedeutung für eHealth
IKT-Trends und deren Bedeutung für eHealthIKT-Trends und deren Bedeutung für eHealth
IKT-Trends und deren Bedeutung für eHealth
 
Vortrag zu Apps AppPlusMobile, Kreativamt Gladbeck
Vortrag zu Apps AppPlusMobile, Kreativamt GladbeckVortrag zu Apps AppPlusMobile, Kreativamt Gladbeck
Vortrag zu Apps AppPlusMobile, Kreativamt Gladbeck
 
Prezentacja - Konkurs Goethe Institut
Prezentacja - Konkurs Goethe InstitutPrezentacja - Konkurs Goethe Institut
Prezentacja - Konkurs Goethe Institut
 
Industrie 4.0
Industrie 4.0Industrie 4.0
Industrie 4.0
 
VDC Newsletter 2010-10
VDC Newsletter 2010-10VDC Newsletter 2010-10
VDC Newsletter 2010-10
 
Nagios Conference 2006 | Automatisierung von Performancecharts mit dem Nagios...
Nagios Conference 2006 | Automatisierung von Performancecharts mit dem Nagios...Nagios Conference 2006 | Automatisierung von Performancecharts mit dem Nagios...
Nagios Conference 2006 | Automatisierung von Performancecharts mit dem Nagios...
 
Built To Last - Nachhaltige Software-Entwicklung
Built To Last - Nachhaltige Software-EntwicklungBuilt To Last - Nachhaltige Software-Entwicklung
Built To Last - Nachhaltige Software-Entwicklung
 
VDC Newsletter 2006-09
VDC Newsletter 2006-09VDC Newsletter 2006-09
VDC Newsletter 2006-09
 
VDC Newsletter 2009-07
VDC Newsletter 2009-07VDC Newsletter 2009-07
VDC Newsletter 2009-07
 
Cloud Native Computing
Cloud Native ComputingCloud Native Computing
Cloud Native Computing
 
TeamProQ - Die Arbeitsplattform für den gesamten Immobilien-Lebenszyklus!
TeamProQ - Die Arbeitsplattform für den gesamten Immobilien-Lebenszyklus!TeamProQ - Die Arbeitsplattform für den gesamten Immobilien-Lebenszyklus!
TeamProQ - Die Arbeitsplattform für den gesamten Immobilien-Lebenszyklus!
 
Knockin' on heaven's door - Die Praxis zu Besuch beim W3C
Knockin' on heaven's door - Die Praxis zu Besuch beim W3CKnockin' on heaven's door - Die Praxis zu Besuch beim W3C
Knockin' on heaven's door - Die Praxis zu Besuch beim W3C
 
TechCommToGo + Kisters 3DVS | GO MOBILE
TechCommToGo + Kisters 3DVS | GO MOBILETechCommToGo + Kisters 3DVS | GO MOBILE
TechCommToGo + Kisters 3DVS | GO MOBILE
 
PIM2Print mit Xactuell
PIM2Print mit XactuellPIM2Print mit Xactuell
PIM2Print mit Xactuell
 

Mehr von .NET User Group Dresden (6)

Dynamic linq
Dynamic linqDynamic linq
Dynamic linq
 
GUIs mit Expression Blend
GUIs mit Expression BlendGUIs mit Expression Blend
GUIs mit Expression Blend
 
Visual Studio Tools for Office
Visual Studio Tools for OfficeVisual Studio Tools for Office
Visual Studio Tools for Office
 
Team Foundation Server
Team Foundation ServerTeam Foundation Server
Team Foundation Server
 
Silverlight
SilverlightSilverlight
Silverlight
 
Lambda Expressions & Linq
Lambda Expressions & LinqLambda Expressions & Linq
Lambda Expressions & Linq
 

Deeplinking in eine WinForms-Anwendung

  • 1. www.inqu.de .NET User Group Dresden Real World Scenario Deeplinking in eine WinForms-Anwendung 01.03.2012 InQu Informatics GmbH Marco Wagner
  • 2. www.inqu.de die vorhandene Anwendung  unternehmensinternes Bestellsystem  WinForms-Client auf Terminalserver Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 3. www.inqu.de das Ziel  Migration ins Web  neue Features  Einsparung Terminalserver Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 4. www.inqu.de das (Zwischen)Ergebnis  Bestellansicht Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 5. www.inqu.de Herausforderung  2 Systeme  Medienbruch Win/Web  „nicht aus einem Guß“  Mindestanforderung: Navigation zwischen beiden Systemen Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 6. www.inqu.de Navigation zwischen Win & Web vonnach Win Web Win Nav zw. Modulen Hyperlink Web ? Hyperlink Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 7. www.inqu.de Nachrichten vom Web ins Win?  Skype?  MSDN? Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 8. www.inqu.de Custom URL Protocol  eigenen URL-Protokollhandler registrieren und implementieren  http://  ms-help://  skype://  shop://  MSDN: http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 9. www.inqu.de URL-Protokoll registrieren  siehe shop.reg in MessageDispatcher.csproj Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 10. www.inqu.de Windows Registry HKEY_CLASSES_ROOT COM-Registrierung; Dateitypen / Erweiterungen HKEY_CURRENT_USER Profil aktueller User HKEY_LOCAL_MACHINE Nutzerübergreifende Einstellungen HKEY_USERS Nutzerstamm HKEY_CURRENT_CONFIG Profil aktuelle Hardware Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 11. www.inqu.de Kommunikation über Prozessgrenzen hinweg  Problem  Prozesse haben separate Adressräume  Lösungen  Pipes  Events / Nachrichten  Funktionsaufrufe / Remote Procedure Calls  Shared Memory Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 12. www.inqu.de Navigation von Web nach Win (auch) per Hyperlink Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 13. www.inqu.de Demo Prototyp  siehe Solution Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 14. www.inqu.de Übersicht Prototyp Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 15. www.inqu.de Pause? Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 16. www.inqu.de URL shop://component=Bestellungen;id=2 Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 17. www.inqu.de Nachricht  Nachrichtentyp: WM_COPYDATA  http://msdn.microsoft.com/en- us/library/windows/desktop/ms649011(v=vs.85).aspx  Nachrichtenstruktur: COPYDATASTRUCT  http://msdn.microsoft.com/en- us/library/windows/desktop/ms649010(v=vs.85).aspx  siehe Shared Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 18. www.inqu.de URL via Dispatcher weiterreichen (Nachricht senden)  vgl. MessageDispatcher.Program [DllImport("user32.dll")] public static extern int SendMessage( IntPtr hWnd, int Msg, IntPtr wParam, ref WndMessage lParam);  SendMessage schickt direkt ans Ziel und wartet bis Abarbeitung (Message Loop; synchron)  PostMessage legt Message in Queue und kehrt sofort zurück (Message Queue; asynchron) Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 19. www.inqu.de URL/ Parameter im Legacy Shop verarbeiten (Nachricht empfangen)  siehe WndProc in LegacyShop protected override void WndProc(ref Message m) … var messageData = (WndMessage)Marshal .PtrToStructure(m.LParam, typeof(WndMessage)); var message = Marshal.PtrToStringUni(messageData.lpData); Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 20. www.inqu.de proprietäre Nachrichteninterpretation shop://component=Bestellungen;id=2 var formatPattern = @"shop://component=(?<componentKey>w+);id=(?<id>d+)"; var match = Regex.Match(message, formatPattern); var componentKey = match.Groups["componentKey"].Value; var idText = match.Groups["id"].Value; Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 21. www.inqu.de Fragen? Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de
  • 22. www.inqu.de Slides & Code  demnächst auf  http://raumwolken.de  http://dd-dotnet.de/  Fragen  marco.wagner@inqu.de Marco Wagner | InQu Informatics GmbH | http://inqu.de | http://raumwolken.de