currentMeasuring() public method

Gibt die verstrichende Zeit in ms zurück und lässt die Messung weiterlaufen
public currentMeasuring ( ) : System.Int64
return System.Int64
コード例 #1
0
ファイル: DBProcess.cs プロジェクト: mlof/ED-IBE
        /// <summary>
        /// starts the database process if it's not running
        /// </summary>
        /// <param name="Parameter"></param>
        public DBProcess(DBProcessParams Parameter)
        {
            m_Params = Parameter;

            m_wasRunning = IsListenerOnPort(m_Params.Port);

            if (!m_wasRunning)
            {
                ProcessStartInfo psi;

                // start the DB server process
                if (Debugger.IsAttached)
                {
                    psi = new ProcessStartInfo(m_Params.Commandline, m_Params.Commandargs);
                    psi.WorkingDirectory       = m_Params.Workingdirectory;
                    psi.WindowStyle            = ProcessWindowStyle.Normal;
                    psi.CreateNoWindow         = false;
                    psi.RedirectStandardOutput = false;
                    psi.UseShellExecute        = true;
                }
                else
                {
                    psi = new ProcessStartInfo(m_Params.Commandline, m_Params.Commandargs);
                    psi.WorkingDirectory       = m_Params.Workingdirectory;
                    psi.WindowStyle            = ProcessWindowStyle.Hidden;
                    psi.CreateNoWindow         = true;
                    psi.RedirectStandardOutput = false;
                    psi.UseShellExecute        = true;
                }

                m_Process = System.Diagnostics.Process.Start(psi);

                // wait for db ready state
                Boolean          isRunning = false;
                PerformanceTimer pc        = new PerformanceTimer();

                pc.startMeasuring();
                System.Threading.Thread.Sleep(1000);

                if (!m_Process.HasExited)
                {
                    do
                    {
                        isRunning = IsListenerOnPort(m_Params.Port);

                        if (!isRunning)
                        {
                            System.Threading.Thread.Sleep(1000);
                        }

                        Debug.Print("Waiting " + pc.currentMeasuring().ToString());
                    } while ((!isRunning) && ((pc.currentMeasuring() / 1000) < m_Params.DBStartTimeout));
                }
                else
                {
                    throw new Exception("can't start sql server !");
                }
            }
        }
コード例 #2
0
        // <summary>
        // set the progress to a new value
        // </summary>
        // <param name="Value">progress current value</param>
        // <param name="Total">total value</param>
        // <remarks></remarks>
        public void progressUpdate(Int32 Value, Int32 Total)
        {
            Int32 ProzValue;

            try {
                if ((Total > 0))
                {
                    ProzValue = (int)Math.Round((double)(Value) / (double)(Total) * 100.0, 0);

                    if ((ProzValue < 0))
                    {
                        ProzValue = 0;
                    }
                    else if ((ProzValue > 100))
                    {
                        ProzValue = 100;
                    }
                }
                else
                {
                    ProzValue = 0;
                }
                if (m_PTimer.currentMeasuring() >= 50)
                {
                    m_PTimer.startMeasuring();
                    progressUpdate(ProzValue);
                }
            }
            catch (Exception ex) {
                throw new Exception("error while setting a new value", ex);
            }
        }
コード例 #3
0
ファイル: DataRetriever.cs プロジェクト: mlof/ED-IBE
        public int RowCount(Boolean refresh = false)
        {
            Object result = -1;

            if ((m_Pt.currentMeasuring() >= 60000) || (!m_Pt.isStarted) || refresh)
            {
                // Retrieve the row count from the database.

                m_Command.CommandText = "select count(*) " + m_BaseStatement + GetWhereStatement();

                try
                {
                    result = m_Command.ExecuteScalar();

                    if (result != null)
                    {
                        m_rowCountCache = Convert.ToInt32(result);
                        m_BindingNavigator.CountItem.Text = String.Format(m_BindingNavigator.CountItemFormat, m_rowCountCache);
                        m_Pt.startMeasuring();
                    }
                }
                catch (Exception ex)
                {
                    // ignore this, sometimes this happens
                    Debug.Print("doh");
                }
            }

            return(m_rowCountCache);
        }
コード例 #4
0
        /// <summary>
        /// minimizes the form at latest n seconds after first shown
        /// </summary>
        /// <param name="minimizeTime"></param>
        public async void AutoMinimizeAsync(Int32 minimizeTime = 2000)
        {
            Int32 restTime = (Int32)(minimizeTime - m_StartTimer.currentMeasuring());

            if (restTime < 1)
            {
                restTime = 1;
            }

            await Task.Delay(restTime);

            Minimize();
        }
コード例 #5
0
        /// <summary>
        /// adds a new visit with the current time
        /// </summary>
        /// <param name="newStation">Station ID (with Stationname and Systemname)</param>
        internal void addVisit(string newStation)
        {
            StationVisit Visit;

            try
            {
                if (((RetryTimer.currentMeasuring() > 1000) || !m_lastInserted.Equals(newStation)) && !String.IsNullOrEmpty(newStation))
                {
                    int currentIndex = History.FindIndex(x => x.Station.Equals(newStation, StringComparison.InvariantCultureIgnoreCase));

                    if (currentIndex >= 0)
                    {
                        if (currentIndex == 0)
                        {
                            // refresh time only
                            History[0].Visited = DateTime.Now;
                        }
                        else
                        {
                            // pull the existing item up and set current time
                            Visit = History[currentIndex];
                            History.Remove(Visit);
                            Visit.Visited = DateTime.Now;
                            History.Insert(0, Visit);
                        }
                    }
                    else
                    {
                        History.Insert(0, new StationVisit(newStation, DateTime.Now));
                    }

                    // cut to max. length
                    if (History.Count > _maxLength)
                    {
                        History.RemoveRange(_maxLength - 1, History.Count - _maxLength);
                    }

                    if (AutoSave && !String.IsNullOrEmpty(_FileName))
                    {
                        saveHistory(_FileName, true);
                    }

                    m_lastInserted = newStation;
                    RetryTimer.startMeasuring();
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
コード例 #6
0
ファイル: DBProcess.cs プロジェクト: carriercomm/ED-IBE
        /// <summary>
        /// starts the database process if it's not running
        /// </summary>
        /// <param name="Parameter"></param>
        public DBProcess(DBProcessParams Parameter)
        {
            IPGlobalProperties      ipGlobalProperties;
            IPEndPoint[]            tcpConnInfoArray;

            m_Params = Parameter;

            ipGlobalProperties      = IPGlobalProperties.GetIPGlobalProperties();
            tcpConnInfoArray        = ipGlobalProperties.GetActiveTcpListeners();

            // check if the port is open - if open we assume the db is running
            foreach (IPEndPoint tcpi in tcpConnInfoArray)
                if (tcpi.Port == m_Params.Port)
                {
                    m_wasRunning = true;
                    break;
                }

            if(!m_wasRunning)
            {
                ProcessStartInfo psi;

                // start the DB server process
                if(Debugger.IsAttached)
                {
                    psi                         = new ProcessStartInfo(m_Params.Commandline,m_Params.Commandargs);
                    psi.WorkingDirectory        = m_Params.Workingdirectory;
                    psi.WindowStyle             = ProcessWindowStyle.Normal;
                    psi.CreateNoWindow          = false;
                    psi.RedirectStandardOutput  = false;
                    psi.UseShellExecute         = true;
                }
                else
                {
                    psi                         = new ProcessStartInfo(m_Params.Commandline,m_Params.Commandargs);
                    psi.WorkingDirectory        = m_Params.Workingdirectory;
                    psi.WindowStyle             = ProcessWindowStyle.Hidden;
                    psi.CreateNoWindow          = true;
                    psi.RedirectStandardOutput  = false;
                    psi.UseShellExecute         = true;

                }

                m_Process = System.Diagnostics.Process.Start(psi);

                // wait for db ready state
                Boolean isRunning = false;
                PerformanceTimer pc = new PerformanceTimer();

                pc.startMeasuring();
                System.Threading.Thread.Sleep(1000);

                if (!m_Process.HasExited)
                {
                    do
                    {
                        ipGlobalProperties      = IPGlobalProperties.GetIPGlobalProperties();
                        tcpConnInfoArray        = ipGlobalProperties.GetActiveTcpListeners();

                        foreach (IPEndPoint tcpi in tcpConnInfoArray)
                            if (tcpi.Port == m_Params.Port)
                            {
                                isRunning = true;
                                break;
                            }

                        if(!isRunning)
                            System.Threading.Thread.Sleep(1000);

                        Debug.Print("Waiting " + pc.currentMeasuring().ToString());

                    } while ((!isRunning) && ((pc.currentMeasuring() / 1000) < m_Params.DBStartTimeout));
                }
                else
                {
                    throw new Exception("can't start sql server !");
                }
            }
        }
コード例 #7
0
ファイル: DBProcess.cs プロジェクト: Duke-Jones/ED-IBE
        /// <summary>
        /// starts the database process if it's not running
        /// </summary>
        /// <param name="Parameter"></param>
        public DBProcess(DBProcessParams Parameter)
        {
            m_Params = Parameter;

            m_wasRunning = IsListenerOnPort(m_Params.Port);
            
            if(!m_wasRunning)
            {
                ProcessStartInfo psi;

                // start the DB server process
                if(Debugger.IsAttached)
                { 
                    psi                         = new ProcessStartInfo(m_Params.Commandline,m_Params.Commandargs);
                    psi.WorkingDirectory        = m_Params.Workingdirectory;
                    psi.WindowStyle             = ProcessWindowStyle.Normal;
                    psi.CreateNoWindow          = false;
                    psi.RedirectStandardOutput  = false;
                    psi.UseShellExecute         = true;
                }
                else
                { 
                    psi                         = new ProcessStartInfo(m_Params.Commandline,m_Params.Commandargs);
                    psi.WorkingDirectory        = m_Params.Workingdirectory;
                    psi.WindowStyle             = ProcessWindowStyle.Hidden;
                    psi.CreateNoWindow          = true;
                    psi.RedirectStandardOutput  = false;
                    psi.UseShellExecute         = true;
                     
                }

                m_Process = System.Diagnostics.Process.Start(psi);

                // wait for db ready state
                Boolean isRunning = false;
                PerformanceTimer pc = new PerformanceTimer();

                pc.startMeasuring();
                System.Threading.Thread.Sleep(1000);

                if (!m_Process.HasExited)
                {
                    do
                    {

                        isRunning = IsListenerOnPort(m_Params.Port);

                        if(!isRunning)
                            System.Threading.Thread.Sleep(1000);
                    
                        Debug.Print("Waiting " + pc.currentMeasuring().ToString());

                    } while ((!isRunning) && ((pc.currentMeasuring() / 1000) < m_Params.DBStartTimeout));
                }
                else
                {
                    throw new Exception("can't start sql server !");
                }
            }
        }