//Reset the server to the new channel info if the properties are changed private void ResetServer() { if (server != null) { server.Dispose(); } if (sendTestPattern) { if (isColorPattern && isAlphaPattern) { server = new ImagerServer(serverName, vrpnConnection, width, height); server.AddChannel("red", channelDepth); server.AddChannel("green", channelDepth); server.AddChannel("blue", channelDepth); server.AddChannel("alpha", channelDepth); server.SetResolution(width, height); //server.ResendDescription(); server.Update(); vrpnConnection.Update(); } else if (isColorPattern) { server = new ImagerServer(serverName, vrpnConnection, width, height); server.AddChannel("red", channelDepth); server.AddChannel("green", channelDepth); server.AddChannel("blue", channelDepth); server.SetResolution(width, height); //server.ResendDescription(); server.Update(); vrpnConnection.Update(); } else { server = new ImagerServer(serverName, vrpnConnection, width, height); server.AddChannel("gray", channelDepth); server.SetResolution(width, height); //server.ResendDescription(); server.Update(); vrpnConnection.Update(); } } else //Sending an image file will always use 8-bit RGB (it doesn't have to, we just will for simplicity) { server = new ImagerServer(serverName, vrpnConnection, width, height); server.AddChannel("red", ImageBitDepth.unsigned8bit); server.AddChannel("green", ImageBitDepth.unsigned8bit); server.AddChannel("blue", ImageBitDepth.unsigned8bit); server.SetResolution(width, height); //server.ResendDescription(); server.Update(); vrpnConnection.Update(); } }
public MainWindow() { InitializeComponent(); vrpnConnection = Connection.CreateServerConnection(); server = new ImagerServer(serverName, vrpnConnection, width, height); server.AddChannel("gray", ImageBitDepth.unsigned8bit); //server.ResendDescription(); server.Update(); vrpnConnection.Update(); ServerNameLabel.Content = "The server name is: " + serverName; //Use a timer to update the server timer = new DispatcherTimer(); timer.Tick += timer_Tick; timer.Interval = new TimeSpan(0, 0, 0, 0, 10); timer.Start(); }