Exemplo n.º 1
0
        /// <summary>
        ///     The object retrieves its serialization info.
        /// </summary>
        public EventQueryNode(SerializationInfo info, StreamingContext context)
        {
            try
            {
                serverName = info.GetString("Server");
                nsName     = info.GetString("NS");
                query      = info.GetString("Query");
                connectAs  = info.GetString("ConnectAs");
                password   = info.GetString("Password");
                eventLabel = info.GetString("EventLabel");

                state = SubscriptionState.Stopped;

                browseObject = new EventQueryComponent(serverName, nsName, query, this);
            }
            catch (Exception exc) {
                MessageBox.Show(WMISys.GetString("WMISE_Exception", exc.Message, exc.StackTrace));
                throw (exc);
            }
        }
Exemplo n.º 2
0
        //
        // CONSTRUCTORS
        //

        // <doc>
        // <desc>
        //     Main constructor.
        //     Parameters:
        //	string server (in, machine name)
        //	string pathIn (in, WMI path without the server name , e.g. "root\default:MyClass")
        // </desc>
        // </doc>
        public EventQueryNode(string labelIn,
                              string serverIn,
                              string nsIn,
                              string queryIn,
                              string user,
                              string pw)
        {
            try
            {
                if (serverIn == string.Empty ||
                    labelIn == string.Empty ||
                    nsIn == string.Empty ||
                    queryIn == string.Empty)
                {
                    throw new ArgumentException();
                }

                serverName = serverIn;
                nsName     = nsIn;
                query      = queryIn;
                connectAs  = user;
                password   = pw;
                label      = labelIn;

                state = SubscriptionState.Started;

                browseObject = new EventQueryComponent(serverName, nsName, query, this);

                OnStartReceiving(this, null);
            }
            catch (Exception exc)
            {
                MessageBox.Show(WMISys.GetString("WMISE_Exception", exc.Message, exc.StackTrace));
                throw (exc);
            }
        }