public Timer5Controller(IDeviceOutput output)
 {
     _output             = output;
     _updateFormDelegate = new UpdateFormDelegate(UpdateForm);
     _timer = new MicroTimer(1000);
     _timer.MicroTimerElapsed += new MicroTimer.MicroTimerElapsedEventHandler(OnTimerEvent);
 }
 public Keyboard1Controller(IDeviceOutput output, int baseAddress, int irq)
 {
     _output             = output;
     _updateFormDelegate = new UpdateFormDelegate(UpdateForm);
     _baseAddress        = baseAddress * 0x10;
     _irq = (byte)irq;
 }
 public Timer5Controller(IDeviceOutput output, int baseAddress, int irq)
 {
     _output             = output;
     _updateFormDelegate = new UpdateFormDelegate(UpdateForm);
     _timer = new MicroTimer(1000);
     _timer.MicroTimerElapsed += new MicroTimer.MicroTimerElapsedEventHandler(OnTimerEvent);
     _baseAddress              = baseAddress * 0x10;
     _irq = (byte)irq;
 }
Exemple #4
0
        private void UpdateForm() //TODO: in some future make it event based (not timer based)
        {
            if (label1.InvokeRequired)
            {
                // this is worker thread
                UpdateFormDelegate del = new UpdateFormDelegate(UpdateForm);
                label1.Invoke(del, new object[] {});
            }
            else
            {
                // this is UI thread
                label_DeviceManagerAction.Text = deviceManager.currentActionName;

                try
                {
                    for (int i = 0; i < deviceManager.devicesList.Count; i++)
                    {
                        if (dataGridView1.Rows.Count < i + 1)
                        {
                            dataGridView1.Rows.Add();
                        }

                        //update device name
                        if ((string)dataGridView1.Rows[i].Cells[0].Value != deviceManager.devicesList[i].ToString())
                        {
                            dataGridView1.Rows[i].Cells[0].Value = deviceManager.devicesList[i].ToString();
                        }

                        //update overall device state
                        if ((string)dataGridView1.Rows[i].Cells[1].Value != deviceManager.devicesList[i].overallState.ToString())
                        {
                            dataGridView1.Rows[i].Cells[1].Value = deviceManager.devicesList[i].overallState.ToString();
                        }

                        //update initialization device state
                        if ((string)dataGridView1.Rows[i].Cells[2].Value != deviceManager.devicesList[i].initializationState.ToString())
                        {
                            dataGridView1.Rows[i].Cells[2].Value = deviceManager.devicesList[i].initializationState.ToString();
                        }
                    }
                }
                catch (Exception ex)
                {
                    // was crashing on program exit //TODO: catch only that one exception (not important - its only window)
                }
            }
        }
 public void SetUpdateDelegate(UpdateFormDelegate Delegate)
 {
     UpdateForm = Delegate;
     UpdateActorEdit();
 }
 public OscillographController(IDeviceOutput output)
 {
     _output             = output;
     _updateFormDelegate = new UpdateFormDelegate(UpdateForm);
     ConnectedDevices.AddRange(_output.Devices.Where(x => x.GetType() == typeof(Timer5Controller)));
 }
 public void SetUpdateDelegate(UpdateFormDelegate Delegate)
 {
     UpdateForm = Delegate;
     UpdateActorEdit();
 }
Exemple #8
0
 public Form1()
 {
     InitializeComponent();
     updateFormDelegate  = new UpdateFormDelegate(UpdateForm);
     updateMixerDelegate = new UpdateMixerDelegate(UpdateMixer);
 }
Exemple #9
0
 public GraphicDisplayController(IDeviceOutput output, int baseAddress)
 {
     _output             = output;
     _updateFormDelegate = new UpdateFormDelegate(UpdateForm);
     _baseAddress        = baseAddress * 0x10;
 }
Exemple #10
0
        //TODO: in some future make it event based (not timer based)
        private void UpdateForm()
        {
            if (label1.InvokeRequired)
            {
                // this is worker thread
                UpdateFormDelegate del = new UpdateFormDelegate(UpdateForm);
                label1.Invoke(del, new object[] {});
            }
            else
            {
                // this is UI thread
                label_DeviceManagerAction.Text = deviceManager.currentActionName;

                try
                {
                    for (int i = 0; i < deviceManager.devicesList.Count; i++)
                    {
                        if (dataGridView1.Rows.Count < i + 1)
                        {
                            dataGridView1.Rows.Add();
                        }

                        //update device name
                        if ((string)dataGridView1.Rows[i].Cells[0].Value != deviceManager.devicesList[i].ToString())
                        {
                            dataGridView1.Rows[i].Cells[0].Value = deviceManager.devicesList[i].ToString();
                        }

                        //update overall device state
                        if ((string)dataGridView1.Rows[i].Cells[1].Value != deviceManager.devicesList[i].overallState.ToString())
                        {
                            dataGridView1.Rows[i].Cells[1].Value = deviceManager.devicesList[i].overallState.ToString();
                        }

                        //update initialization device state
                        if ((string)dataGridView1.Rows[i].Cells[2].Value != deviceManager.devicesList[i].initializationState.ToString())
                        {
                            dataGridView1.Rows[i].Cells[2].Value = deviceManager.devicesList[i].initializationState.ToString();
                        }
                    }
                }
                catch (Exception ex)
                {
                    // was crashing on program exit //TODO: catch only that one exception (not important - its only window)
                }
            }
        }
 public Keyboard1Controller(IDeviceOutput output)
 {
     _output             = output;
     _updateFormDelegate = new UpdateFormDelegate(UpdateForm);
 }
Exemple #12
0
 private void Form1_Load(object sender, EventArgs e)
 {
     updateFormDelegate = new UpdateFormDelegate(updateForm);
 }