2 Replies Latest reply on Aug 6, 2009 2:03 PM by deonpienaar

    Obtaining the StatusInfo of a collective member


      Hi All


      I have been busy with a manual entry application that will be writing to a Collective. I have run into a issue (probably due to my noobness in C# ) with obtaining a collection members StatusInfo. I see from the SDK documentation that it is a NamedValues collection and I am not sure how to access this in C#.


      My main reason for this is to check if a member is connected before trying to write to it. If this check is not done and the first member is not connected a exception is generated and my code passes to the catch block without completing the write for the remaining members in the collective.


      If anybody has a code sample in c# of how to obtain the connection status of a collective member it will be appreciated



        • Re: Obtaining the StatusInfo of a collective member

          Hi Deon


          first you will have to call CollectiveRefresh to fill in the StatusInfo. Here is an example of how to retrieve the information from the NamedValues collection:

          PISDK.Server _srv;
          PISDK.PISDKClass _sdk;
          PISDK.IPICollective _col;
          PISDK.CollectiveList _colList;
          PISDK.CollectiveMember _colMember;
          // Get a handle on the SDK
          _sdk = new PISDK.PISDKClass();
          // set the server to point to our desired server
          _srv = _sdk.Servers["TSHAS"];
          // Check to see if it is a collective
          _col = (PISDK.IPICollective)_srv;
          if (_col.IsCollectiveMember == true)
              // If so, locate the correct Collective Member
              _colList = _col.ListMembers();
              foreach (PISDK.CollectiveMember _colM in _colList)
                  PISDKCommon.NamedValues nvs;
                  nvs = _colM.StatusInfo;
                  string strStatus = "";
                  foreach (PISDKCommon.NamedValue nv in nvs)
                      strStatus = strStatus + nv.Name + ": " + nv.Value.ToString() + Environment.NewLine;