Exemplo n.º 1
0
        private void hsChangeDB_Click(object sender, EventArgs e)
        {
            FileInfo fi = new FileInfo(db.DatabasePath);

            ofdDB.InitialDirectory = fi.DirectoryName;
            if (ofdDB.ShowDialog() == DialogResult.OK)
            {
                nf.AddToINFO($@"Change Database from {PfadClass.Instance().DatabasePfad} to {ofdDB.FileName}");
                PfadClass.Instance().DatabasePfad = ofdDB.FileName;
                db.DatabasePath = PfadClass.Instance().DatabasePfad;
            }
        }
Exemplo n.º 2
0
        private bool doTest(int board, GT668Class.GtiSignal signal, GT900USBClass GT668, TestOptionsClass testOpt)
        {
            double posv = 0.0;
            double negv = 0.0;

            Console.WriteLine("");
            GT668.ClearError();
            nf.AddToINFO($@"", InfoLine);
            nf.AddToINFO($@"Testing board {board} for signal {signal}", InfoLine);
            GT668.Select(board);
            GT668.MeasureAmplitude(signal, ref posv, ref negv, 1000.0);
            if (posv - negv >= 0.5)
            {
                double thr_val = (posv + negv) / 2.0;

                nf.AddToINFO($@"Signal found on board {board} for signal {EnumHelper.GetDescription(signal)} setting threshold {Math.Round(thr_val,3)} V", InfoLine);
                GT668.SetReferenceClock(GT668Class.GtiRefClkSrc.GT_REF_INTERNAL, false, false);
                GT668.SetBlockArm(GT668Class.GtiBlkArmSrc.GT_BA_IMM, GT668Class.GtiPolarity.GT_POL_POS, false);
                GT668.SetArmAuxOut(GT668Class.GtiArmAuxOut.GT_AUX_OUT_OFF);
                GT668.SetMemoryWrapMode(true);
                GT668.SetT0Mode(false, true);
                GT668.SetInputImpendance(signal, GT668Class.GtiImpedance.GT_IMP_LO);
                GT668.SetInputCoupling(signal, GT668Class.GtiCoupling.GT_CPL_DC);
                if (testOpt.manualTreshold)
                {
                    GT668.SetInputThreshold(signal, GT668Class.GtiThrMode.GT_THR_VOLTS, testOpt.treshold);
                }
                else
                {
                    GT668.SetInputThreshold(signal, GT668Class.GtiThrMode.GT_THR_VOLTS, thr_val);
                }
                GT668.SetInputPrescale(signal, GT668Class.GtiPrescale.GT_DIV_16);
                GT668.SetMeasSkip(0, 624U);
                switch (signal)
                {
                case GT668Class.GtiSignal.GT_SIG_A: GT668.SetMeasInput(0, GT668Class.GtiInputSel.GT_CHA_POS); break;

                case GT668Class.GtiSignal.GT_SIG_B: GT668.SetMeasInput(0, GT668Class.GtiInputSel.GT_CHB_POS); break;
                }


                GT668.SetMeasEnable(0, true);
                GT668.SetMeasEnable(1, false);



                GT668.StartMeasurements();
                Thread.Sleep(100);

                uint       num2   = 0;
                ref uint   local2 = ref num2;
                double     num3   = 0.0;
                ref double local3 = ref num3;
Exemplo n.º 3
0
        private void PickTable(object sender)
        {
            //Move Table
            Debug.WriteLine("PickTable");
            TableNotify?.AddToINFO("", "ACT_TABLE", this);
            Point pt = GetCursorPosition();

            _action.crtl              = (Control)sender;
            _action.mainctrl          = _gbTable;
            _action.hotspot           = _pnlTableBottomRight;
            _action.parent            = PForm;
            _action.action            = eAction.OnMove;
            _action.hotspot.BackColor = Color.Red;
            _action.DrawMoveRectangleStart(pt);
        }
Exemplo n.º 4
0
        public void Stop()
        {
            nf.AddToINFO($@"Closing Measurment.");
            Application.DoEvents();
            measWorker.CancelAsync();

            while (measWorker.CancellationPending)
            {
                nf.AddToINFO($@"Cancellation pending...", InfoLine);
                Thread.Sleep(1000);
                measWorker.Dispose();
                Application.DoEvents();
            }
            nf.AddToINFO($@"Measurment is closed.", InfoLine);
            WorkerEndOutput();
            Application.DoEvents();
        }
Exemplo n.º 5
0
        public SQLCommandsReturnInfoClass ExecSql(string cmd, DBRegistrationClass DBReg, NotifiesClass localNotify)
        {
            var SQLcommand = new SQLCommandsClass(DBReg);

            SQLcommand.SetEncoding("NONE");
            var ri = SQLcommand.ExecuteCommand(cmd, true);

            if (!ri.commandDone)
            {
                string errorStr = AppStaticFunctionsClass.GetErrorCodeString(ri.lastError, DBReg);
                localNotify?.AddToERROR(AppStaticFunctionsClass.GetFormattedError($@"FieldForm->ExecuteCommand", $@"{cmd}->{errorStr}"));
            }
            else
            {
                localNotify?.AddToINFO(AppStaticFunctionsClass.GetFormattedInfo($@"Command done", cmd));
            }
            return(ri);
        }
Exemplo n.º 6
0
        public string RemoveComments(string txt)
        {
            //Remove Singleline Comments
            _parentNotifies?.AddToINFO(StaticFunctionsClass.DateTimeNowStr() + " Remove comments");
            Application.DoEvents();
            int remstart = txt.IndexOf(_drc.SingleLineComment);
            int remend   = -1;

            if (remstart >= 0)
            {
                remend = txt.Substring(remstart).IndexOf(_drc.NewLine) + remstart;

                while ((remstart >= 0) && (remend > remstart))
                {
                    txt      = txt.Remove(remstart, remend - remstart + _drc.NewLine.Length);
                    remstart = txt.IndexOf(_drc.SingleLineComment);
                    remend   = txt.IndexOf(_drc.NewLine);
                }
            }

            //Remore Comments
            remstart = txt.IndexOf(_drc.CommentStart);
            if (remstart >= 0)
            {
                remend = txt.IndexOf(_drc.CommentEnd);
                while ((remstart >= 0) && (remend > remstart))
                {
                    txt      = txt.Remove(remstart, remend - remstart + _drc.CommentEnd.Length);
                    remstart = txt.IndexOf(_drc.CommentStart);
                    remend   = txt.IndexOf(_drc.CommentEnd);
                }
            }
            return(txt);
        }
Exemplo n.º 7
0
        private FbConnection CreateConnection(string sqlCmd, FbConnection fbConn)
        {
            /*
             * CONNECT 'LOCALHOST:D:\Data\test.fdb' USER 'SYSDBA' PASSWORD 'masterkey';
             */
            string sql      = sqlCmd.ToUpper();
            string location = "D:\\Data\\test111.FDB";

            string user     = "******";
            string password = "******";

            int inx = sql.IndexOf("CONNECT ", StringComparison.Ordinal);

            if (inx >= 0)
            {
                string cmd3 = sqlCmd.Substring(inx + 8);
                int    inx2 = cmd3.IndexOf(" ", StringComparison.Ordinal);
                string arg  = cmd3.Substring(0, inx2);

                int inx3 = arg.IndexOf(":\\", StringComparison.Ordinal);
                int inx4 = arg.IndexOf(":", StringComparison.Ordinal);
                if (inx4 < inx3)
                {
                    //server

                    location = arg.Substring(inx4 + 1);
                    location = location.Replace("'", "");
                }
                else
                {
                    //nur dateipfad

                    location = arg.Replace("'", "");
                }
            }

            inx = sql.IndexOf("USER ", StringComparison.Ordinal);
            if (inx >= 0)
            {
                var cmd3 = sqlCmd.Substring(inx + 5);
                int inx2 = cmd3.IndexOf(" ", StringComparison.Ordinal);
                var arg  = cmd3.Substring(0, inx2);
                user = arg.Replace("'", "");
            }

            inx = sql.IndexOf("PASSWORD ", StringComparison.Ordinal);
            if (inx >= 0)
            {
                var cmd3 = sqlCmd.Substring(inx + 9);

                var arg = cmd3.Substring(0);
                password = arg.Replace("'", "");
            }

            var drc = new DBRegistrationClass
            {
                DatabasePath   = location,
                Dialect        = 3,
                Password       = password,
                User           = user,
                Alias          = "ConScript",
                CharSet        = "UTF8",
                ConnectionType = eConnectionType.localhost
            };


            string connstr = ConnectionStrings.Instance().MakeConnectionString(drc);

            if (fbConn?.State == System.Data.ConnectionState.Open)
            {
                fbConn.Close();
            }
            fbConn = new FbConnection(connstr);
            fbConn.Open();
            _notifies?.AddToINFO(StaticFunctionsClass.DateTimeNowStr() + " ...Opening database via script" + drc);
            _notifies?.AddToINFO(StaticFunctionsClass.DateTimeNowStr() + " ...Database state:" + fbConn.State.ToString());
            return(fbConn);
        }