Example #1
0
 protected override void DoAfterOpenFailure(string message)
 {
     if (this.ParentShowForm != null)
     {
         this.ParentShowForm.WriteLog(message, false);
     }
     else
     {
         ShowForm.WriteLogStatic(message, null, false);
     }
     tRestart.Start();
 }
Example #2
0
        private bool ReloadString(out string strNowCl)
        {
            try
            {
                if (cn.State != ConnectionState.Open)
                {
                    OpenConnection(cn.ConnectionString);
                    strNowCl = "";
                    return(false);
                }

                try
                {
                    strNowCl = FillFullNowClimbing(cn);
                }
                catch (ThreadAbortException exTr) { throw exTr; }
                catch
                {
                    OpenConnection(cn.ConnectionString);
                    strNowCl = "";
                    return(false);
                }
                return(true);
            }
            catch (ThreadAbortException exT) { throw exT; }
            catch (Exception ex)
            {
                if (this.ParentShowForm != null)
                {
                    this.ParentShowForm.WriteLog(ex, false);
                }
                else
                {
                    ShowForm.WriteLogStatic(ex.ToString(), null, false);
                }
                strNowCl = "";
                return(false);
            }
        }
 protected override void BaseControl_Resize(object sender, EventArgs e)
 {
     try
     {
         screenSize = ((this.ClientSize.Height - ROW_SIZE) / ROW_SIZE);
         if (screenSize < 1)
         {
             screenSize = 1;
         }
         RefreshCurrent();
     }
     catch (Exception ex)
     {
         if (this.ParentF != null)
         {
             this.ParentF.WriteLog(ex, false);
         }
         else
         {
             ShowForm.WriteLogStatic(ex.ToString(), null, false);
         }
     }
 }
Example #4
0
        private void t_elapsedThrF(object obj)
        {
            Thread thr;

            if (obj is Thread)
            {
                thr = (Thread)obj;
            }
            else
            {
                thr = null;
            }
            mThrF.WaitOne();
            try
            {
                bool needToReload = false;
                timerIntervalMutex.WaitOne();
                try
                {
                    if (currentString.Length < 1)
                    {
                        if (!ReloadString(out currentString))
                        {
                            return;
                        }
                        needToReload = true;
                    }
                    else
                    {
                        currentString = currentString.Substring(1);
                    }
                    if (textBox1.InvokeRequired)
                    {
                        textBox1.Invoke(new EventHandler(delegate { textBox1.Text = currentString; }));
                    }
                    else
                    {
                        textBox1.Text = currentString;
                    }
                }
                finally { timerIntervalMutex.ReleaseMutex(); }
                if (needToReload)
                {
                    LoadInterval();
                }
                try { t.Start(); }
                catch { }
            }
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                if (this.ParentShowForm != null)
                {
                    this.ParentShowForm.WriteLog(ex, false);
                }
                else
                {
                    ShowForm.WriteLogStatic(ex.ToString(), null, false);
                }
            }
            finally
            {
                mThrF.ReleaseMutex();
                if (thr != null)
                {
                    mThrList.WaitOne();
                    try { thrList.Remove(thr); }
                    catch { }
                    finally { mThrList.ReleaseMutex(); }
                }
            }
        }