private void UpdateServiceProperties() { GuardServiceSharedData.ServiceData data = this.server.SharedData.GetGuardedService(this.selectedServerToken); if (data == null) { for (int i = 0; i < listViewServiceInformation.Items.Count; i++) { SetListViewServiceInformation(i, ""); } buttonStartTracing.Enabled = false; buttonStopTracing.Enabled = false; buttonReadTracingResult.Enabled = false; labelServiceTracing.Text = "Tracing: Unknown"; } else { SetListViewServiceInformation(0, data.Description.Name); SetListViewServiceInformation(1, data.Token.ToString()); SetListViewServiceInformation(2, data.SemaphoreName); SetListViewServiceInformation(3, data.Description.ExecutablePath); SetListViewServiceInformation(4, data.Description.Arguments); bool tracing = data.Service.Callback.IsTracing(); buttonStartTracing.Enabled = !tracing; buttonStopTracing.Enabled = tracing; buttonReadTracingResult.Enabled = true; labelServiceTracing.Text = "Tracing: " + (tracing ? "On" : "Off"); } }
private void DoService(Guid token, Action <GuardServiceSharedData.ServiceData> action) { GuardServiceSharedData.ServiceData data = this.server.SharedData.GetGuardedService(token); if (data != null) { this.Cursor = Cursors.WaitCursor; try { action(data); } catch (NodeEndpointRequestException e) { MessageBox.Show(e.Message, this.Text); } catch (Exception) { MessageBox.Show("The service is down.", this.Text); } this.Cursor = Cursors.Default; return; } else { MessageBox.Show("Cannot find the service", this.Text); } }