예제 #1
0
        public static void CreateInstanceASync(CimSession cimSession, string cimNamespace, string cimClassName)
        {
            try
            {
                CimInstance createInstance = CreateInstanceCore(cimSession, cimNamespace, cimClassName);
                if (createInstance == null)
                {
                    Console.WriteLine("CreateInstance operation not performed");
                    return;
                }

                CimAsyncResult<CimInstance> enumeratedInstances = cimSession.CreateInstanceAsync(cimNamespace, createInstance, GetOperationOptions());
                TestObserver<CimInstance> observer = new TestObserver<CimInstance>();
                IDisposable disposeable = enumeratedInstances.Subscribe(observer);
                observer.WaitForCompletion();
            }
            catch (CimException ex)
            {
                PrintCimException(ex);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }