Exemplo n.º 1
0
        //DispatcherTimer updateCollectionTimer;

        public MainWindow()
        {
            //var kkkj = NewDate(1536953206336);
            //var kkkj1 = NewDate(1537245622622);
            //var kkkj2 = NewDate(1537245622828);

            InitializeComponent();
            this.WindowState = System.Windows.WindowState.Maximized;
            this.DataContext = this;

            generalPointCollection = new VoltagePointCollection();
            historyPointCollection = new VoltagePointCollection();
            //updateCollectionTimer = new DispatcherTimer();
            //updateCollectionTimer.Interval = TimeSpan.FromMilliseconds(100);
            //updateCollectionTimer.Tick += new EventHandler(updateCollectionTimer_Tick);
            //updateCollectionTimer.Start();

            var ds = new EnumerableDataSource <VoltagePoint>(generalPointCollection);

            ds.SetXMapping(x => generaldateAxis.ConvertToDouble(x.Date));
            ds.SetYMapping(y => y.Voltage);
            generalplotter.AddLineGraph(ds, Colors.Green, 2, "Volts");// to use this method you need "using Microsoft.Research.DynamicDataDisplay;"

            MaxVoltage = -2;
            MinVoltage = -2;

            var ds1 = new EnumerableDataSource <VoltagePoint>(historyPointCollection);

            ds1.SetXMapping(x => historydateAxis.ConvertToDouble(x.Date));
            ds1.SetYMapping(y => y.Voltage);
            historyplotter.AddLineGraph(ds1, Colors.Green, 2, "Volts");
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = this;

            Comm_Port_Names.Items.Clear();
            string[] ports = SerialPort.GetPortNames();
            foreach (string port in ports)
            {
                Comm_Port_Names.Items.Add(port);
            }
            Connect_btn.Content = "Connect";

            updateCollectionTimer          = new DispatcherTimer();
            updateCollectionTimer.Interval = TimeSpan.FromMilliseconds(0.0001);
            updateCollectionTimer.Tick    += new EventHandler(updateCollectionTimer_Tick);

            updateCollectionTimer2          = new DispatcherTimer();
            updateCollectionTimer2.Interval = TimeSpan.FromMilliseconds(1);
            updateCollectionTimer2.Tick    += new EventHandler(updateCollectionTimer2_Tick);
            voltagePointCollection          = new VoltagePointCollection();
            var ds1 = new EnumerableDataSource <VoltagePoint>(voltagePointCollection);

            ds1.SetXMapping(x => x.time);
            ds1.SetYMapping(y => y.Voltage);

            plotter.AddLineGraph(ds1, Colors.Green, 2, "Raw  Signal");
        }
Exemplo n.º 3
0
        public MainWindow()
        {
            mesuredValue = new Dictionary <int, DateTime>();
            SerialPortService.PortsChanged += SerialPortService_PortsChanged;

            serialPort = new SerialPort();

            serialPort.Disposed     += SerialPort_Disposed;
            serialPort.PortName      = PortName_Serial;
            serialPort.BaudRate      = SerialBaudRate_Serial;
            serialPort.Handshake     = Handshake.None;
            serialPort.Parity        = Parity.None;
            serialPort.DataBits      = DataBits_Serial;
            serialPort.StopBits      = StopBits.One;
            serialPort.RtsEnable     = true;
            serialPort.DtrEnable     = true;
            serialPort.DataReceived += serial_DataReceived;

            serialPort.PortName     = "COM3";
            serialPort.ReadTimeout  = ReadTimeout_Serial;
            serialPort.WriteTimeout = WriteTimeout_Serial;

            InitializeComponent();
            this.Closed += MainWindow_Closed;

            (closePort_BTN).Background = System.Windows.Media.Brushes.Red;

            this.DataContext = this;

            voltagePointCollection = new VoltagePointCollection();

            updateCollectionTimer          = new DispatcherTimer();
            updateCollectionTimer.Interval = TimeSpan.FromMilliseconds(100);
            updateCollectionTimer.Tick    += new EventHandler(updateCollectionTimer_Tick);
            //updateCollectionTimer.Start();

            var ds = new EnumerableDataSource <VoltagePoint>(voltagePointCollection);

            ds.SetXMapping(x => dateAxis.ConvertToDouble(x.Date));
            ds.SetYMapping(y => y.Voltage);
            plotter.AddLineGraph(ds, Colors.Green, 2, "Volts"); // to use this method you need "using Microsoft.Research.DynamicDataDisplay;"
            MaxVoltage = 1;
            MinVoltage = -1;
        }
Exemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = this;

            voltagePointCollection = new VoltagePointCollection();

            updateCollectionTimer          = new DispatcherTimer();
            updateCollectionTimer.Interval = TimeSpan.FromMilliseconds(1000);
            updateCollectionTimer.Tick    += new EventHandler(updateCollectionTimer_Tick);
            updateCollectionTimer.Start();

            var ds = new EnumerableDataSource <VoltagePoint>(voltagePointCollection);

            ds.SetXMapping(x => dateAxis.ConvertToDouble(x.Date));
            ds.SetYMapping(y => y.Voltage);
            plotter.AddLineGraph(ds, Colors.Green, 2, "SPEED"); // to use this method you need "using Microsoft.Research.DynamicDataDisplay;"

            MaxVoltage = 1;
            MinVoltage = -1;
            //After Initialization subscribe to the loaded event of the form
            Loaded += MainWindow_Loaded;

            //After Initialization subscribe to the unloaded event of the form
            //We use this event to stop the sensor when the application is being closed.
            Unloaded += MainWindow_Unloaded;

            if (sensor != null)
            {
                sensor.EnableAllStreams();

                sensor.Start();
                voiceController.SpeechRecognized += VoiceController_SpeechRecognized;

                //  KinectSensor sensor = SensorExtensions.Default();
                List <string> phrases = new List <string> {
                    "Restart", "maggi"
                };

                voiceController.StartRecognition(sensor, phrases);
            }
        }
Exemplo n.º 5
0
        void x_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            voltagePointCollection.Clear();
            voltagepoint1 = new VoltagePointCollection();
            voltagepoint2 = new VoltagePointCollection();
            voltagepoint3 = new VoltagePointCollection();
            var ds1 = new EnumerableDataSource <VoltagePoint>(voltagepoint1);

            ds1.SetXMapping(x => dateAxis.ConvertToDouble(x.Date));
            ds1.SetYMapping(y => y.Voltage);
            plotter.AddLineGraph(ds1, Colors.Green, 2, "0kg"); // to use this method you need "using Microsoft.Research.DynamicDataDisplay;"
            MaxVoltage = 1;
            MinVoltage = -1;
            var ds2 = new EnumerableDataSource <VoltagePoint>(voltagepoint2);

            ds2.SetXMapping(x => dateAxis.ConvertToDouble(x.Date));
            ds2.SetYMapping(y => y.Voltage);
            plotter.AddLineGraph(ds2, Colors.Red, 2, "5kg"); // to use this method you need "using Microsoft.Research.DynamicDataDisplay;"
            MaxVoltage = 1;
            MinVoltage = -1;
            var ds3 = new EnumerableDataSource <VoltagePoint>(voltagepoint3);

            ds3.SetXMapping(x => dateAxis.ConvertToDouble(x.Date));
            ds3.SetYMapping(y => y.Voltage);
            plotter.AddLineGraph(ds3, Colors.Black, 2, "25kg"); // to use this method you need "using Microsoft.Research.DynamicDataDisplay;"
            MaxVoltage = 1;
            MinVoltage = -1;
            for (int i = 0; i < values[0].Count; i++)
            {
                if (i % 50 == 0)
                {
                    voltagepoint1.Clear(); voltagepoint2.Clear(); voltagepoint3.Clear(); screenshot();
                }

                DateTime now = DateTime.Now;
                voltagepoint1.Add(new VoltagePoint(values[0][i], now));
                voltagepoint2.Add(new VoltagePoint(values[1][i], now));
                voltagepoint3.Add(new VoltagePoint(values[2][i], now));
            }
            MessageBox.Show("Tebrikler başardınız.");
        }
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = this;

            voltagePointCollection = new VoltagePointCollection();

            updateCollectionTimer          = new DispatcherTimer();
            updateCollectionTimer.Interval = TimeSpan.FromMilliseconds(100);
            updateCollectionTimer.Tick    += new EventHandler(updateCollectionTimer_Tick);
            updateCollectionTimer.Start();

            var ds = new EnumerableDataSource <VoltagePoint>(voltagePointCollection);

            ds.SetXMapping(x => dateAxis.ConvertToDouble(x.Date));
            ds.SetYMapping(y => y.Voltage);
            plotter.AddLineGraph(ds, Colors.Green, 2, "Volts"); // to use this method you need "using Microsoft.Research.DynamicDataDisplay;"

            MaxVoltage = 1;
            MinVoltage = -1;
        }
Exemplo n.º 7
0
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = this;

            voltagePointCollection = new VoltagePointCollection();               

            updateCollectionTimer = new DispatcherTimer();
            updateCollectionTimer.Interval = TimeSpan.FromMilliseconds(40);
            updateCollectionTimer.Tick += new EventHandler(updateCollectionTimer_Tick);
            updateCollectionTimer.Start();

            var ds = new EnumerableDataSource<VoltagePoint>(voltagePointCollection);
            ds.SetXMapping(x => dateAxis.ConvertToDouble(x.Date));
            ds.SetYMapping(y => y.Voltage);
            plotter.AddLineGraph(ds, Colors.Green, 2, "SPEED"); // to use this method you need "using Microsoft.Research.DynamicDataDisplay;"

            MaxVoltage = 1;
            MinVoltage = -1;
            //After Initialization subscribe to the loaded event of the form 
            Loaded += MainWindow_Loaded;

            //After Initialization subscribe to the unloaded event of the form
            //We use this event to stop the sensor when the application is being closed.
            Unloaded += MainWindow_Unloaded;

            if (sensor != null)
            {
                sensor.EnableAllStreams();

                sensor.Start();
                voiceController.SpeechRecognized += VoiceController_SpeechRecognized;

                //  KinectSensor sensor = SensorExtensions.Default();
                List<string> phrases = new List<string> { "Open", "Close", };

                voiceController.StartRecognition(sensor, phrases);
            }
        }
        public MainWindowv2()
        {
            mesuredValue = new Dictionary <int, DateTime>();
            SerialPortService.PortsChanged += SerialPortService_PortsChanged;

            serialPort = new SerialPort();

            serialPort.Disposed     += SerialPort_Disposed;
            serialPort.PortName      = PortName_Serial;
            serialPort.BaudRate      = SerialBaudRate_Serial;
            serialPort.Handshake     = Handshake.None;
            serialPort.Parity        = Parity.None;
            serialPort.DataBits      = DataBits_Serial;
            serialPort.StopBits      = StopBits.One;
            serialPort.RtsEnable     = true;
            serialPort.DtrEnable     = true;
            serialPort.DataReceived += serial_DataReceived;

            serialPort.PortName     = "COM3";
            serialPort.ReadTimeout  = ReadTimeout_Serial;
            serialPort.WriteTimeout = WriteTimeout_Serial;

            InitializeComponent();
            this.Closed += MainWindow_Closed;

            (closePort_BTN).Background = System.Windows.Media.Brushes.Red;

            this.DataContext = this;

            voltagePointCollection = new VoltagePointCollection();

            updateCollectionTimer          = new DispatcherTimer();
            updateCollectionTimer.Interval = TimeSpan.FromMilliseconds(100);
            updateCollectionTimer.Tick    += new EventHandler(updateCollectionTimer_Tick);
            //updateCollectionTimer.Start();

            var ds = new EnumerableDataSource <VoltagePoint>(voltagePointCollection);

            ds.SetXMapping(x => dateAxis.ConvertToDouble(x.Date));
            ds.SetYMapping(y => y.Voltage);
            plotter.AddLineGraph(ds, Colors.Green, 2, "Values"); // to use this method you need "using Microsoft.Research.DynamicDataDisplay;"
            MaxVoltage = 1;
            MinVoltage = -1;
            try
            {
                string[] allPortNames = System.IO.Ports.SerialPort.GetPortNames();
                _property = allPortNames.ToList();
                comSelect_CmBx.ItemsSource = _property;
                //comSelect_CmBx.Items.Clear();
                //foreach (var portItem in allPortNames)
                //{
                //    comSelect_CmBx.Items.Add(portItem);

                //}
                //if(comSelect_CmBx.Items.Count > 0)
                //{
                //    comSelect_CmBx.SelectedIndex = 0;
                //}
            }
            catch (Exception)
            {
                MessageBox.Show("Error In COM Port", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 9
0
        public MainWindow()
        {
            InitializeComponent();
            //DataReader.ReadData(System.Environment.CurrentDirectory + "\\files\\___001.txt");
            //ReadData();
            string fp       = System.Environment.CurrentDirectory + "\\files\\___001.txt";
            string fpOnline = "D:\\___temprorary\\online.txt";

            dataReader = new DataReader(fp, fpOnline);
            xData      = new List <double>();
            yData      = new List <double>();

            this.DataContext = this;

            voltagePointCollection = new VoltagePointCollection();
            points = new VoltagePointCollection();

            updateCollectionTimer          = new DispatcherTimer();
            updateCollectionTimer.Interval = TimeSpan.FromMilliseconds(10);
            updateCollectionTimer.Tick    += new EventHandler(updateCollectionTimer_Tick);
            updateCollectionTimer.Start();
            //isOnlineLine = true;

            //var ds = new EnumerableDataSource<VoltagePoint>(voltagePointCollection);
            if (isOnlineLine)
            {
                var ds = new EnumerableDataSource <VoltagePoint>(points);
                ds.SetXMapping(x => x.XAxisValue);
                ds.SetYMapping(y => y.Voltage);
                plotter.AddLineGraph(ds, Colors.Green, 4, "Volts"); // to use this method you need "using Microsoft.Research.DynamicDataDisplay;"
            }


            //isOnlineMarkers = true;
            if (isOnlineMarkers)
            {
                EnumerableDataSource <double> gX = new EnumerableDataSource <double>(dataReader.RelativeElongation);
                EnumerableDataSource <double> gY = new EnumerableDataSource <double>(dataReader.PreassureInMPa);
                _MarkerGraph.DataSource = new CompositeDataSource(gX, gY);

                //no scaling - identity mapping
                gX.XMapping = xx => xx;
                gY.YMapping = yy => yy;
            }


            /*  EnumerableDataSource<double> gX = new EnumerableDataSource<double>(xm);
             * EnumerableDataSource<double> gY = new EnumerableDataSource<double>(ym);
             * _MarkerGraph.DataSource = new CompositeDataSource(gX, gY);
             *
             * //no scaling - identity mapping
             * gX.XMapping = xx => xx;
             * gY.YMapping = yy => yy;
             *
             * CirclePointMarker mkr = new CirclePointMarker();
             * mkr.Fill = new SolidColorBrush(Colors.Red);
             * mkr.Pen = new Pen(new SolidColorBrush(Colors.Black), 1.0);
             * _MarkerGraph.Marker = mkr;*/

            // MaxVoltage = 1;
            // MinVoltage = -1;
        }