コード例 #1
0
 public void Start()
 {
     if (!connected)
     {
         try
         {
             TimerResolution.TimeBeginPeriod(1);
             List <string> deviceNames = CaptureDevice.GetDeviceNames();
             int           deviceIndex = deviceNames.IndexOf(deviceName);
             if (deviceIndex >= 0)
             {
                 millisecondSleepInterval = (int)Math.Round(1000 / (double)this.frameRate);
                 List <CameraResolution> cr = CaptureDevice.GetAvailableResolutions(deviceIndex);
                 captureDevice = new CaptureDevice(deviceIndex, this.frameRate, this.ImageWidth, this.ImageHeight);
                 captureDevice.Start();
                 connected = true;
                 OnCameraStarted();
                 //    OnCameraStarted();
                 //     captureDevice.SetVideoProperty(VideoProcAmpProperty.Brightness, 200);
             }
         }
         catch
         {
             connected = false;
         }
     }
     if (connected)
     {
         runThread = new Thread(new ThreadStart(RunLoop));
         runThread.Start();
     }
 }
コード例 #2
0
 private void startButton_Click(object sender, EventArgs e)
 {
     TimerResolution.TimeBeginPeriod(1);  // Sets the timer resolution to 1 ms (default in Windows 7: 15.6 ms)
     startButton.Enabled = false;
     stopButton.Enabled  = true;
     agentTabControl.SelectTab(workingMemoryTabPage);
     agent.Start();
     agent.SetWindowPositions();
     agent.ShowVisualizerOnly();
 }
コード例 #3
0
        private void startButton_Click(object sender, EventArgs e)
        {
            dialogueListCheckedListBox.Enabled = false;

            TimerResolution.TimeBeginPeriod(1);  // Sets the timer resolution to 1 ms (default in Windows 7: 15.6 ms)
            startButton.Enabled           = false;
            exitToolStripMenuItem.Enabled = false;

            // Check which processes should be enabled:
            for (int ii = 0; ii < dialogueListCheckedListBox.Items.Count; ii++)
            {
                string context       = dialogueListCheckedListBox.Items[ii].ToString();
                int    dialogueIndex = agent.DialogueList.FindIndex(d => d.Context == context);
                if (dialogueIndex > 0) // Not allowed to remove dialogue 0 (startup dialogue)
                {
                    if (dialogueListCheckedListBox.GetItemChecked(ii) == false)
                    {
                        agent.DialogueList.RemoveAt(dialogueIndex);
                    }
                }
            }

            agent.AutoArrangeWindows = autoarrangeWindowsToolStripMenuItem.Checked;
            Boolean startSuccessful = agent.StartProcesses();

            if (startSuccessful)
            {
                agent.Start(agent.DialogueList[0].Context);  // Start from the first dialogue in the list
                workingMemoryViewer.SetWorkingMemory(agent.WorkingMemory);
                workingMemoryViewer.ShowMemory();
                stopButton.Enabled = true;
            }
            else
            {
                startButton.Enabled = true;
                stopButton.Enabled  = false;
            }


            //other initializatiosn
            ItemHandler.LoadShortcuts(agent);
        }