Add() public static method

public static Add ( IDisposable disposee ) : void
disposee IDisposable
return void
示例#1
0
 public FeatureTerminalServicesReset(IExceptionHandler exceptionhandler)
     : base("Terminal Services Reset", "control/feature-ts2", "data/ts", false, exceptionhandler)
 {
     datats = wmisession.GetXenStoreItem("data/ts");
     Disposer.Add(WmiBase.Singleton.ListenForEvent("__InstanceModificationEvent", new EventArrivedEventHandler(onFeatureWrapper)));
     onFeature();
 }
示例#2
0
        void WmiCapableServiceThreadHandler()
        {
            try
            {
                wmisession = WmiBase.Singleton.GetXenStoreSession("Features");

                wmisession.Log("Guest Agent Starting");
                Refresher.Add(new PVInstallation(this));

                wmisession.Log("About to run apps");

                RunProcess("wmiadap", "/f", "refresh WMI ADAP");
                RunProcess("diskperf", "-y", "enable disk perf counters");


                wmisession.Log("About to run features");
                new FeatureLicensed(this);
                new FeatureVSSLicensed(this);
                new FeatureDumpLog(this);
                new FeatureGC(this);
                new FeaturePing(this);
                new FeatureDomainJoin(this);
                new FeatureSetComputerName(this);
                new FeatureXSBatchCommand(this);
                new FeatureAutoUpdate(this);

                wmisession.Log("About to try snapshot");
                if (FeatureSnapshot.IsSnapshotSupported())
                {
                    Refresher.Add(new FeatureSnapshot(this));
                }
                else
                {
                    wmisession.Log("Snapshot not supported on this platform");
                    FeatureSnapshot.removeSnapshot(wmisession);
                }
                new FeatureTerminalServicesReset(this);
                new FeatureTerminalServices(this);
                new FeatureStaticIpSetting(this);
                wmisession.Log("About to add refreshers");

                Refresher.Add(new NetInfo(this));
                Refresher.Add(new VolumeInfo());
                Refresher.Add(new MemoryInfo());

                wmisession.Log("About to add handlers ");
                clipboardhandler = new ClipboardManager(this);
                Disposer.Add(clipboardhandler);
                clipboardhandler.Run();
                Disposer.Add(WmiBase.Singleton.ListenForEvent("CitrixXenStoreUnsuspendedEvent", new EventArrivedEventHandler(handleUnsuspended)));

                Refresher.RefreshAll(true);
                wmisession.Log("running ");
                Refresher.Run(this);
            }
            catch (Exception e)
            {
                HandleException("Service handler", e);
            }
        }
示例#3
0
 public Feature(string name, string advertise, string control, bool controlmustexist, IExceptionHandler exceptionhandler)
 {
     this.exceptionhandler = exceptionhandler;
     this.name             = name;
     wmisession            = WmiBase.Singleton.GetXenStoreSession("Citrix Xen Service Feature : " + name);
     wmisession.Log("New Feature");
     controlKey            = wmisession.GetXenStoreItem(control);
     this.controlmustexist = controlmustexist;
     try
     {
         if (controlKey.value != "")
         {
             wmisession.Log("Control key " + control + ":" + controlKey.value);
         }
     }
     catch {}
     enabled  = true;
     listener = controlKey.Watch(new EventArrivedEventHandler(onFeatureWrapper));
     if (!advertise.Equals(""))
     {
         advert = wmisession.GetXenStoreItem(advertise);
         features.Add(this);
     }
     Disposer.Add(this);
 }
示例#4
0
 static public void Add(IRefresh refresher)
 {
     lock (refreshlock)
     {
         refreshers.Push(refresher);
         Disposer.Add(refresher);
     }
 }
示例#5
0
 public FeatureTerminalServicesReset(IExceptionHandler exceptionhandler)
     : base("Terminal Services Reset", "control/feature-ts2", "data/ts", false, exceptionhandler)
 {
     datats = wmisession.GetXenStoreItem("data/ts");
     try
     {
         Disposer.Add(WmiBase.Singleton.ListenForEvent("__InstanceModificationEvent", new EventArrivedEventHandler(onFeatureWrapper)));
     }
     catch
     {
         Trace.WriteLine("Terminal Services namespace not available on this version of windows");
     }
     onFeature();
 }