Exemplo n.º 1
0
        public OtherTestsModel()
        {
            Messenger.Default.Register <FtdiDevice[]>(this, (o) => _devices        = o);
            Messenger.Default.Register <TK158Settings>(this, (o) => _tK158Settings = o);
            Messenger.Default.Register <DebugSettings>(this, (o) => _delay         = o.TA1004M1Delay);

            _txA   = new List <byte>();
            _txB   = new List <byte>();
            _delay = Properties.Settings.Default.TA1004M1Delay;
        }
Exemplo n.º 2
0
        public DebugViewModel()
        {
            Messenger.Default.Register <FtdiDevice[]>(this, (o) => {
                _devices = o;
                RaisePropertyChanged(nameof(DeviceList));
            });
            Messenger.Default.Register <TK158Settings>(this, (o) => _tK158Settings = o);

            _canStart    = true;
            _inputData   = string.Empty;
            _outputDataA = new StringBuilder();
            _outputDataB = new StringBuilder();

            CloseFileVisibility = Visibility.Hidden;
        }
Exemplo n.º 3
0
        private short[] _results; // Для сохранения значений из нулевого и выбранного канала.

        public TA2007Model()
        {
            Messenger.Default.Register <FtdiDevice[]>(this, (o) => _devices        = o);
            Messenger.Default.Register <TK158Settings>(this, (o) => _tK158Settings = o);
            Messenger.Default.Register <DebugSettings>(this, (o) =>
            {
                _delay      = o.TA2007Delay;
                _timerValue = o.TA2007TimerValue;
            });

            _delay      = Properties.Settings.Default.TA2007Delay;
            _timerValue = Properties.Settings.Default.TA2007TimerValue;
            _serializer = new XmlSerializer(typeof(List <TA2007ChannelContent>));
            _fileName   = @".\TA2007ChannelsParams.xml";
            _channels   = new short[32];

            ChannelContent = new List <TA2007ChannelContent>();
            if (File.Exists(_fileName))
            {
                using (Stream reader = new FileStream(_fileName, FileMode.Open))
                {
                    ChannelContent = (List <TA2007ChannelContent>)_serializer.Deserialize(reader);
                    ChannelContent.ForEach(o => o.PropertyChanged += ChannelParams_PropertyChanged);
                }
            }
            else
            {
                for (int i = 0; i < _channels.Length; i++)
                {
                    ChannelContent.Add(new TA2007ChannelContent()
                    {
                        Number = i + 1, Norm = 0, Tolerance = 0
                    });
                    ChannelContent[i].PropertyChanged += ChannelParams_PropertyChanged;
                }

                using (StreamWriter writer = new StreamWriter(_fileName))
                {
                    _serializer.Serialize(writer, ChannelContent);
                }
            }

            Messenger.Default.Send <Brush[]>(ChannelContent[0].PhasSyncColors);
        }
Exemplo n.º 4
0
        public TA2008Model()
        {
            Messenger.Default.Register <FtdiDevice[]>(this, (o) => _devices        = o);
            Messenger.Default.Register <TK158Settings>(this, (o) => _tK158Settings = o);
            Messenger.Default.Register <DebugSettings>(this, (o) => _delay         = o.TA2008Delay);

            Channels = new List <List <TA2008ChannelContent> >();
            _txA     = new List <byte>();
            _txB     = new List <byte>();

            for (byte i = 1; i <= 96; i += 8)
            {
                var channel = new List <TA2008ChannelContent>();

                for (byte j = 0; j < 8; j++)
                {
                    channel.Add(new TA2008ChannelContent((byte)(i + j)));
                }

                Channels.Add(channel);
            }
            _delay = Properties.Settings.Default.TA2008Delay;
        }
        public OutputInformationModel()
        {
            Messenger.Default.Register <FtdiDevice[]>(this, (o) => _devices        = o);
            Messenger.Default.Register <TK158Settings>(this, (o) => _tK158Settings = o);
            Messenger.Default.Register <DebugSettings>(this, (o) => _delay         = o.TA1004M1Delay);

            _txA   = new List <byte>();
            _txB   = new List <byte>();
            _rxA   = new List <byte[]>();
            _rxB   = new List <byte[]>();
            _delay = Properties.Settings.Default.TA1004M1Delay;

            OutputInformation = new List <OutputInformationContent>()
            {
                new OutputInformationContent(0, null),
                new OutputInformationContent(1, null),
                new OutputInformationContent(2, null),
                new OutputInformationContent(3, null),
                new OutputInformationContent(4, null),
                new OutputInformationContent(5, null),
                new OutputInformationContent(6, null),
                new OutputInformationContent(7, null),
            };
        }
Exemplo n.º 6
0
        public PassingInformationModel()
        {
            Messenger.Default.Register <FtdiDevice[]>(this, (o) => _devices        = o);
            Messenger.Default.Register <TK158Settings>(this, (o) => _tK158Settings = o);
            Messenger.Default.Register <DebugSettings>(this, (o) => _delay         = o.TA1004M1Delay);

            PassingInformation = new List <PassingInformationContent>()
            {
                new PassingInformationContent(0, "00000001", null),
                new PassingInformationContent(1, "00000010", null),
                new PassingInformationContent(2, "00000011", null),
                new PassingInformationContent(3, "Счетчик", null),
                new PassingInformationContent(4, "10101100", null),
                new PassingInformationContent(5, "10101100", null),
                new PassingInformationContent(6, "10101100", null),
                new PassingInformationContent(7, "10101100", null),
            };

            _txA   = new List <byte>();
            _txB   = new List <byte>();
            _rxA   = new List <byte[]>();
            _rxB   = new List <byte[]>();
            _delay = Properties.Settings.Default.TA1004M1Delay;
        }
Exemplo n.º 7
0
        public TA2006Model()
        {
            Messenger.Default.Register <FtdiDevice[]>(this, (o) => _devices        = o);
            Messenger.Default.Register <TK158Settings>(this, (o) => _tK158Settings = o);
            Messenger.Default.Register <DebugSettings>(this, (o) =>
            {
                _delay = o.TA2006Delay;
            });

            _channels           = new short[32];
            _channelsContent    = new List <TA2006ChannelContent>();
            _firstCommChannels  = new List <TA2006ChannelContent>();
            _secondCommChannels = new List <TA2006ChannelContent>();
            _thirdCommChannels  = new List <TA2006ChannelContent>();
            _allChannelsData    = new List <TA2006ChannelContent>();
            _delay      = Properties.Settings.Default.TA2006Delay;
            _serializer = new XmlSerializer(typeof(List <TA2006ChannelContent>));
            _fileName   = @".\TA2006ChannelsParams.xml";
            _txA        = new List <byte>();
            _txB        = new List <byte>();
            _rxA        = new List <byte[]>();
            _rxB        = new List <byte[]>();

            for (int i = 0; i < _channels.Length; i++)
            {
                _channels[i] = (short)(i << 4);
            }

            if (File.Exists(_fileName))
            {
                using (Stream reader = new FileStream(_fileName, FileMode.Open))
                {
                    _allChannelsData = (List <TA2006ChannelContent>)_serializer.Deserialize(reader);
                    _allChannelsData.ForEach(o => o.PropertyChanged += ChannelParams_PropertyChanged);

                    _firstCommChannels.AddRange(_allChannelsData.Where(o => o.Number <= 32));
                    _secondCommChannels.AddRange(_allChannelsData.Where(o => o.Number >= 33 && o.Number <= 64));
                    _thirdCommChannels.AddRange(_allChannelsData.Where(o => o.Number >= 65));
                }
            }
            else
            {
                for (int i = 0; i < _channels.Length; i++)
                {
                    _firstCommChannels.Add(new TA2006ChannelContent()
                    {
                        Number = i + 1, Tolerance = 1
                    });
                    _secondCommChannels.Add(new TA2006ChannelContent()
                    {
                        Number = i + 33, Tolerance = 1
                    });
                    _thirdCommChannels.Add(new TA2006ChannelContent()
                    {
                        Number = i + 65, Tolerance = 1
                    });

                    _firstCommChannels[i].PropertyChanged  += ChannelParams_PropertyChanged;
                    _secondCommChannels[i].PropertyChanged += ChannelParams_PropertyChanged;
                    _thirdCommChannels[i].PropertyChanged  += ChannelParams_PropertyChanged;
                }

                _allChannelsData.AddRange(_firstCommChannels);
                _allChannelsData.AddRange(_secondCommChannels);
                _allChannelsData.AddRange(_thirdCommChannels);

                using (StreamWriter writer = new StreamWriter(_fileName))
                {
                    _serializer.Serialize(writer, _allChannelsData);
                }
            }
        }