/// <summary> /// Request the status of the ARE (and the plugins, running on the ARE) /// Display the status in a window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GetAREStatusRibbonButton_Click(object sender, RoutedEventArgs e) { try { List<StatusObject> newStatus = asapiClient.QueryStatus(false); if (newStatus.Count > 0) { foreach (StatusObject so in newStatus) { statusList.Add(so); } } StatusWindow sw = new StatusWindow(); string[] statusRow; foreach (StatusObject so in statusList) { statusRow = new string[3]; statusRow[0] = so.Status; statusRow[2] = so.ErrorMsg; if (so.InvolvedComponentID == "") { statusRow[1] = "ARE"; } else { statusRow[1] = so.InvolvedComponentID; } sw.StatusDataGrid.Rows.Add(statusRow); } sw.Owner = this; sw.ShowDialog(); } catch (Exception ex) { MessageBox.Show(Properties.Resources.GetAREStatusErrorDialog, Properties.Resources.GetAREStatusErrorDialogHeader, MessageBoxButton.OK, MessageBoxImage.Error); traceSource.TraceEvent(TraceEventType.Error, 3, ex.Message); } }
/// <summary> /// Show the status of the selected component /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ComponentContextItemStatus_Click(object sender, RoutedEventArgs e) { string callerId = ""; if (((ContextMenu)((MenuItem)e.Source).Parent).PlacementTarget is Rectangle) { Rectangle r = (Rectangle)((ContextMenu)((MenuItem)e.Source).Parent).PlacementTarget; foreach (componentType tempComponent in deploymentComponentList.Values) { if ((tempComponent.MainRectangle == r) || (tempComponent.TopRectangle == r)) { callerId = tempComponent.id; break; } } } else if (((ContextMenu)((MenuItem)e.Source).Parent).PlacementTarget is Grid) { Grid g = (Grid)((ContextMenu)((MenuItem)e.Source).Parent).PlacementTarget; foreach (componentType tempComponent in deploymentComponentList.Values) { if (tempComponent.TopGrid == g) { callerId = tempComponent.id; break; } } } // if the ACS is connected to the ARE, th status of the component will be requested // otherwise, the status from earlier requests will be shown try { if ((areStatus.Status == AREStatus.ConnectionStatus.Connected) || (areStatus.Status == AREStatus.ConnectionStatus.Synchronised)) { List<StatusObject> newStatus = asapiClient.QueryStatus(false); if (newStatus.Count > 0) { foreach (StatusObject so in newStatus) { statusList.Add(so); } } } StatusWindow sw = new StatusWindow(); string[] statusRow; foreach (StatusObject so in statusList) { if (so.InvolvedComponentID == callerId) { statusRow = new string[3]; statusRow[0] = so.Status; statusRow[2] = so.ErrorMsg; statusRow[1] = so.InvolvedComponentID; sw.StatusDataGrid.Rows.Add(statusRow); //break; } else if (deploymentComponentList[callerId].ComponentType == ACS2.componentTypeDataTypes.group) { foreach (componentType componentInGroup in groupsList[callerId].AddedComponentList) { foreach (StatusObject soInGroup in statusList) { if (soInGroup.InvolvedComponentID == componentInGroup.id) { statusRow = new string[3]; statusRow[0] = soInGroup.Status; statusRow[2] = soInGroup.ErrorMsg; statusRow[1] = soInGroup.InvolvedComponentID; sw.StatusDataGrid.Rows.Add(statusRow); } } } } } sw.InvolvedComponent = deploymentComponentList[callerId]; sw.label1.Content = Properties.Resources.StatusWindowLabelComponentFormat(callerId); sw.Owner = this; sw.ShowDialog(); } catch (Exception ex) { MessageBox.Show(Properties.Resources.GetAREStatusErrorDialog, Properties.Resources.GetAREStatusErrorDialogHeader, MessageBoxButton.OK, MessageBoxImage.Error); traceSource.TraceEvent(TraceEventType.Error, 3, ex.Message); } }