From be3bec237516064b864bba10be3ce097a313926e Mon Sep 17 00:00:00 2001 From: Patrick Ecker Date: Fri, 27 May 2011 13:19:47 +0200 Subject: [PATCH] connection should know work fine --- .../CommandProfiles/PowerPointProfile.cs | 8 +- CommandServer/CommandServer/MainWindow.xaml | 2 +- CommandServer/CommandServer/MainWindow.xaml.cs | 24 ++- GestureDetectionApp/.metadata/.mylyn/tasks.xml.zip | Bin 250 -> 250 bytes .../.safetable/org.eclipse.core.resources | Bin 7255 -> 3428 bytes .../.settings/org.eclipse.jdt.ui.prefs | 3 +- .../org.eclipse.debug.ui/dialog_settings.xml | 4 +- .../usagedata.csv | 77 +++------ .../QualifiedTypeNameHistory.xml | 5 +- .../org.eclipse.ui.workbench/dialog_settings.xml | 5 + .../org.eclipse.ui.workbench/workbench.xml | 180 ++++++++++++++++----- .../GestureSensitiveControl/GestureActivity.java | 12 +- 12 files changed, 201 insertions(+), 119 deletions(-) rewrite GestureDetectionApp/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources (72%) rewrite GestureDetectionApp/.metadata/.plugins/org.eclipse.epp.usagedata.recording/usagedata.csv (71%) diff --git a/CommandServer/CommandServer/CommandProfiles/PowerPointProfile.cs b/CommandServer/CommandServer/CommandProfiles/PowerPointProfile.cs index 54eea3f..c293345 100644 --- a/CommandServer/CommandServer/CommandProfiles/PowerPointProfile.cs +++ b/CommandServer/CommandServer/CommandProfiles/PowerPointProfile.cs @@ -8,19 +8,16 @@ using Microsoft.Office.Interop.PowerPoint; namespace CommandServer.CommandProfiles { public class PowerPointProfile : CommandProfile { - private Application app = null; + public PowerPointProfile(Action logError) : base(logError) { ProfileName = "Microsoft PowerPoint"; - try { - app = (Application)Marshal.GetActiveObject("PowerPoint.Application"); - } catch (Exception e) { - } } public override void ForwardGesture() { try { + var app = (Application)Marshal.GetActiveObject("PowerPoint.Application"); var presentation = app.ActivePresentation; int i = presentation.SlideShowWindow.View.CurrentShowPosition; if (i < presentation.Slides.Count) @@ -33,6 +30,7 @@ namespace CommandServer.CommandProfiles { public override void BackwardGesture() { try { + var app = (Application)Marshal.GetActiveObject("PowerPoint.Application"); var presentation = app.ActivePresentation; int i = presentation.SlideShowWindow.View.CurrentShowPosition; if (i > 1) diff --git a/CommandServer/CommandServer/MainWindow.xaml b/CommandServer/CommandServer/MainWindow.xaml index b147599..2c8e5c8 100644 --- a/CommandServer/CommandServer/MainWindow.xaml +++ b/CommandServer/CommandServer/MainWindow.xaml @@ -18,7 +18,7 @@ VerticalAlignment="Stretch" /> - + diff --git a/CommandServer/CommandServer/MainWindow.xaml.cs b/CommandServer/CommandServer/MainWindow.xaml.cs index 49d4ca8..5399fb3 100644 --- a/CommandServer/CommandServer/MainWindow.xaml.cs +++ b/CommandServer/CommandServer/MainWindow.xaml.cs @@ -33,6 +33,7 @@ namespace CommandServer { private TcpListener tcpListener; private Thread listenThread; private bool serverIsRunning = false; + private CommandProfile currentlySelectedProfile = null; #endregion @@ -49,6 +50,7 @@ namespace CommandServer { lbHistory.ItemsSource = historyList; cbCommandProfiles.ItemsSource = commandProfileList; cbCommandProfiles.SelectedIndex = 0; + currentlySelectedProfile = (CommandProfile)cbCommandProfiles.SelectedItem; } #region events @@ -123,8 +125,11 @@ namespace CommandServer { //message has successfully been received ASCIIEncoding encoder = new ASCIIEncoding(); string received = encoder.GetString(message, 0, bytesRead); - Log("Client send message: " + received); - ProcessMessage(received); + + if (!String.IsNullOrEmpty(received)) { + Log("Client send message: " + received); + ProcessMessage(received); + } } tcpClient.Close(); @@ -167,27 +172,26 @@ namespace CommandServer { #region methods private void ProcessMessage(string s) { - var profile = (CommandProfile)cbCommandProfiles.SelectedItem; - if (profile == null) { + if (currentlySelectedProfile == null) { this.Log("No profile selected"); return; } switch (s) { case "ForwardGesture": Log("ForwardGesture received"); - profile.ForwardGesture(); + currentlySelectedProfile.ForwardGesture(); break; case "BackwardGesture": Log("ForwardGesture received"); - profile.BackwardGesture(); + currentlySelectedProfile.BackwardGesture(); break; case "FlipToRightGesture": Log("FlipToRightGesture received"); - profile.FlipToRightGesture(); + currentlySelectedProfile.FlipToRightGesture(); break; case "FlipToLeftGesture": Log("FlipToLeftGesture received"); - profile.FlipToLeftGesture(); + currentlySelectedProfile.FlipToLeftGesture(); break; case "GestureNotRecognized": Log("Gesture not recognized on client"); @@ -229,5 +233,9 @@ namespace CommandServer { } #endregion + + private void cbCommandProfiles_SelectionChanged(object sender, SelectionChangedEventArgs e) { + currentlySelectedProfile = (CommandProfile)cbCommandProfiles.SelectedItem; + } } } \ No newline at end of file diff --git a/GestureDetectionApp/.metadata/.mylyn/tasks.xml.zip b/GestureDetectionApp/.metadata/.mylyn/tasks.xml.zip index 73f05435b58725ae0b87567deb447bafc1f35ced..f6f2450874796eb2f53715f4cb3b1abfe3f409d1 100644 GIT binary patch delta 26 fcwYO(_=}Mzz?+#xgn-JBfcptzp-*G2<{g4WGJ?BFKX zNJwo%!7#3C<&rZ&n-@M|ND$ARTjV)yC z+Ae|ZIU+;!2^EWrv%A02W52Z$19dg^p`z6NPliUQZ}61NkgX$?At;-JBfcpt#1%{cQtyC<#~F?H8JF}Vj9Z9#JctBCK5Hf|gQ1qPXXW99q~CEHg(4`D`msQmc4vqXTcumVBk?_bv~lc$8V#l zQ-`DLi-*BW?YA8}rCel?ERC&d*>d{VvBI(WBAG;6o}Dud?l4m=&HgRd;Av-l((F%c zGl=dG!(7cab)&%r)^?*oL&CM!EDXlP!b%tjx{5H7&k&6QB*Tykxa+)I&{%NMbv|HY zLtJ9&$`A;eV?)Nva+DzuG|z^(#HuJmAZU&av0Q=;We5b#u_3laa9J4wL33+}Npzjq j$`BBmXG6-wR=-^knqxz-dS#R$%MGchzf1<`zcS< +content_assist_lru_history= org.eclipse.jdt.ui.text.code_templates_migrated=true diff --git a/GestureDetectionApp/.metadata/.plugins/org.eclipse.debug.ui/dialog_settings.xml b/GestureDetectionApp/.metadata/.plugins/org.eclipse.debug.ui/dialog_settings.xml index 344dd0c..c860375 100644 --- a/GestureDetectionApp/.metadata/.plugins/org.eclipse.debug.ui/dialog_settings.xml +++ b/GestureDetectionApp/.metadata/.plugins/org.eclipse.debug.ui/dialog_settings.xml @@ -4,10 +4,10 @@ - + - + diff --git a/GestureDetectionApp/.metadata/.plugins/org.eclipse.epp.usagedata.recording/usagedata.csv b/GestureDetectionApp/.metadata/.plugins/org.eclipse.epp.usagedata.recording/usagedata.csv dissimilarity index 71% index 9caeee9..a58aedb 100644 --- a/GestureDetectionApp/.metadata/.plugins/org.eclipse.epp.usagedata.recording/usagedata.csv +++ b/GestureDetectionApp/.metadata/.plugins/org.eclipse.epp.usagedata.recording/usagedata.csv @@ -1,51 +1,26 @@ -what,kind,bundleId,bundleVersion,description,time -deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444183633 -activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444205657 -deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444216614 -activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444248196 -deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444250011 -activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444251320 -deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444252035 -activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444298320 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.file.save",1306444311227 -executed,command,org.eclipse.jdt.ui,3.5.2.r352_v20100106-0800,"org.eclipse.jdt.ui.edit.text.java.format",1306444354385 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.file.save",1306444366286 -executed,command,org.eclipse.jdt.ui,3.5.2.r352_v20100106-0800,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1306444369143 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.text.contentAssist.proposals",1306444380435 -executed,command,org.eclipse.jdt.ui,3.5.2.r352_v20100106-0800,"org.eclipse.jdt.ui.edit.text.java.format",1306444388624 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.text.contentAssist.proposals",1306444392300 -executed,command,org.eclipse.jdt.ui,3.5.2.r352_v20100106-0800,"org.eclipse.jdt.ui.edit.text.java.format",1306444400902 -executed,command,org.eclipse.jdt.ui,3.5.2.r352_v20100106-0800,"org.eclipse.jdt.ui.edit.text.java.format",1306444405278 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.file.save",1306444406083 -deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444412095 -activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444412205 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.file.save",1306444415508 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.cut",1306444418936 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.paste",1306444419810 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.file.save",1306444420403 -executed,command,,,"AUTOGEN:::org.eclipse.jdt.internal.ui.CompilationUnitEditor.ruler.actions/org.eclipse.jdt.internal.ui.javaeditor.JavaSelectRulerAction",1306444422400 -deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444423709 -activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444423855 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.file.save",1306444426015 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.file.save",1306444437067 -deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444439788 -activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444442231 -deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444442678 -activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306444472362 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.cut",1306444477730 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.paste",1306444479379 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.undo",1306444481126 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.paste",1306444482943 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.delete",1306444485131 -executed,command,org.eclipse.ui.workbench.texteditor,3.5.1.r352_v20100105,"org.eclipse.ui.edit.text.deletePreviousWord",1306444486277 -executed,command,org.eclipse.ui.workbench.texteditor,3.5.1.r352_v20100105,"org.eclipse.ui.edit.text.deletePreviousWord",1306444487369 -executed,command,org.eclipse.ui.workbench.texteditor,3.5.1.r352_v20100105,"org.eclipse.ui.edit.text.deletePreviousWord",1306444487806 -executed,command,org.eclipse.jdt.ui,3.5.2.r352_v20100106-0800,"org.eclipse.jdt.ui.edit.text.java.format",1306444488838 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.file.save",1306444489693 -executed,command,,,"AUTOGEN:::org.eclipse.jdt.internal.ui.CompilationUnitEditor.ruler.actions/org.eclipse.jdt.internal.ui.javaeditor.JavaSelectRulerAction",1306444491386 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.cut",1306444495028 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.paste",1306444496572 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.cut",1306444498443 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.paste",1306444499874 -executed,command,org.eclipse.jdt.ui,3.5.2.r352_v20100106-0800,"org.eclipse.jdt.ui.edit.text.java.format",1306444500766 -executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.file.save",1306444502409 +what,kind,bundleId,bundleVersion,description,time +activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494500584 +deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494508714 +activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494606831 +deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494608865 +activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494610229 +deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494613022 +activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494624472 +deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494625741 +activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494630248 +executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.delete",1306494634816 +executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.delete",1306494635788 +executed,command,org.eclipse.jdt.ui,3.5.2.r352_v20100106-0800,"org.eclipse.jdt.ui.edit.text.java.format",1306494638780 +executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.file.save",1306494640466 +executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.file.save",1306494647832 +executed,command,org.eclipse.ui,3.5.2.M20100120-0800,"org.eclipse.ui.edit.copy",1306494649430 +deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494650503 +activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494674910 +deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494677762 +activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494679243 +deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494679820 +activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494776233 +deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494776808 +activated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494875975 +activated,view,org.eclipse.ui.console,3.4.0.v20090513,"org.eclipse.ui.console.ConsoleView",1306494877109 +deactivated,workbench,org.eclipse.ui.workbench,3.5.2.M20100113-0800,"",1306494878397 diff --git a/GestureDetectionApp/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml b/GestureDetectionApp/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml index 9e390f5..fb24fa9 100644 --- a/GestureDetectionApp/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml +++ b/GestureDetectionApp/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml @@ -1,2 +1,5 @@ - + + + + diff --git a/GestureDetectionApp/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml b/GestureDetectionApp/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml index 757f200..60fe6f2 100644 --- a/GestureDetectionApp/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml +++ b/GestureDetectionApp/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml @@ -10,4 +10,9 @@ +
+ + + +
diff --git a/GestureDetectionApp/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml b/GestureDetectionApp/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml index 1f3d0ea..5e19779 100644 --- a/GestureDetectionApp/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml +++ b/GestureDetectionApp/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml @@ -1,5 +1,5 @@ - + @@ -20,7 +20,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -62,8 +62,7 @@ - - + @@ -79,9 +78,11 @@ - + + + - + @@ -149,7 +150,7 @@ - + @@ -218,31 +219,22 @@ - - - - - + - - + - - - + - - - + @@ -253,8 +245,7 @@ - - + @@ -263,12 +254,9 @@ - - - + - - + @@ -341,14 +329,18 @@ - - - + + + + + + + @@ -392,21 +384,17 @@ - - - - - + + + - - + + - - - + @@ -420,6 +408,9 @@ + + + @@ -443,15 +434,113 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -459,11 +548,16 @@ - + + + + + + diff --git a/GestureDetectionApp/GestureSensitiveControl/src/at/mus/GestureSensitiveControl/GestureActivity.java b/GestureDetectionApp/GestureSensitiveControl/src/at/mus/GestureSensitiveControl/GestureActivity.java index 3df1901..6b94d0f 100644 --- a/GestureDetectionApp/GestureSensitiveControl/src/at/mus/GestureSensitiveControl/GestureActivity.java +++ b/GestureDetectionApp/GestureSensitiveControl/src/at/mus/GestureSensitiveControl/GestureActivity.java @@ -38,7 +38,7 @@ public class GestureActivity extends Activity { btnDevMessage1.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { - outToServer.writeBytes("ForwardGesture\n"); + outToServer.writeBytes("ForwardGesture"); } catch (IOException e) { e.printStackTrace(); } @@ -48,7 +48,7 @@ public class GestureActivity extends Activity { btnDevMessage2.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { - outToServer.writeBytes("BackwardGesture\n"); + outToServer.writeBytes("BackwardGesture"); } catch (IOException e) { e.printStackTrace(); } @@ -63,15 +63,13 @@ public class GestureActivity extends Activity { public void run() { try { - clientSocket = new Socket("193.170.135.96", 3000); + clientSocket = new Socket("10.29.17.109", 3000); outToServer = new DataOutputStream(clientSocket .getOutputStream()); - while (true) { - outToServer.writeBytes("Hello Server" + '\n'); - Thread.sleep(1000); + outToServer.writeBytes("Hello Server" + '\n'); + Thread.sleep(1000); - } } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { -- 2.11.4.GIT