public string PerformImageAction(ImageAction action, string message) { string JsonReturn = ""; if (txtServer.InvokeRequired) { Invoke(imageFormActionDelegate, action, message); return JsonReturn; } else { if (action == ImageAction.InitialiseImages) { if (imageDisplay != null) { imageDisplay.Dispose(); imageDisplay2.Dispose(); imageDisplay = null; imageDisplay2 = null; } imageDisplay = new ImageDisplay(1, message); //expecting direction to reset to 0 if new one opened imageDisplay2 = new ImageDisplay(2, message); if (videoDisplay != null) { videoDisplay.Dispose(); videoDisplay2.Dispose(); videoDisplay = null; videoDisplay2 = null; } imageDisplay.Width = screens * resolutionWidth; imageDisplay2.Width = screens * resolutionWidth; imageDisplay.Height = resolutionHight; imageDisplay2.Height = resolutionHight; imageDisplay.StartPosition = FormStartPosition.Manual; imageDisplay.Location = new Point(0, 0); imageDisplay2.StartPosition = FormStartPosition.Manual; imageDisplay2.Location = new Point(0, 0); imageDisplay.Show(); imageDisplay2.Show(); JsonReturn = "{\"messageType\":\"ImageViewer\",\"messageBody\":\"Image Initialised\"}"; return JsonReturn; } else { JsonReturn = "image action failed"; return JsonReturn; } } }
public string PerformVideoAction(VideoAction action, string message) { string JsonReturn = "failed at PVA"; if (txtServer.InvokeRequired) { return Invoke(videoFormActionDelegate, action, message).ToString(); } else { if (action == VideoAction.InitialisePlayers) { if (videoDisplay != null) { videoDisplay.Dispose(); videoDisplay2.Dispose(); videoDisplay = null; videoDisplay2 = null; } videoDisplay = new VideoDisplay(1, message); //expecting direction to reset to 0 if new one opened videoDisplay2 = new VideoDisplay(2, message); if (imageDisplay != null) { imageDisplay.Dispose(); imageDisplay2.Dispose(); imageDisplay = null; imageDisplay2 = null; } videoDisplay.Width = screens * resolutionWidth; videoDisplay2.Width = screens * resolutionWidth; videoDisplay.Height = resolutionHight; videoDisplay2.Height = resolutionHight; videoDisplay.StartPosition = FormStartPosition.Manual; videoDisplay.Location = new Point(0, 0); videoDisplay2.StartPosition = FormStartPosition.Manual; videoDisplay2.Location = new Point(0, 0); videoDisplay2.Show(); videoDisplay.Show(); JsonReturn = videoDisplay.getVideoLength(message); return JsonReturn; } else if (action == VideoAction.VideoPlayerControls) { JsonReturn = VideoPlayerControls(message); } else { JsonReturn = "video action failed"; } return JsonReturn; } }