private void Tb_Click(object sender, EventArgs e) { Button button = sender as Button; ConfigurationItem task = button.Tag as ConfigurationItem; if (button.Text == "Stop") { ConfigurationItem result = _configApiClient.InvokeMethod(task, "TaskStop"); } if (button.Text == "Cleanup") { ConfigurationItem result = _configApiClient.InvokeMethod(task, "TaskCleanup"); } }
private void PerformAction(object sender, EventArgs e) { MethodInfo mi = ((Control)sender).Tag as MethodInfo; if (mi != null) { try { ConfigurationItem result = _configApiClient.InvokeMethod(_item, mi.MethodId); if (result != null) { Property sessionDataProperty = result.Properties.FirstOrDefault <Property>(p => p.Key == "SessionDataId"); if (sessionDataProperty != null) { sessionDataProperty.Value = _sessionDataId; _sessionDataId = "0"; } MethodInvokeForm form = new MethodInvokeForm(result, _configApiClient); form.ShowDialog(); _sessionDataId = form.SessionDataId; //if (_item.ItemCategory != ItemCategories.ChildItem) // _item = _configApiClient.GetItem(_item.Path); } } catch (Exception ex) { MessageBox.Show("Unable to perform action:" + ex.Message); } } InitalizeUI(); MainForm.UpdateTree(); }