private void InvokeSetComplete()
 {
     if (B_Download.InvokeRequired)
     {
         SetCompleteDelegate d = new SetCompleteDelegate(InvokeSetComplete);
         this.Invoke(d, new object[] { });
     }
     else
     {
         this.B_Download.Enabled = true;
     }
 }
예제 #2
0
        public static void RefreshView(Form Form, Action Starting, NewSetDelegate NewSet, NewRowDelegate NewRow, SetCompleteDelegate SetComplete, Action Finishing)
        {
            _Form        = Form;
            _NewSet      = NewSet;
            _NewRow      = NewRow;
            _SetComplete = SetComplete;

            if (Starting != null)
            {
                Starting();
            }

            SqlConnection cn = new SqlConnection("Data Source=(local);Initial Catalog=LeversAndTurtles;Trusted_Connection=True;Asynchronous Processing=True");

            cn.Open();
            SqlCommand cm = new SqlCommand("DBHealth.RunChecks", cn);

            cm.CommandType = System.Data.CommandType.StoredProcedure;
            cm.BeginExecuteReader(HandleCompletion, cm, System.Data.CommandBehavior.CloseConnection);
        }
예제 #3
0
        public static void RefreshView(Action Starting, NewSetDelegate NewSet, NewRowDelegate NewRow, SetCompleteDelegate SetComplete, Action Finishing)
        {
            if (Starting != null)
            {
                Starting();
            }

            SqlConnection cn = new SqlConnection("Data Source=(local);Initial Catalog=LeversAndTurtles;Trusted_Connection=True");

            cn.Open();
            SqlCommand cm = new SqlCommand("DBHealth.RunChecks", cn);

            cm.CommandType = System.Data.CommandType.StoredProcedure;
            SqlDataReader dr = cm.ExecuteReader(System.Data.CommandBehavior.CloseConnection);

            while (true)
            {
                if (dr.HasRows)
                {
                    bool firstrow = true;
                    ISet set      = null;
                    while (dr.Read())
                    {
                        if (firstrow)
                        {
                            set      = NewSet(dr["Problem"].ToString(), dr);
                            firstrow = false;
                        }

                        NewRow(set, dr);
                    }
                    SetComplete(set);
                }
                if (!dr.NextResult())
                {
                    break;
                }
            }
            dr.Close();
            cn.Close();

            if (Finishing != null)
            {
                Finishing();
            }
        }