Forum Discussion

Crash8308_17866's avatar
Crash8308_17866
Icon for Nimbostratus rankNimbostratus
Oct 27, 2010

Toggle Pool members in .net (c sharp)?

I am writing a somewhat "Master Control" form application for the ops guys on our team and am having difficulty finding the right method to use for toggling.

 

I am using iControl 10.2 and here is the relevant code:

 

 

 

 

private void BTN_ToggleNodeStatus_Click(object sender, EventArgs e)

 

{

 

initialize(); //where i initialize my connection

 

Object[] hosts = new Object[dataGridView1.SelectedCells.Count];

 

int i = 0;

 

 

foreach (DataGridViewCell cell in DGV_F5NodeStatus.SelectedCells)

 

{

 

hosts[i++] = cell.Value.ToString(); //creating the array of names that i want to toggle the status of

 

}

 

 

//this is where i am lost, what to do with the array? what iControl method do I invoke to toggle/set the status?

 

 

}

 

3 Replies

  • Code for exactly that can be found in this tech tip from Joe: http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/87/Getting-Started-with-iControl-v9-and-Visual-Studio.aspx Click Here
  • I found out how i could do it by reading the SDK:

     

     

    public void togglenodestatus(CommonEnabledState state)

     

    {

     

    string[] hosts = new string[dataGridView1.SelectedCells.Count];

     

    CommonEnabledState[] states = new CommonEnabledState[dataGridView1.SelectedCells.Count];

     

    int i = 0;

     

    foreach (DataGridViewCell cell in DGV_F5NodeStatus.SelectedCells)

     

    {

     

    hosts = cell.Value.ToString();

     

    states[i++] = state;

     

    }

     

    ;

     

    TheInterface.LocalLBNodeAddress.set_session_enabled_state(hosts, states);
  • I found out how i could do it by reading the SDK:

     

     

    public void togglenodestatus(CommonEnabledState state)

     

    {

     

    string[] hosts = new string[dataGridView1.SelectedCells.Count];

     

    CommonEnabledState[] states = new CommonEnabledState[dataGridView1.SelectedCells.Count];

     

    int i = 0;

     

    foreach (DataGridViewCell cell in DGV_F5NodeStatus.SelectedCells)

     

    {

     

    hosts = cell.Value.ToString();

     

    states[i++] = state;

     

    }

     

    ;

     

    TheInterface.LocalLBNodeAddress.set_session_enabled_state(hosts, states);