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
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
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