예제 #1
0
        public KontrolPaneliViewModel()
        {
            _cmdBaglan      = new RelayCommand(CmdBaglanExecute, CmdBaglanCanExecute);
            _cmdMotorBaslat = new RelayCommand(CmdMotorBaslatExecute, CmdMotorBaslatCanExecute);
            _cmdKaydet      = new RelayCommand(CmdKaydetExecute, CmdKaydetCanExecute);

            KontrolPaneli = new KontrolPaneliModel();
        }
        public KontrolPaneliViewModel()
        {
            _cmdBaglan      = new RelayCommand(CmdBaglanExecute, CmdBaglanCanExecute);
            _cmdMotorBaslat = new RelayCommand(CmdMotorBaslatExecute, CmdMotorBaslatCanExecute);
            _cmdKaydet      = new RelayCommand(CmdKaydetExecute, CmdKaydetCanExecute);

            KontrolPaneli = new KontrolPaneliModel();


            //var dayConfig = Mappers.Xy<DateTimePoint>()
            //    .X(dateTimePoint => (double)dateTimePoint.DateTime.Ticks / TimeSpan.FromHours(1).Ticks)
            //    .Y(dateTimePoint => dateTimePoint.Value);

            //var dayConfig = Mappers.Xy<DateTimePoint>()
            //    .X(dateTimePoint => dateTimePoint.DateTime.ToOADate())
            //    .Y(dateTimePoint => dateTimePoint.Value);



            var dayConfig = Mappers.Xy <DateTimePoint>()
                            .X(dateTimePoint => dateTimePoint.DateTime.Ticks)
                            .Y(dateTimePoint => dateTimePoint.Value);

            KontrolPaneli.RollSeriesCollection = new SeriesCollection(dayConfig)
            {
                new LineSeries
                {
                    Title = "Roll",
                    //DataLabels = true,
                    //Values = new ChartValues<DateTimePoint> { }

                    Values = new ChartValues <DateTimePoint>
                    {
                        new DateTimePoint
                        {
                            DateTime = KontrolPaneli.StartingDate,
                            Value    = 0
                        },
                        new DateTimePoint
                        {
                            DateTime = KontrolPaneli.StartingDate.AddSeconds(2),
                            Value    = 0
                        },
                    }
                },
                new LineSeries
                {
                    Title = "Roll Ref",
                    //DataLabels = true,
                    Values = new ChartValues <DateTimePoint>
                    {
                        new DateTimePoint
                        {
                            DateTime = KontrolPaneli.StartingDate,
                            Value    = 0
                        },
                        new DateTimePoint
                        {
                            DateTime = KontrolPaneli.StartingDate.AddSeconds(2),
                            Value    = 0
                        }
                    }
                }
            };
            KontrolPaneli.PitchSeriesCollection = new SeriesCollection(dayConfig)
            {
                new LineSeries
                {
                    Title = "Pitch",
                    //DataLabels = true,
                    Values = new ChartValues <DateTimePoint>
                    {
                        new DateTimePoint
                        {
                            DateTime = KontrolPaneli.StartingDate,
                            Value    = 0
                        },
                        new DateTimePoint
                        {
                            DateTime = KontrolPaneli.StartingDate.AddSeconds(2),
                            Value    = 0
                        }
                    }
                },
                new LineSeries
                {
                    Title = "Pitch Ref",
                    //DataLabels = true,
                    Values = new ChartValues <DateTimePoint>
                    {
                        new DateTimePoint
                        {
                            DateTime = KontrolPaneli.StartingDate,
                            Value    = 0
                        },
                        new DateTimePoint
                        {
                            DateTime = KontrolPaneli.StartingDate.AddSeconds(2),
                            Value    = 0
                        }
                    }
                }
            };
            Step      = TimeSpan.FromSeconds(3).Ticks;
            Labels    = new double[] { -45, -30, -15, 0, 15, 30, 45 };
            Formatter = value => new DateTime((long)value).ToString("mm:ss");
            //Formatter = value => new DateTime((long)(value * TimeSpan.FromHours(1).Ticks)).ToString("t");
        }
        // PROTOKOL DEĞİŞTİĞİ İÇİN BUNLARI KULLANMIYORUM ARTIK
        //byte[] initChars = { (byte)'"', (byte)'!', (byte)'\'', (byte)'^', (byte)'+', (byte)'%', (byte)'&', (byte)'/', (byte)'(', (byte)')' };
        //byte frameEnd = (byte)'#';

        //private double _step;
        //private double[] _labels;
        //private Func<double, string> _formatter;
        #endregion

        public KontrolPaneliViewModel()
        {
            _cmdBaglan      = new RelayCommand(CmdBaglanExecute, CmdBaglanCanExecute);
            _cmdMotorBaslat = new RelayCommand(CmdMotorBaslatExecute, CmdMotorBaslatCanExecute);
            _cmdKaydet      = new RelayCommand(CmdKaydetExecute, CmdKaydetCanExecute);
            _cmdEstop       = new RelayCommand(CmdEstopExecute, CmdEstopCanExecute);
            _cmdEnter       = new RelayCommand(CmdEnterExecute, CmdEnterCanExecute);

            KontrolPaneli = new KontrolPaneliModel();


            //var dayConfig = Mappers.Xy<DateTimePoint>()
            //    .X(dateTimePoint => (double)dateTimePoint.DateTime.Ticks / TimeSpan.FromHours(1).Ticks)
            //    .Y(dateTimePoint => dateTimePoint.Value);

            //var dayConfig = Mappers.Xy<DateTimePoint>()
            //    .X(dateTimePoint => dateTimePoint.DateTime.ToOADate())
            //    .Y(dateTimePoint => dateTimePoint.Value);



            var dayConfig = Mappers.Xy <DateTimePoint>()
                            .X(dateTimePoint => dateTimePoint.DateTime.Ticks)
                            .Y(dateTimePoint => dateTimePoint.Value);

            #region grafik gösterme kodları
            //KontrolPaneli.RollSeriesCollection = new SeriesCollection(dayConfig)
            //{
            //    new LineSeries
            //    {
            //        Title = "Roll",
            //        //DataLabels = true,
            //        //Values = new ChartValues<DateTimePoint> { }

            //        Values = new ChartValues<DateTimePoint>
            //        {
            //            new DateTimePoint
            //            {
            //                DateTime = KontrolPaneli.StartingDate,
            //                Value = 0
            //            },
            //            new DateTimePoint
            //            {
            //                DateTime = KontrolPaneli.StartingDate.AddSeconds(2),
            //                Value = 0
            //            },
            //        }
            //    },
            //    new LineSeries
            //    {
            //        Title = "Roll Ref",
            //        //DataLabels = true,
            //        Values = new ChartValues<DateTimePoint>
            //        {
            //             new DateTimePoint
            //            {
            //                DateTime = KontrolPaneli.StartingDate,
            //                Value = 0
            //            },
            //            new DateTimePoint
            //            {
            //                DateTime = KontrolPaneli.StartingDate.AddSeconds(2),
            //                Value = 0
            //            }
            //        }
            //    }
            //};
            //KontrolPaneli.PitchSeriesCollection = new SeriesCollection(dayConfig)
            //{
            //    new LineSeries
            //    {
            //        Title = "Pitch",
            //        //DataLabels = true,
            //        Values = new ChartValues<DateTimePoint>
            //        {
            //            new DateTimePoint
            //            {
            //                DateTime = KontrolPaneli.StartingDate,
            //                Value = 0
            //            },
            //            new DateTimePoint
            //            {
            //                DateTime = KontrolPaneli.StartingDate.AddSeconds(2),
            //                Value = 0
            //            }
            //        }
            //    },
            //    new LineSeries
            //    {
            //        Title = "Pitch Ref",
            //        //DataLabels = true,
            //        Values = new ChartValues<DateTimePoint>
            //        {
            //            new DateTimePoint
            //            {
            //                DateTime = KontrolPaneli.StartingDate,
            //                Value = 0
            //            },
            //            new DateTimePoint
            //            {
            //                DateTime = KontrolPaneli.StartingDate.AddSeconds(2),
            //                Value = 0
            //            }
            //        }
            //    }
            //};
            #endregion

            //Step = TimeSpan.FromSeconds(3).Ticks;
            //Labels = new double[] { -45, -30, -15, 0, 15, 30, 45 };
            //Formatter = value => new DateTime((long)value).ToString("mm:ss");
            //Formatter = value => new DateTime((long)(value * TimeSpan.FromHours(1).Ticks)).ToString("t");
        }