コード例 #1
0
        private void BuildCircuit()
        {
            string filepath = _fileSelectorFactoryAdapter.GetPathFromFile(_selectedFileName);

            _mc.BuildCircuit(filepath);

            Inputs.Clear();
            _mc.getInputs().ForEach(i => Inputs.Add(new NodeViewModel(i, this)));

            Nodes.Clear();
            _mc.getNodes().ForEach(i => Nodes.Add(new NodeViewModel(i, this)));

            Probes.Clear();
            _mc.getProbes().ForEach(i => Probes.Add(new NodeViewModel(i, this)));

            base.RaisePropertyChanged();
            _mc.Run();
        }
コード例 #2
0
        private async void OnOpened(object sender, EventArgs _)
        {
            Device = FindDevice();
            try
            {
                await MonitoringMode(true);

                Console.WriteLine($"-- Listening on {Device.Name}, hit 'Enter' to stop...");

                Task.Run(() =>
                {
                    while (true)
                    {
                        Probes.Clear();
                        foreach (var kvp in ProbeCache.Cache)
                        {
                            foreach (var ce in kvp.Value)
                            {
                                Probes.Add(ce);
                            }
                        }
                        Beacons.Clear();
                        foreach (var kvp in BeaconCache.Cache)
                        {
                            foreach (var ce in kvp.Value)
                            {
                                Beacons.Add(ce);
                            }
                        }
                        Thread.Sleep(1000);
                    }
                }).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }