示例#1
0
        public static int g_batch_id = 0;     //实验批次号
        protected override void OnViewLoaded()
        {
            foreach (var sample in Samples)
            {
                sample.TestItem1 = false;
                sample.TestItem2 = false;
                sample.TestItem3 = false;
                sample.TestItem4 = false;
                sample.TestItem5 = false;
                sample.TestItem6 = false;
                sample.TestItem7 = false;
                sample.TestItem8 = false;
                sample.TestItem9 = false;
            }
            op.CanComm.SetListenFun(op.OP.SampleRackCoils[0].Addr, CanFunCodeEnum.UPLOAD_REGISTER, RackChange);
            var scaner_info = ResManager.getInstance().GetScaner("0");

            if (scaner_info == null)
            {
                ErrorSystem.WriteActError("扫码器无法识别!", false);
            }
            if (scaner_info != null)
            {
                scaner      = IoC.Get <AbstractScaner>(scaner_info.ScanerType);
                scaner_port = scaner_info.Port;
            }
            visible = true;
            for (int i = 0; i < 24; i++)
            {
                template_code_list.Add(new ScanSampleIndexData(i, string.Format("{0:D2}", i + 1), "*", string.Format("{0:D2}", i + 2)));
            }
            if (Samples.Count == 0)
            {
                for (int i = 0; i < 24; i++)
                {
                    for (int j = 0; j < 6; j++)
                    {
                        var sample_code = "";
                        var resinfo     = ResManager.getInstance().SearchGelCard("T_BJ_SampleRack", "", "", i, j);
                        resinfo.SetCode(sample_code);
                        resinfo.Values[resinfo.CountX, resinfo.CountY] = resinfo;
                        resinfo.sampleinfo = new SampleInfo(sample_code, (byte)i, (byte)j);
                        Samples.Add(resinfo.sampleinfo);
                    }
                }
            }
            var samples_sort = Samples.ToList();

            samples_sort.Sort((a, b) =>
            {
                return((a.RackIndex * 100 + a.Index) - (b.RackIndex * 100 + b.Index));
            });
            Samples.Clear();
            foreach (var item in samples_sort)
            {
                Samples.Add(item);
            }

            base.OnViewLoaded();
        }
        public static void Dispose()
        {
            if (mp3Channel != null)
            {
                mp3Channel.Dispose();
            }
            DisposeVST();

            if (UsedLibrary == AudioLibrary.NAudio)
            {
                Samples.Clear();
                if (playbackDevice != null)
                {
                    playbackDevice.Stop();
                    playbackDevice.Dispose();
                    playbackDevice = null;
                }

                if (Mixer32 != null)
                {
                    Mixer32.Dispose(); Mixer32 = null;
                }
            }
            UsedLibrary = AudioLibrary.Null;
        }
        public void Reset()
        {
            Samples.Clear();
            LastSample = null;

            RaiseSamplesCleared();
        }
示例#4
0
 public void Clear()
 {
     _lastSampleCount = 0;
     Samples.Clear();
     _max = float.MinValue;
     _min = float.MaxValue;
 }
示例#5
0
 private void SetupCurrentSampleJobs()
 {
     Samples.Clear();
     foreach (var item in _currentGroup.Children)
     {
         Samples.Add((ClientSample)item.Job);
     }
 }
示例#6
0
        public void Reset()
        {
            _watch = null;

            AverageTime = null;
            Samples.Clear();
            _lastEvaluated = null;
        }
示例#7
0
        private void AddDataFromFile(object s, WaveInEventArgs a)
        {
            Samples.Clear();
            int index = (int)((reader.CurrentTime.TotalMilliseconds - output.DesiredLatency / 2) / reader.TotalTime.TotalMilliseconds * reader.SampleCount);

            for (int i = Math.Max(index - Settings.SampleCount / 2, 0); i < Math.Min(reader.SampleCount, index + Settings.SampleCount / 2); i++)
            {
                Samples.Add(songInfo.Samples[i]);
            }

            UpdateGraphics?.Invoke(this, EventArgs.Empty);
        }
示例#8
0
        public void AddGroup()
        {
            string      name     = "Group" + UiProcessBatch.Count + 1;
            ProcessItem newGroup = new ProcessItem()
            {
                Name = name
            };

            UiProcessBatch.Add(newGroup);
            CurrentGroup = newGroup;
            Samples.Clear();
        }
示例#9
0
        public void ReadXml(XmlReader reader)
        {
            Name         = reader.GetAttribute(nameof(Name), Name);
            DisplayColor = reader.GetTypedAttribute(nameof(DisplayColor), DisplayColor);
            DisplayIndex = reader.GetTypedAttribute(nameof(DisplayIndex), DisplayIndex);

            Samples.Clear();
            var rawSamples = reader.GetTypedAttribute(nameof(Samples), string.Empty);

            foreach (var sample in ColorSampleCollection.Parse(rawSamples))
            {
                Samples.Add(sample);
            }
        }
        /// <summary>
        ///     Loads the library from the cache.
        /// </summary>
        public void LoadFromCache()
        {
            if (!File.Exists(SampleLibraryFilename))
            {
                return;
            }

            var samples = SerializationHelper <List <Sample> > .FromXmlFile(SampleLibraryFilename);

            lock (Samples)
            {
                Samples.Clear();
                Samples.AddRange(samples.ToArray());
            }
        }
示例#11
0
        private void Scaner_DataReceived(AbstractScaner scaner, T_BJ_SampleRack sampleRack)
        {
            byte?curIndex = null;

            for (byte i = 0; i < 3; i++)
            {
                if (scanerVals[i] == null)
                {
                    scanerVals[i] = scaner.Read();
                    curIndex      = i;
                    break;
                }
            }
            if (curIndex == 2)
            {
                byte i1, i2;
                if (scanerVals[1].Length > 2 && scanerVals[0].Length <= 2 && scanerVals[2].Length <= 2 && byte.TryParse(scanerVals[0], out i1) && byte.TryParse(scanerVals[2], out i2))
                {
                    if (Math.Abs(i1 - i2) == 1)
                    {
                        var w      = (byte)(Math.Min(i1, i2) - 1);
                        var sample = Samples.Where(sam => sam.RackIndex == sampleRack.Index && sam.Index == w).FirstOrDefault();
                        if (sample == null)
                        {
                            sample = new SampleInfo()
                            {
                                RackIndex = sampleRack.Index, Index = w
                            };
                            Samples.Add(sample);
                        }
                        sample.Barcode = scanerVals[1];
                        var list = Samples.OrderBy(item => item.RackIndex.ToString() + item.Index.ToString("00")).ToArray();
                        Samples.Clear();
                        Samples.AddRange(list);
                    }
                    scanerVals[0] = scanerVals[2];
                    scanerVals[1] = null;
                    scanerVals[2] = null;
                }
                else
                {
                    scanerVals[0] = scanerVals[1];
                    scanerVals[1] = scanerVals[2];
                    scanerVals[2] = null;
                }
            }
        }
示例#12
0
        public void LoadSamples(int samplesToGenerate)
        {
            //TODO: can we load samples faster?

            Samples.Clear();

            DateTime date = _sampleStartDate;

            for (int i = 0; i < samplesToGenerate; i++)
            {
                Sample s = new Sample(i == 0);
                s.LoadSampleAtTime(date);

                //_sampleList.Insert(0, s);
                //sudhir: Used Add instead of Insert in the list. The complexity for insert is O(n) snice it needs to move all elements and for add it is O(1)
                Samples.Add(s);
                date += _sampleIncrement;
            }
        }
        public async Task <List <Sample> > LoadSamplesAsync(string sampleOwnerId, string sampleRepositoryId, CancellationToken cancellationToken)
        {
            Samples.Clear();

            if (string.IsNullOrEmpty(_sampleImporterService.Token))
            {
                throw new Exception("It is necessary to add a GitHub Personal Access Token in the Preferences of Visual Studio.");
            }

            if (!_networkStatusService.IsConnectedToInternet())
            {
                throw new Exception("There is no Internet conection.");
            }

            var samples = await _sampleImporterService.GetSamplesAsync(sampleOwnerId, sampleRepositoryId, cancellationToken);

            Samples = samples;

            return(samples);
        }
示例#14
0
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus)
        {
            var rpfman = gameFileCache.RpfMan;

            string filename = "common.rpf\\data\\levels\\gta5\\time.xml";

            XmlDocument timexml = rpfman.GetFileXml(filename);

            XmlElement  time     = timexml.DocumentElement;
            XmlNode     suninfo  = time.SelectSingleNode("suninfo");
            XmlNode     mooninfo = time.SelectSingleNode("mooninfo");
            XmlNodeList samples  = time.SelectNodes("sample");
            XmlNodeList regions  = time.SelectNodes("region");

            sun_roll           = Xml.GetFloatAttribute(suninfo, "sun_roll");
            sun_yaw            = Xml.GetFloatAttribute(suninfo, "sun_yaw");
            moon_roll          = Xml.GetFloatAttribute(mooninfo, "moon_roll");
            moon_wobble_freq   = Xml.GetFloatAttribute(mooninfo, "moon_wobble_freq");
            moon_wobble_amp    = Xml.GetFloatAttribute(mooninfo, "moon_wobble_amp");
            moon_wobble_offset = Xml.GetFloatAttribute(mooninfo, "moon_wobble_offset");

            Samples.Clear();
            for (int i = 0; i < samples.Count; i++)
            {
                TimecycleSample tcs = new TimecycleSample();
                tcs.Init(samples[i]);
                Samples.Add(tcs);
            }

            Regions.Clear();
            for (int i = 0; i < regions.Count; i++)
            {
                Regions.Add(Xml.GetStringAttribute(regions[i], "name"));
            }

            Inited = true;
        }
示例#15
0
        /// <summary>
        /// Загрузка данных из файла в списки Samples и Features.
        /// </summary>
        /// <param name="filePath">Абсолютный путь к файлу.</param>
        public void LoadDataFromFile(string filePath)
        {
            Features.Clear();
            Samples.Clear();

            using (var streamReader = new StreamReader(filePath))
            {
                var line = streamReader.ReadLine();
                foreach (var featureName in line.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    Features.Add(featureName);
                }

                while ((line = streamReader.ReadLine()) != null)
                {
                    var sample = new List <double>();

                    foreach (var feature in line.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        sample.Add(double.Parse(feature));
                    }

                    Samples.Add(sample);
                }

                if (Features.Count != Samples.First().Count)
                {
                    Features.Clear();

                    for (var i = 1; i <= Samples.First().Count; i++)
                    {
                        Features.Add(i.ToString());
                    }
                }
            }
        }
示例#16
0
文件: Profile.cs 项目: hww/VARP2
 public static void Init( )
 {
     pofilePool.StopAllProfiles( );
     Samples.Clear( );
 }
示例#17
0
 public void ClearSamples()
 {
     Samples.Clear();
 }
示例#18
0
 public void ClearData()
 {
     Samples.Clear();
     TimeStamps.Clear();
 }
示例#19
0
 public void Clear()
 {
     Samples.Clear();
     LastIndex  = -1;
     MaxHistory = MAX_HISTORY;
 }
示例#20
0
文件: Profile.cs 项目: hww/VARP2
 private static void DisposeAll()
 {
     pofilePool.Dispose( );
     Samples.Clear( );
 }
示例#21
0
 private void ComputeAverageTime()
 {
     AverageTime = Samples.Average();
     Samples.Clear();
     _lastEvaluated = DateTime.Now;
 }
示例#22
0
 /// <summary>
 /// Resets the sampler. This is useful when the existing data is found to be biased.
 /// </summary>
 public void Reset()
 {
     Samples.Clear();
 }
示例#23
0
 /// <summary>
 /// Clears sample list and sets integral value to zero.
 /// </summary>
 public void Reset()
 {
     Samples.Clear();
     Value = 0;
 }
示例#24
0
 public void Clear()
 {
     Samples.Clear();
     LastIndex = -1;
 }