Exemple #1
0
        public static CimSessionState GetCimSessionState()
        {
            CimSessionState state = null;

            cimSessions.TryGetValue(CurrentRunspaceId, out state);
            return(state);
        }
Exemple #2
0
        private static void DefaultRunspace_StateChanged(object sender, RunspaceStateEventArgs e)
        {
            CimSessionState cimSessionState = null;
            Runspace        runspace        = (Runspace)sender;
            RunspaceState   state           = e.RunspaceStateInfo.State;

            switch (state)
            {
            case RunspaceState.Closed:
            case RunspaceState.Broken:
            {
                if (CimSessionBase.cimSessions.TryRemove(runspace.InstanceId, out cimSessionState))
                {
                    object[] instanceId = new object[2];
                    instanceId[0] = runspace.InstanceId;
                    instanceId[1] = e.RunspaceStateInfo.State;
                    DebugHelper.WriteLog(string.Format(CultureInfo.CurrentUICulture, DebugHelper.runspaceStateChanged, instanceId));
                    cimSessionState.Dispose();
                }
                runspace.StateChanged -= new EventHandler <RunspaceStateEventArgs>(CimSessionBase.DefaultRunspace_StateChanged);
                return;
            }

            case RunspaceState.Closing:
            {
                return;
            }

            default:
            {
                return;
            }
            }
        }
Exemple #3
0
        public static CimSessionState GetCimSessionState()
        {
            CimSessionState cimSessionState = null;

            CimSessionBase.cimSessions.TryGetValue(CimSessionBase.CurrentRunspaceId, out cimSessionState);
            return(cimSessionState);
        }
Exemple #4
0
        internal uint GenerateSessionId()
        {
            CimSessionState cimSessionState = this;
            uint            num             = cimSessionState.sessionNameCounter;
            uint            num1            = num;

            cimSessionState.sessionNameCounter = num + 1;
            return(num1);
        }