private void StorageServiceButtton_Click(object sender, RoutedEventArgs e) { try { if (StorageServiceHelper.CurrentStatus() != ServiceControllerStatus.Running) { StorageServiceHelper.StartService(startStopComletionCallback); } else { StorageServiceHelper.StopService(startStopComletionCallback); } DisplayCurrentServiceStatus(); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
private void DisplayCurrentServiceStatus() { try { var status = StorageServiceHelper.CurrentStatus(); StorageServiceStateTextBlock.Text = status.ToString(); if (status == ServiceControllerStatus.Stopped) { StorageServiceButtton.Background = notActive; } else { StorageServiceButtton.Background = active; } } catch (System.Exception ex) { MessageBox.Show(ex.Message.ToString()); storageServiceStatusCheck.Stop(); } }