예제 #1
0
        public GraphicsTurnerForm(GraphicComponent.GraphicManager man)
        {
            InitializeComponent();

            _app    = Application.CreateInstance();
            manager = man;
        }
예제 #2
0
파일: KRSForm.cs 프로젝트: slawer/skc
        private ParametersViewPanel panelView;              // отображаемая панель

        public KRSForm(DateTime _now)
        {
            InitializeComponent();

            _app = Application.CreateInstance();

            manager           = graphicsSheet1.InstanceManager();
            manager.StartTime = _app.Commutator.MinTimeParameter();

/*
 *          if (manager.StartTime == DateTime.MinValue)
 *          {
 *              manager.StartTime = DateTime.Now;
 *          }
 */
            manager.OnDataNeed += new EventHandler(manager_OnDataNeed);
            manager.Orientation = GraphicComponent.Orientation.Horizontal;

            graphics = new Graphic[5];
            for (int index = 0; index < graphics.Length; index++)
            {
                graphics[index] = manager.InstanceGraphic();

                graphics[index].Range.Min = 0;
                graphics[index].Range.Max = 65535;
            }

            manager.UpdatePeriod = 500;
            numericUpDown1.Value = 500;
        }
예제 #3
0
        /// <summary>
        /// пробуем отсоединиться и соединиться
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void accept_Click(object sender, EventArgs e)
        {
            Uri last = DevManClient.Uri;

            try
            {
                Application _app = Application.CreateInstance();
                if (_app != null)
                {
                    _app.AutoLocalhost = checkBox1.Checked;

                    if (textBoxTotalAddress.Text != string.Empty)
                    {
                        if (last.OriginalString != textBoxTotalAddress.Text)
                        {
                            Uri newUri = null;
                            try
                            {
                                newUri          = new Uri(textBoxTotalAddress.Text);
                                _app.DevManUri2 = newUri;
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(this, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        private Application _app = null;        // контекст приложения

        public EditTechParameterForm1()
        {
            InitializeComponent();

            _app = Application.CreateInstance();
            if (_app == null)
            {
                MessageBox.Show("Не удалось получить доступ к параметрам приложения");
            }
        }
예제 #5
0
        /// <summary>
        /// Установить значение флага автоподключения
        /// </summary>
        public void accept_AutoLocalhost()
        {
            Application _app = Application.CreateInstance();

            if (_app != null)
            {
                textBoxTotalAddress.Text = _app.DevManUri2.ToString(); // DevManClient.Uri.OriginalString;
                checkBox1.Checked        = _app.AutoLocalhost;
            }
        }
예제 #6
0
        /// <summary>
        /// Сохранить этапы
        /// </summary>
        /// <param name="doc">Докумен в который выполнять сохранение этапов</param>
        /// <returns>Узел в котором сохранены этапы работы</returns>
        public XmlNode Serialize(XmlDocument doc, XmlNode root)
        {
            try
            {
                //XmlNode root = doc.CreateElement(rootName);

                XmlNode rgrOnNode     = doc.CreateElement(rootRGROn);
                XmlNode constCoefNode = doc.CreateElement(constCoefName);

                XmlNode sNode = doc.CreateElement("shift");

                constCoefNode.InnerText = constKoef.ToString();
                if (rgrOn != DateTime.MinValue)
                {
                    rgrOnNode.InnerText = rgrOn.ToString();
                }

                sNode.InnerText = s.ToString();

                root.AppendChild(rgrOnNode);
                root.AppendChild(constCoefNode);

                root.AppendChild(sNode);

                foreach (TechStage stage in stages)
                {
                    XmlNode stageNode = stage.Serialize(doc);
                    if (stageNode != null)
                    {
                        root.AppendChild(stageNode);
                    }
                }

                Application _app = Application.CreateInstance();
                if (_app != null)
                {
                    _app.Commutator.Technology.Save(doc, root);
                }

                return(root);
            }
            catch { }
            return(null);
        }
예제 #7
0
        private ParametersViewPanel panelView;              // отображаемая панель

        /// <summary>
        /// инициализирует новый экземпляр класса
        /// </summary>
        public ParametersViewForm()
        {
            InitializeComponent();

            _app    = Application.CreateInstance();
            manager = graphicsSheet1.InstanceManager();

            manager.Mode        = GraphicComponent.DrawMode.PassivScroll;
            manager.Orientation = GraphicComponent.Orientation.Horizontal;

            manager.UpdatePeriod = 500;

            graphics = new Graphic[5];
            for (int index = 0; index < graphics.Length; index++)
            {
                graphics[index] = manager.InstanceGraphic();

                graphics[index].Range.Min = 0;
                graphics[index].Range.Max = 65535;
            }
        }
예제 #8
0
 public ResetterOfVolumeForm()
 {
     InitializeComponent();
     _app = Application.CreateInstance();
 }
예제 #9
0
        public CurrentProjectForm()
        {
            InitializeComponent();

            _app = Application.CreateInstance();
        }
예제 #10
0
파일: DBOptionsForm.cs 프로젝트: slawer/skc
 public DBOptionsForm()
 {
     InitializeComponent();
     _app = Application.CreateInstance();
 }
예제 #11
0
        private ParametersViewPanel selectedPanel = null;   // выбранная панель

        public TunerPanelsForm()
        {
            InitializeComponent();
            _app = Application.CreateInstance();
        }
예제 #12
0
        /// <summary>
        /// Загрузить данные для отображения
        /// </summary>
        private void LoadData()
        {
            try
            {
                if (_app != null)
                {
                    Slice[] slices = _app.getData(DateTime.MinValue, DateTime.MaxValue);
                    if (slices != null)
                    {
                        foreach (Graphic graphic in graphics)
                        {
                            graphic.Clear();
                        }

                        if (panelView != null)
                        {
                            DateTime _minT = _app.Commutator.MinTimeParameter();
                            foreach (Slice slice in slices)
                            {
                                if (slice.slice != null)
                                {
                                    int sliceLen = slice.slice.Length;
                                    if (panelView.Parameter1.Parameter != null)
                                    {
                                        int index = panelView.Parameter1.Parameter.Channel.Number;
                                        if (index > -1 && index < slice.slice.Length)
                                        {
                                            graphics[0].Insert(slice._date, slice.slice[index]);
                                            graphics[0].Tmin = _minT;
                                        }

                                        graphics[0].Units       = string.Format("[{0}]", panelView.Parameter1.Parameter.Units);
                                        graphics[0].Description = panelView.Parameter1.Parameter.Description;
                                    }

                                    if (panelView.Parameter2.Parameter != null)
                                    {
                                        int index = panelView.Parameter2.Parameter.Channel.Number;
                                        if (index > -1 && index < slice.slice.Length)
                                        {
                                            graphics[1].Insert(slice._date, slice.slice[index]);
                                            graphics[1].Tmin = _minT;
                                        }

                                        graphics[1].Units       = string.Format("[{0}]", panelView.Parameter2.Parameter.Units);
                                        graphics[1].Description = panelView.Parameter2.Parameter.Description;
                                    }

                                    if (panelView.Parameter3.Parameter != null)
                                    {
                                        int index = panelView.Parameter3.Parameter.Channel.Number;
                                        if (index > -1 && index < slice.slice.Length)
                                        {
                                            graphics[2].Insert(slice._date, slice.slice[index]);
                                            graphics[2].Tmin = _minT;
                                        }

                                        graphics[2].Units       = string.Format("[{0}]", panelView.Parameter3.Parameter.Units);
                                        graphics[2].Description = panelView.Parameter3.Parameter.Description;
                                    }

                                    if (panelView.Parameter4.Parameter != null)
                                    {
                                        int index = panelView.Parameter4.Parameter.Channel.Number;
                                        if (index > -1 && index < slice.slice.Length)
                                        {
                                            graphics[3].Insert(slice._date, slice.slice[index]);
                                            graphics[3].Tmin = _minT;
                                        }

                                        graphics[3].Units       = string.Format("[{0}]", panelView.Parameter4.Parameter.Units);
                                        graphics[3].Description = panelView.Parameter4.Parameter.Description;
                                    }

                                    if (panelView.Parameter5.Parameter != null)
                                    {
                                        int index = panelView.Parameter5.Parameter.Channel.Number;
                                        if (index > -1 && index < slice.slice.Length)
                                        {
                                            graphics[4].Insert(slice._date, slice.slice[index]);
                                            graphics[4].Tmin = _minT;
                                        }

                                        graphics[4].Units       = string.Format("[{0}]", panelView.Parameter5.Parameter.Units);
                                        graphics[4].Description = panelView.Parameter5.Parameter.Description;
                                    }
                                }
                            }

                            manager.StartTime = _minT;
                        }

                        graphics[0].Current = float.NaN;
                        graphics[1].Current = float.NaN;
                        graphics[2].Current = float.NaN;
                        graphics[3].Current = float.NaN;
                        graphics[4].Current = float.NaN;
                    }
                }
                else
                {
                    _app = Application.CreateInstance();
                }
            }
            catch { }
        }
예제 #13
0
        public ParameterCheckerForm()
        {
            InitializeComponent();

            _app = Application.CreateInstance();
        }
예제 #14
0
파일: KRSForm.cs 프로젝트: slawer/skc
        /// <summary>
        /// Необходимо передать данные для отрисовки графическому компоненту
        /// </summary>
        /// <param name="sender">Источник события</param>
        /// <param name="e">Параметры события</param>
        private void manager_OnDataNeed(object sender, EventArgs e)
        {
            try
            {
                if (_app != null)
                {
                    Slice[] slices = _app.getData(manager.StartTime, manager.FinishTime);
                    if (slices != null)
                    {
                        foreach (Graphic graphic in graphics)
                        {
                            graphic.Clear();
                        }

                        if (panelView != null)
                        {
                            DateTime _minT = _app.Commutator.MinTimeParameter();
                            foreach (Slice slice in slices)
                            {
                                if (slice.slice != null)
                                {
                                    int sliceLen = slice.slice.Length;
                                    if (panelView.Parameter1.Parameter != null)
                                    {
                                        int index = panelView.Parameter1.Parameter.Channel.Number;
                                        if (index > -1 && index < slice.slice.Length)
                                        {
                                            graphics[0].Insert(slice._date, slice.slice[index]);
                                            graphics[0].Tmin = _minT;
                                        }

                                        graphics[0].Units       = string.Format("[{0}]", panelView.Parameter1.Parameter.Units);
                                        graphics[0].Description = panelView.Parameter1.Parameter.Description;

                                        if (digitDisplay1.Digits.Count > 0)
                                        {
                                            digitDisplay1.Digits[0].Current = slice.slice[index];
                                        }
                                    }
                                    else
                                    {
                                        if (digitDisplay1.Digits.Count > 0)
                                        {
                                            digitDisplay1.Digits[0].Index = -1;
                                        }
                                    }

                                    if (panelView.Parameter2.Parameter != null)
                                    {
                                        int index = panelView.Parameter2.Parameter.Channel.Number;
                                        if (index > -1 && index < slice.slice.Length)
                                        {
                                            graphics[1].Insert(slice._date, slice.slice[index]);
                                            graphics[1].Tmin = _minT;
                                        }

                                        graphics[1].Units       = string.Format("[{0}]", panelView.Parameter2.Parameter.Units);
                                        graphics[1].Description = panelView.Parameter2.Parameter.Description;

                                        if (digitDisplay1.Digits.Count > 1)
                                        {
                                            digitDisplay1.Digits[1].Current = slice.slice[index];
                                        }
                                    }
                                    else
                                    {
                                        if (digitDisplay1.Digits.Count > 1)
                                        {
                                            digitDisplay1.Digits[1].Index = -1;
                                        }
                                    }

                                    if (panelView.Parameter3.Parameter != null)
                                    {
                                        int index = panelView.Parameter3.Parameter.Channel.Number;
                                        if (index > -1 && index < slice.slice.Length)
                                        {
                                            graphics[2].Insert(slice._date, slice.slice[index]);
                                            graphics[2].Tmin = _minT;
                                        }

                                        graphics[2].Units       = string.Format("[{0}]", panelView.Parameter3.Parameter.Units);
                                        graphics[2].Description = panelView.Parameter3.Parameter.Description;

                                        if (digitDisplay1.Digits.Count > 2)
                                        {
                                            digitDisplay1.Digits[2].Current = slice.slice[index];
                                        }
                                    }
                                    else
                                    {
                                        if (digitDisplay1.Digits.Count > 2)
                                        {
                                            digitDisplay1.Digits[2].Index = -1;
                                        }
                                    }

                                    if (panelView.Parameter4.Parameter != null)
                                    {
                                        int index = panelView.Parameter4.Parameter.Channel.Number;
                                        if (index > -1 && index < slice.slice.Length)
                                        {
                                            graphics[3].Insert(slice._date, slice.slice[index]);
                                            graphics[3].Tmin = _minT;
                                        }

                                        graphics[3].Units       = string.Format("[{0}]", panelView.Parameter4.Parameter.Units);
                                        graphics[3].Description = panelView.Parameter4.Parameter.Description;

                                        if (digitDisplay1.Digits.Count > 3)
                                        {
                                            digitDisplay1.Digits[3].Current = slice.slice[index];
                                        }
                                    }
                                    else
                                    {
                                        if (digitDisplay1.Digits.Count > 3)
                                        {
                                            digitDisplay1.Digits[3].Index = -1;
                                        }
                                    }


                                    if (panelView.Parameter5.Parameter != null)
                                    {
                                        int index = panelView.Parameter5.Parameter.Channel.Number;
                                        if (index > -1 && index < slice.slice.Length)
                                        {
                                            graphics[4].Insert(slice._date, slice.slice[index]);
                                            graphics[4].Tmin = _minT;
                                        }

                                        graphics[4].Units       = string.Format("[{0}]", panelView.Parameter5.Parameter.Units);
                                        graphics[4].Description = panelView.Parameter5.Parameter.Description;

                                        if (digitDisplay1.Digits.Count > 4)
                                        {
                                            digitDisplay1.Digits[4].Current = slice.slice[index];
                                        }
                                    }
                                    else
                                    {
                                        if (digitDisplay1.Digits.Count > 4)
                                        {
                                            digitDisplay1.Digits[4].Index = -1;
                                        }
                                    }
                                }
                            }
                        }

                        digitDisplay1.Render();
                    }
                }
                else
                {
                    _app = Application.CreateInstance();
                }
            }
            catch { }
        }
예제 #15
0
        //private float lastVolume = float.NaN;

        /// <summary>
        /// Выполнить копирование данных с учетом технологии этапа.
        /// Вычислить параметры этапа.
        /// </summary>
        public void Calculate(RgrList rgrs)
        {
            bool blocked = false;

            try
            {
                if (mutex.WaitOne(100))
                {
                    blocked = true;
                    switch (stateRgr)
                    {
                    case StateRGR.Pressed:

                        /*if (float.IsNaN(lastVolume) || float.IsInfinity(lastVolume) ||
                         *  float.IsPositiveInfinity(lastVolume) || float.IsNegativeInfinity(lastVolume))
                         * {
                         *  lastVolume = _tech.Volume.Value;
                         * }
                         *
                         * float currentVolume = _tech.Volume.Value;
                         * if (lastVolume > currentVolume)
                         * {
                         *  constVolume = constVolume - (lastVolume - currentVolume);
                         *  lastVolume = currentVolume;
                         *
                         *  Application app = Application.CreateInstance();
                         *  if (app != null)
                         *  {
                         *      app.SaveStages();
                         *  }
                         * }
                         *
                         * Consumption = _tech.Consumption.Value * _tech.Stages.CorrectionFactor;
                         *
                         * float deltaVolume = (currentVolume - ConstVolume);
                         * if (deltaVolume >= 0)
                         * {
                         *  Volume = deltaVolume * _tech.Stages.CorrectionFactor + _tech.Stages.s;
                         *  lastVolume = currentVolume;
                         * }*/

                        foreach (Rgr rgr in rgrs)
                        {
                            if (rgr.Calculate(StateRGR))
                            {
                                Application app = Application.CreateInstance();
                                if (app != null)
                                {
                                    app.SaveStages();
                                }
                            }

                            if (rgr.IsMain)
                            {
                                Volume      = rgr.CurrentVolume;
                                Consumption = rgr.CurrentConsumption;
                            }
                        }

                        break;

                    case StateRGR.Unpressed:

                        foreach (Rgr rgr in rgrs)
                        {
                            rgr.Calculate(StateRGR);
                        }

                        Consumption = 0.0f;
                        Volume      = 0.0f;

                        break;

                    default:
                        break;
                    }

                    Density          = _tech.Density.Value;
                    FormattedDensity = _tech.Density.FormattedValue;

                    Pressure          = _tech.Pressure.Value;
                    FormattedPressure = _tech.Pressure.FormattedValue;

                    Temperature          = _tech.Temperature.Value;
                    FormattedTemperature = _tech.Temperature.FormattedValue;

                    _tech.Stages.ProccessVolume = _tech.Stages.TotalVolume + Volume;
                }
            }
            catch { }
            finally
            {
                if (blocked)
                {
                    mutex.ReleaseMutex();
                }
            }
        }
예제 #16
0
        public StageViewForm(int s_index)
        {
            stage_index = s_index;
            InitializeComponent();

            _app = Application.CreateInstance();
            if (_app != null)
            {
                Project prj = _app.CurrentProject;
                if (prj != null)
                {
                    if (stage_index > -1 && stage_index < prj.Stages.Count)
                    {
                        sel_stage = prj.Stages[stage_index];
                        if (sel_stage != null)
                        {
                            manager      = graphicsSheet1.InstanceManager();
                            manager.Mode = GraphicComponent.DrawMode.PassivScroll;

                            manager.HardTime      = true;
                            manager.HardStartTime = sel_stage.StartTime;

                            manager.StartTime   = sel_stage.StartTime;
                            manager.Orientation = GraphicComponent.Orientation.Horizontal;

                            graphics = new Graphic[5];
                            for (int index = 0; index < 5; index++)
                            {
                                graphics[index] = manager.InstanceGraphic();
                                switch (index)
                                {
                                case 0:

                                    graphics[index].Color       = _app.Graphic_consumption.Color;
                                    graphics[index].Description = _app.Graphic_consumption.Description;

                                    graphics[index].Range.Min = _app.Graphic_consumption.Range.Min;
                                    graphics[index].Range.Max = _app.Graphic_consumption.Range.Max;

                                    graphics[index].Units = _app.Graphic_consumption.Units;
                                    break;

                                case 1:

                                    graphics[index].Color       = _app.Graphic_volume.Color;
                                    graphics[index].Description = _app.Graphic_volume.Description;

                                    graphics[index].Range.Min = _app.Graphic_volume.Range.Min;
                                    graphics[index].Range.Max = _app.Graphic_volume.Range.Max;

                                    graphics[index].Units = _app.Graphic_volume.Units;
                                    break;

                                case 2:

                                    graphics[index].Color       = _app.Graphic_density.Color;
                                    graphics[index].Description = _app.Graphic_density.Description;

                                    graphics[index].Range.Min = _app.Graphic_density.Range.Min;
                                    graphics[index].Range.Max = _app.Graphic_density.Range.Max;

                                    graphics[index].Units = _app.Graphic_density.Units;
                                    break;

                                case 3:

                                    graphics[index].Color       = _app.Graphic_pressure.Color;
                                    graphics[index].Description = _app.Graphic_pressure.Description;

                                    graphics[index].Range.Min = _app.Graphic_pressure.Range.Min;
                                    graphics[index].Range.Max = _app.Graphic_pressure.Range.Max;

                                    graphics[index].Units = _app.Graphic_pressure.Units;
                                    break;

                                case 4:

                                    graphics[index].Color       = _app.Graphic_temperature.Color;
                                    graphics[index].Description = _app.Graphic_temperature.Description;

                                    graphics[index].Range.Min = _app.Graphic_temperature.Range.Min;
                                    graphics[index].Range.Max = _app.Graphic_temperature.Range.Max;

                                    graphics[index].Units = _app.Graphic_temperature.Units;
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show(this, "", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Close();
            }
        }