Example #1
0
    public override void OnInspectorGUI()
    {
        ExternalDisplay source = (ExternalDisplay)target;

        EditorUtility.SetDirty(source);

        EditorGUILayout.HelpBox("The display where the mouse pointer is located will be denoted as (Current) in the following dropdown list.", MessageType.Info, true);

        source.DisplayNum = EditorGUILayout.Popup("Available Displays:", source.DisplayNum, displays);
        GUILayout.Label("");
        if (GUILayout.Button("Show External Window"))
        {
            if (window == null)
            {
                window = (WebcamPreview)EditorWindow.GetWindow(typeof(WebcamPreview), true, "Webcam Preview");
                window.init(source.DisplayNum, true);
            }
            else
            {
                window.Show();
            }
        }
        if (GUILayout.Button("Hide External Window"))
        {
            if (window != null)
            {
                window.Close();
            }
        }
    }
Example #2
0
        public void CommandsWithFunctions()
        {
            var tv = new ExternalDisplay();
            var measurementnDevice = new LaboratoryDevice();

            var deviceOnCommand = new Action <Device>(d => d.TurnOn());

            var tvOnCommand = new Action(() => deviceOnCommand(tv));
            var mdOnCommand = new Action(() => deviceOnCommand(measurementnDevice));

            var commands = new List <Action> {
                tvOnCommand, mdOnCommand
            };

            foreach (var cmd in commands)
            {
                cmd();
            }
        }
Example #3
0
        public void Test()
        {
            var tv = new ExternalDisplay();
            var measurementnDevice = new LaboratoryDevice();

            var tvOnCommand       = new DeviceOnCommand(tv);
            var deviceOnCommand   = new DeviceOnCommand(measurementnDevice);
            var programOneCommand = new StartMesurementProgramCommand(measurementnDevice, 1);
            var programTwoCommand = new StartMesurementProgramCommand(measurementnDevice, 2);
            var deviceOffCommand  = new DeviceOffCommand(measurementnDevice);

            var commandProcessor = new CommandExecutor();

            commandProcessor.AddCommand(tvOnCommand);
            commandProcessor.AddCommand(deviceOnCommand);
            commandProcessor.AddCommand(programOneCommand);
            commandProcessor.AddCommand(programTwoCommand);
            commandProcessor.AddCommand(deviceOffCommand);

            while (commandProcessor.HasCommands)
            {
                Thread.Sleep(10);
            }
        }