0

I wrote a simple wpf application which handles a TCPIP and a Serial communication. At the first version of the App I used a "GUI" with a connect button and so on. This version was running on the Tablet. The Tablet is a ThinkPad with Windows 8.

The second version the app should run without any GUI, but with an taskbar icon. I was able to create the taskbar icon and so. The app perfectly works on my computer. Its possible to install the app on the tablet, but it just doesn't run.

Has anybody a clue why the app doesn't open?

Beneath you can find some source code, how I created the icon and so on. In the Visual Studio project I disabled the "Main Window" which looks like this

xml-code

Title="MainWindow" Height="350" Width="525" Visibility="Hidden">

c# - code

public MainWindow()
  {
     InitializeComponent();

     // Initailize Menu
     this.components = new System.ComponentModel.Container();
     this.contextMenu1 = new System.Windows.Forms.ContextMenu();
     this.menuItem1 = new System.Windows.Forms.MenuItem();
     this.menuItem2 = new System.Windows.Forms.MenuItem();
     this.menuItem3 = new System.Windows.Forms.MenuItem();
     this.menuItem4 = new System.Windows.Forms.MenuItem();

     // Initialize contextMenu1
     this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem1 });
     this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem2 });
     this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem3 });
     this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem4 });

     // Initialize Menu Items
     this.menuItem3.Index = 0;
     this.menuItem3.Text = "Connect";
     this.menuItem3.Click += new System.EventHandler(this.Connect);
     //
     this.menuItem2.Index = 1;
     this.menuItem2.Text = "Disconnect";
     this.menuItem2.Click += new System.EventHandler(this.Disconnect);
     //
     this.menuItem4.Index = 2;
     this.menuItem4.Text = "About";
     this.menuItem4.Click += new System.EventHandler(this.About);
     //
     this.menuItem1.Index = 3;
     this.menuItem1.Text = "Exit";
     this.menuItem1.Click += new System.EventHandler(this.Exit);

     // Create the NotifyIcon.
     this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);

     // The Icon property sets the icon that will appear
     // in the systray for this application.
     notifyIcon1.Icon = new Icon("icon.ico");

     // The ContextMenu property sets the menu that will
     // appear when the systray icon is right clicked.
     notifyIcon1.ContextMenu = this.contextMenu1;

     // The Text property sets the text that will be displayed,
     // in a tooltip, when the mouse hovers over the systray icon.
     notifyIcon1.Text = "Icon Test";
     notifyIcon1.Visible = true;

     //Handle the Click event
     notifyIcon1.MouseUp += new MouseEventHandler(ShowContextMenu);
  }

EDIT

is it possible that System.Windows.Input using directive is needed that the app starts on the tablet? I had to exclude that one because of a collision with another using directive..

There is another issue. I believe its an Windows 8 error. The app is working on my Win7 machine, but neither on a Win8 notebook nor a Win8 tablet.

gabs
  • 53
  • 1
  • 6
  • what tablet and what error do you get when you try to run it? – Jonesopolis Sep 30 '13 at 13:39
  • "it just doesn't run", what does that mean? Any error message? In case it starts and silently terminates, you may add a try block around all code in the MainWindow constructor and show a message box with the exception message. Or you search the event log for some recent .NET error message. – Clemens Sep 30 '13 at 13:41
  • 1
    What's the error you're getting? Also, everything here is winforms. What are you trying to do? – CKII Sep 30 '13 at 13:42
  • Hey hey, I dont get any error when I try to open app on the tablet. The tablet is a Lenovo Thinkpad with Windwos 8. When I click on the icon of the app, the tablet changes to the desktop and does nothing.. Clemens, how can I do that? Or you search the event log for some recent .NET error message – gabs Sep 30 '13 at 13:47
  • I don't believe the windows mobile 8 (WinRT) framework is compatible with WPF, you have to go through the WinRT Framework which is XAML Compatible but not WPF compatible, so its important to know if the tablet is running full up windows 8 or WinRT – MikeT Sep 30 '13 at 13:55
  • @gabs [See here](http://www.youtube.com/watch?v=J6vUOyxmU1o). – Clemens Sep 30 '13 at 14:02
  • @MikeT This is a WPF application running under Windows 8, not a Windows Store App. – Clemens Sep 30 '13 at 14:02
  • OMG why is all that winforms stuff there? you should really remove it. And please don't create the UI in procedural code. That's what XAML is for. – Federico Berasategui Sep 30 '13 at 14:07
  • HighCore, sorry but I thought its enough to use the right tags, so the question is placed automatically at the "right" place. MikeT, Windows 8.. Thanks Clemens for the clip, I will have a look on it and give an response. So far, thank you guys... – gabs Oct 02 '13 at 06:39
  • @Clemens, I cleared the event logs and tried to open the app again. There were no warnings and errors, but the app still does not open. when I click on the icon at the home screen, the tablet goes to the desktop and then nothing happens.. – gabs Oct 04 '13 at 08:05

0 Answers0