Example #1
0
        private async void AcceptBtn(object sender, EventArgs e) // Radio Button Checked
        {
            AcceptButton.Enabled = false;

            if (OffRB.Checked)
            {
                await Task.Run(() => { Services.StopServicesMethod(ServicesClass.GetSQLServices("SQL")); }); //todo need Singleton

                AcceptButton.Enabled = true;
            }
            else
            {
                await Task.Run(() => { Services.StartServicesMethod(ServicesClass.GetSQLServices("SQL")); }); //todo need Singleton

                AcceptButton.Enabled = true;
            }
        }
Example #2
0
        internal void DataGridBackgroundRefresh()
        {
            while (true)
            {
                int position = DataGridServices.FirstDisplayedCell?.RowIndex ?? 0; //Save position scroll\row position

                var s = ServicesClass.GetSQLServices("SQL");
                DataGridServices.Invoke(new Action(() =>
                {
                    DataGridServices.Rows.Clear();
                    foreach (var item in s)
                    {
                        DataGridServices.Rows.Add(new string[] { item.DisplayName, item.Status.ToString(), item.StartType.ToString() });
                    }
                }));

                DataGridServices.FirstDisplayedScrollingRowIndex = position; //Restore position scroll\row psition
                Thread.Sleep(1000);
            }
        }