internal Graphic(FormGraphic formGraphic, Param param, int num) { FormGraphic = formGraphic; Param = param; Num = num; }
internal Graphic(FormGraphic formGraphic, Param param, int num) { FormGraphic = formGraphic; Param = param; Num = num; ChangeViewValues(); }
//AxResizeBottom private void ResizeAreaButtonBottom_MouseMove(object sender, MouseEventArgs e) { if (_isMouseDown4Expand) { var holder = (PictureBox)sender; if (holder.Top + e.Y > TxtBoxMax.Bottom + 5) { if (holder.Top + e.Y <= TxtBoxMin.Top - 3) { holder.Top = holder.Top + e.Y; } else { holder.Top = TxtBoxMin.Top - 3; } } else { holder.Top = TxtBoxMax.Bottom + 5; } UpperGraphic.FormGraphic.AnalogResizeRankingY(this, 0, TxtBoxMin.Top - 3 - holder.Top); int h = GraphicAreaBottom - FormGraphic.AxSummand; int h1 = h - (TxtBoxMin.Top - 3 - holder.Top); double dh = _expandBufMax - (double)h / h1 * (_expandBufMax - _expandBufMin); //mm ViewMin = FormGraphic.GetReduceValue(dh, UpperGraphic.Param.Min, UpperGraphic.Param.Max, UpperGraphic.Param.DecPlaces); ViewMin = FormGraphic.GetReduceValue(dh, UpperGraphic.MinViewValue, UpperGraphic.MaxViewValue, UpperGraphic.Param.DecPlaces); } }
internal AnalogGraphic(FormGraphic formGraphic, Param param, int num) : base(formGraphic, param, num) { int lineWidth = FormGraphic.LineWidth; GraphicVisual = new GraphicVisual(lineWidth, num); Area.AxisY.Minimum = Param.Min; Area.AxisY.Maximum = Param.Max; //Area.AxisX.Minimum = formGraphic.TimeBegin.ToOADate(); //Area.AxisX.Maximum = formGraphic.TimeEnd.ToOADate(); GroupY = null; }
internal DiscretGraphic(FormGraphic formGraphic, Param param, int num) : base(formGraphic, param, num) { int lineWidth = FormGraphic.CbLineWidth; //Возможно не надо lineWidth GraphicVisual = new GraphicVisual(lineWidth, num, false); Area.AxisY.Minimum = 0; Area.AxisY.Maximum = 1; //Area.AxisX.Minimum = formGraphic.TimeBegin.ToOADate(); //Area.AxisX.Maximum = formGraphic.TimeEnd.ToOADate(); Init(); }
private readonly int _maxCommandCount = 0; //Максимальное количество команд в списке //Если 0, неограничено public UserCommandList(FormGraphic formGraphic, int maxCommandCount = 0) { _formGraphic = formGraphic; UserCommand.Fg = formGraphic; _maxCommandCount = maxCommandCount; }
private void butArhAnalyzerTestNew_Click(object sender, EventArgs e) { try { string dbFile = tbArhAnalyzer.Text; string archiveFile = tbArhAnalyzerArchive.Text; string projectFile = tbArhAnalyzerProject.Text; string task = cbTask.Text; byte decPlacesDefault = 4; DateTime beginTime; DateTime endTime; int projectId = -1; int intervalId = -1; string stSql = "SELECT ProjectId FROM Projects WHERE (Project='ArhAnalyzer');"; using (var reader = new ReaderAdo(archiveFile, stSql)) { projectId = reader.GetInt("ProjectId"); } stSql = "SELECT IntervalId, TimeBegin, TimeEnd FROM NamedIntervals WHERE (IntervalName='" + task + "');"; using (var reader = new ReaderAdo(archiveFile, stSql)) { intervalId = reader.GetInt("IntervalId"); beginTime = reader.GetTime("TimeBegin"); endTime = reader.GetTime("TimeEnd"); } var form = new FormGraphic(); form.Init(beginTime, endTime); form.SetDatabase("Access", dbFile); //form.SetDecPlacesDefault(1); form.Show(); if ((projectId > -1) && (intervalId > -1)) { stSql = "SELECT * FROM CalcParams WHERE (Task='" + task + "') AND (CalcOtm=True) ORDER BY Code;"; using (var readerParam = new ReaderAdo(projectFile, stSql)) { while (readerParam.Read()) { var code = readerParam.GetString("Code"); var name = readerParam.GetString("Name"); var resultType = readerParam.GetString("ResultType"); var min1 = readerParam.GetDoubleNull("Min"); double min = min1 ?? 0; var max1 = readerParam.GetDoubleNull("Max"); double max = max1 ?? 0; var units = readerParam.GetString("Units"); var decPlaces1 = readerParam.GetIntNull("DecPlaces"); int decPlaces = decPlaces1 ?? decPlacesDefault; stSql = "SELECT ParamId FROM Params WHERE (ProjectId=" + projectId + ") AND (Task='" + task + "') AND (Code='" + code + "')"; int paramId = -1; using (var reader = new ReaderAdo(archiveFile, stSql)) { paramId = reader.GetInt("ParamId"); } Graphic gr; if ((resultType.ToDataType() == DataType.Integer) || (resultType.ToDataType() == DataType.Real)) { gr = form.AddAnalogGraphic(code, paramId, name, "", resultType, min, max, units, decPlaces); } else { gr = form.AddDiscretGraphic(code, paramId, name, "", resultType); } if (gr == null) { return; } if (paramId > -1) { stSql = "SELECT '" + gr.Param.Code + "' AS Code, Null AS Id, Time, Value AS Val, Nd " + "FROM [" + archiveFile + "].NamedValues WHERE (IntervalId=" + intervalId + ") AND (ParamId=" + paramId + ") ORDER BY Time;"; string errMess = form.LoadValues(stSql, beginTime, endTime); //errMess = form.LoadValues(stSql); if (errMess != "") { //errMess = form.ErrorMessage + "\n" + form.ErrorParams; //MessageBox.Show(errMess); return; } } form.RepaintGraphic(gr); } } } } catch (Exception exception) { MessageBox.Show(exception.Message + "\n=========\n" + exception.StackTrace); } }