コード例 #1
0
ファイル: Program.cs プロジェクト: Firren666/CMS
 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);
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: Firren666/CMS
        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();
        }