示例#1
0
文件: Form1.cs 项目: slawer/skc
        /// <summary>
        /// передать данные
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void manager_OnData(object sender, GraphicEventArgs e)
        {
            try
            {
                if (_app != null)
                {
                    Slice[] slices = _app.getData(e.StartTime, e.FinishTime);
                    if (slices != null)
                    {
                        _app.Graphic_consumption.Clear();
                        _app.Graphic_volume.Clear();

                        _app.Graphic_density.Clear();
                        _app.Graphic_pressure.Clear();

                        _app.Graphic_temperature.Clear();

                        foreach (Slice slice in slices)
                        {
                            if (slice.slice != null)
                            {
                                int sliceLen = slice.slice.Length;

                                if (_app.Commutator.Technology.Consumption.IndexToSave > -1 &&
                                    _app.Commutator.Technology.Consumption.IndexToSave < sliceLen)
                                {
                                    _app.Graphic_consumption.Insert(slice._date, slice.slice[_app.Commutator.Technology.Consumption.IndexToSave]);
                                }

                                if (_app.Commutator.Technology.Volume.IndexToSave > -1 &&
                                    _app.Commutator.Technology.Volume.IndexToSave < sliceLen)
                                {
                                    _app.Graphic_volume.Insert(slice._date, slice.slice[_app.Commutator.Technology.Volume.IndexToSave]);
                                }

                                if (_app.Commutator.Technology.Density.Index > -1 &&
                                    _app.Commutator.Technology.Density.Index < _app.Commutator.Parameters.Length)
                                {
                                    int num = _app.Commutator.Parameters[_app.Commutator.Technology.Density.Index].Channel.Number;
                                    if (num > -1 && num < sliceLen)
                                    {
                                        _app.Graphic_density.Insert(slice._date, slice.slice[num]);
                                    }
                                }

                                if (_app.Commutator.Technology.Pressure.Index > -1 &&
                                    _app.Commutator.Technology.Pressure.Index < _app.Commutator.Parameters.Length)
                                {
                                    int num = _app.Commutator.Parameters[_app.Commutator.Technology.Pressure.Index].Channel.Number;
                                    if (num > -1 && num < sliceLen)
                                    {
                                        _app.Graphic_pressure.Insert(slice._date, slice.slice[num]);
                                    }
                                }

                                if (_app.Commutator.Technology.Temperature.Index > -1 &&
                                    _app.Commutator.Technology.Temperature.Index < _app.Commutator.Parameters.Length)
                                {
                                    int num = _app.Commutator.Parameters[_app.Commutator.Technology.Temperature.Index].Channel.Number;
                                    if (num > -1 && num < sliceLen)
                                    {
                                        _app.Graphic_temperature.Insert(slice._date, slice.slice[num]);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    _app = Application.CreateInstance();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#2
0
        /// <summary>
        /// передать данные
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void manager_OnData(object sender, GraphicEventArgs e)
        {
            try
            {
                if (NShow)
                {
                    if (_app != null)
                    {
                        Slice[] slices = _app.Commutator.GetDataFromBuffer(e.StartTime, e.FinishTime);
                        if (slices != null)
                        {
                            graphic_glybina.Clear();
                            graphic_mehskorost.Clear();

                            graphic_vesnakruke.Clear();
                            graphic_davlenienaman.Clear();

                            graphic_rashodnavhode.Clear();

                            foreach (Slice slice in slices)
                            {
                                if (slice.slice != null)
                                {
                                    int sliceLen = slice.slice.Length;
                                    if (_app.Technology.P0205.SNumber > -1 && _app.Technology.P0205.SNumber < sliceLen)
                                    {
                                        graphic_glybina.Insert(slice._date, slice[_app.Technology.P0205.SNumber]);
                                    }

                                    if (_app.Technology.P0208.SNumber > -1 && _app.Technology.P0208.SNumber < sliceLen)
                                    {
                                        graphic_mehskorost.Insert(slice._date, slice[_app.Technology.P0208.SNumber]);
                                    }

                                    if (_app.Technology.P0102.SNumber > -1 && _app.Technology.P0102.SNumber < sliceLen)
                                    {
                                        graphic_vesnakruke.Insert(slice._date, slice[_app.Technology.P0102.SNumber]);
                                    }

                                    if (_app.Technology.P0004.SNumber > -1 && _app.Technology.P0004.SNumber < sliceLen)
                                    {
                                        graphic_davlenienaman.Insert(slice._date, slice[_app.Technology.P0004.SNumber]);
                                    }

                                    if (_app.Technology.P0114.SNumber > -1 && _app.Technology.P0114.SNumber < sliceLen)
                                    {
                                        graphic_rashodnavhode.Insert(slice._date, slice[_app.Technology.P0114.SNumber]);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch { }
        }