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.