private void ShowTopNodeOnly() { Cursor.Current = Cursors.WaitCursor; treeView.SuspendLayout(); treeView.Nodes.Clear(); try { var server = _configApiClient.GetItem("/"); TreeNode serverTn = new TreeNode(server.DisplayName) { Tag = server, Checked = false, ImageIndex = UI.Icons.GetImageIndex(server.ItemType), SelectedImageIndex = UI.Icons.GetImageIndex(server.ItemType) }; treeView.Nodes.Add(serverTn); DoAfterSelect(serverTn); serverTn.Expand(); } catch (Exception ex) { MessageBox.Show("Unable to get top node: " + ex.Message); } treeView.ResumeLayout(); Cursor.Current = Cursors.Default; }
private void OnTimerTick(object sender, EventArgs e) { try { if (_item != null && _item.ItemType == ItemTypes.InvokeResult || _item.ItemType == ItemTypes.Task) { if (taskPath != null) { _item = _configApiClient.GetItem(taskPath); if (_item != null) { this.SuspendLayout(); scrollPanel1.Clear(); panelActions.Controls.Clear(); FillForm(); this.ResumeLayout(); Property stateProperty = _item.Properties.FirstOrDefault <Property>(p => p.Key == InvokeInfoProperty.State); Property pathProperty = _item.Properties.FirstOrDefault <Property>(p => p.Key == InvokeInfoProperty.Path); if (pathProperty != null) { if (pathProperty.Value.StartsWith("Task")) { taskPath = pathProperty.Value; } } if (stateProperty != null && (stateProperty.Value == "Success" || stateProperty.Value == "Error")) { timer1.Stop(); } } else { timer1.Stop(); } } } else { ConfigurationItem result = _configApiClient.InvokeMethod(_item, _refreshId); if (result != null && result.ItemType == ItemTypes.InvokeResult) { _item = result; this.SuspendLayout(); scrollPanel1.Clear(); panelActions.Controls.Clear(); FillForm(); this.ResumeLayout(); } else { timer1.Stop(); timer1.Dispose(); this.Close(); } } } catch (Exception ex) { _configApiClient.InitializeClientProxy(); timer1.Stop(); timer1.Dispose(); MessageBox.Show(ex.Message); this.Close(); } }