Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            Array.ForEach<string>(SerialPort.GetPortNames(), name => this.COM_port_comboBox.Items.Add(name));

            // Initialize PSOC sample receiving chain.
            OscopeWindowClient oscopeWindowClient
                = new OscopeWindowClientImpl(this.oscope_window_canvas, this, (int)this.oscope_window_canvas.Width);
            SampleFrameDisplayer sampleFrameDisplayer = new SampleFrameDisplayerImpl(oscopeWindowClient, this);
            SampleFrameReceiver sampleFrameReceiver = new RisingEdgeTriggeringFrameReceiver(sampleFrameDisplayer, this);
            SampleFrameAssembler sampleFrameAssembler = new SampleFrameAssemblerImpl(sampleFrameReceiver);
            SampleAssembler sampleAssembler = new HighByteFirstSampleAssemblerImpl(sampleFrameAssembler, this);
            ByteReceiverImpl byteReceiver = new ByteReceiverImpl(sampleAssembler, sampleFrameAssembler);
            serialPortClient = new SerialPortClient(byteReceiver, this);

            byteReceiver.PsocReadyEvent += PSOC_ready;

            TriggerLevelChangedEvent(this, new TriggerLevelChangedEventArgs(100));
            TriggerScanLengthChangedEvent(this, new TriggerScanLengthChangedEventArgs(300));
            TriggerScanStartChangedEvent(this, new TriggerScanStartIndexChangedEventArgs(0));
            TriggerRelativeDisplayStartChangedEvent(this, new TriggerRelativeDisplayStartChangedEventArgs(0));
            SampleSpacingChangedEvent(this, new SampleSpacingChangedEventArgs(10));
            NumSamplesToDisplayChangedEvent(this, new NumSamplesToDisplayChangedEventArgs(300));
            OscopeHeightChangedEvent(this, new OscopeHeightChangedEventArgs(
                    (int)this.oscope_window_canvas.Height));
            OscopeWidthChangedEvent(this, new OscopeWidthChangedEventArgs(
                    (int)this.oscope_window_canvas.Width));
            MaxSampleSizeChangedEvent(this, new MaxSampleSizeChangedEventArgs(
                    4095));
            SampleScalerChangedEvent(this, new SampleScalerChangedEventArgs(
                    1));
            SampleOffsetChangedEvent(this, new SampleOffsetChangedEventArgs(
                    0.0));
        }
 public void setup()
 {
     mockFrameDisplayer = new Mock<SampleFrameDisplayer>();
     frameReceiver = new RisingEdgeTriggeringFrameReceiver(mockFrameDisplayer.Object);
 }