public static void closePerspective(CMSControl control, perspectiveInfo2 perspective) { displayInfo3[] displays = control.getCMSDisplays(); foreach (displayInfo3 display in displays) { if (display.online) { /* kolla om perspective visas för att undvik exception? ObjectId[] getSharedPerspectives(SessionId aSessionId, ObjectId aDisplayId) ObjectIdList[] getAllDisplaysPerspectives(SessionId aSessionId, ObjectId[] aDisplayId) boolean removeWindowsFromDisplay(SessionId aSessionId, ObjectId aDisplayId, ObjectId[] aWindowIdList) ObjectId createApplication(SessionId aSessionId, ObjectId aDisplayId, ApplicationInfo anApplicationInfo) */ control.closePerspectiveOnDisplay(perspective: perspective, display: display); } } }
public static void listPerspectives(CMSControl control) { perspectiveInfo2[] perspectives = control.getCMSPerspectives(); for (int i=0; i < perspectives.Length; i++) { Console.WriteLine(perspectives[i].perspectiveId.id + ": " + perspectives[i].name); } }
public static void listApplications(CMSControl control, objectId display) { applicationInfo[] apps = control.getDisplayApplications(display); foreach(applicationInfo app in apps) { Console.WriteLine(app.applicationId + ": " + app.name); } }
public static void listDisplets(CMSControl control) { perspectiveInfo2[] pinfos = control.getCMSPerspectives(); foreach(perspectiveInfo2 pinfo in pinfos) { displetInfo2[] dinfos = control.getPerspectiveDisplets(pinfo); foreach(displetInfo2 dinfo in dinfos) { Console.WriteLine(dinfo.displetId + ": " + dinfo.name + ", " + dinfo.width + "x" + dinfo.height + ", " + "x:" + dinfo.x + " y:" + dinfo.y + ", sourceId:" + dinfo.sourceId.id + ", perspective: " + pinfo.name); } } }
public static void listDisplays(CMSControl control) { displayInfo3[] displays = control.getCMSDisplays(); foreach (displayInfo3 display in displays) { if (display.online) { Console.WriteLine(display.displayId.id + ": " + display.name + ", " + display.computerName + " - Online"); } else { Console.WriteLine(display.displayId.id + ": " + display.name + ", " + display.computerName + " - Offline"); } } }
public CMSPerspective(CMSControl cms, string name, int width=800, int height=600) { this.cms = cms; this.name = name; this.width = width; this.height = height; init(); }
public static void listWindows(CMSControl control) { Console.WriteLine("Enter display id: "); int id; windowInfo3[] windows; while(!int.TryParse(Console.ReadLine(),out id)) { } displayInfo3[] displays = control.getCMSDisplays(); foreach (displayInfo3 display in displays) { if(display.displayId.id == id) { windows = control.getDisplayWindows(display.displayId); foreach(windowInfo3 window in windows) { Console.WriteLine(window.windowId.id + ": " + window.caption + " - " + window.type); if(window.type == "PerspectiveWindow") { perspectiveWindowDetail pwindow = control.getPerspectiveWindowDetail(window.windowId); } if(window.caption == "test") { control.setWindowInfo(window, 500, 500); } } } } }
public static void listSources(CMSControl control) { sourceInfo2[] sources = control.getCMSSources(); foreach(sourceInfo2 source in sources) { Console.WriteLine(source.sourceId.id + ": " + source.name + ", " + source.width + "x" + source.height + ", " + "Online: " + source.online); } }
static void Main(string[] args) { string input = "default"; CMSControl control = new CMSControl(); while (input != "") { Console.WriteLine("Enter command: "); input = Console.ReadLine(); CMSControl.connect(); switch (input) { case "": break; case "list p": listPerspectives(control); break; case "list a": displayInfo3[] displays = control.getCMSDisplays(); foreach(displayInfo3 display in displays) { listApplications(control, display.displayId); } break; case "list w": listDisplays(control); listWindows(control); break; case "open p": Console.WriteLine("Enter name of perspective: "); string pname = Console.ReadLine(); CMSPerspective p = new CMSPerspective(control, pname); openPerspective(control, p.perspective); break; case "list s": listSources(control); break; case "list d": listDisplets(control); break; case "list displays": listDisplays(control); break; case "close p": Console.WriteLine("Enter name of perspective: "); string pname2 = Console.ReadLine(); CMSPerspective p2 = new CMSPerspective(control, pname2); closePerspective(control, p2.perspective); break; case "create p": CMSPerspective perspective = new CMSPerspective(control, "test", 1024, 768); control.removePerspective(perspective.perspective); perspective = new CMSPerspective(control, "test", 1024, 768); sourceInfo2[] sources = control.getCMSSources(); perspective.addSource(sources[0]); perspective.addSource(sources[1]); perspective.addSource(sources[5]); perspective.addSource(sources[3]); break; } } /* CMSPerspective perspective = new CMSPerspective(control, "testperspective2"); control.removePerspective(perspective.perspective); perspective = new CMSPerspective(control, "testperspective2"); sourceInfo2[] sources = control.getCMSSources(); //perspective.replaceSource(sources[0], sources[1]); perspective.addSource(sources[0]); perspective.addSource(sources[1]); perspective.addSource(sources[2]); perspective.addSource(sources[3]); displayInfo3[] displays = control.getCMSDisplays(); foreach (displayInfo3 display in displays) { if (display.online) { Console.WriteLine("opening perspective on " + display.name); control.openPerspectiveOnDisplay(perspective: perspective.perspective, display: displays[0]); System.Threading.Thread.Sleep(10000); control.closePerspectiveOnDisplay(perspective: perspective.perspective, display: displays[0]); } } */ //System.Threading.Thread.Sleep(10000); //control.removePerspective(perspective.perspective); /* perspectiveInfo[] perspectives = control.getCMSPerspectives(); foreach (perspectiveInfo p in perspectives) { Console.WriteLine(p.name); } sourceInfo[] sources = control.getCMSSources(); foreach(sourceInfo source in sources) { Console.WriteLine(source.name); } displayInfo[] displays = control.getCMSDisplays(); foreach(displayInfo display in displays) { Console.WriteLine(display.name); } perspectiveInfo perspective = control.createPerspective("tempPerspective", 1024, 768); control.openSourceOnPerspective(perspective, sources[0]); control.openPerspectiveOnDisplay(perspective: perspective, display: displays[0]); System.Threading.Thread.Sleep(10000); control.closePerspectiveOnDisplay(perspective: perspective, display: displays[0]); control.removePerspective(perspective); */ CMSControl.disconnect(); Console.WriteLine("Press enter to exit"); Console.ReadLine(); }
public static void openPerspective(CMSControl control, perspectiveInfo2 perspective) { displayInfo3[] displays = control.getCMSDisplays(); foreach (displayInfo3 display in displays) { if (display.online) { Console.WriteLine("opening perspective on " + display.name); control.openPerspectiveOnDisplay(perspective: perspective, display: display); } } }