Beispiel #1
0
 public ClipboardAccess(WmiSession wmisession)
 {
     this.wmisession   = wmisession;
     xsSetClipboard    = wmisession.GetXenStoreItem("data/set_clipboard");
     xsReportClipboard = wmisession.GetXenStoreItem("data/report_clipboard");
     serverwatch       = xsSetClipboard.Watch(new EventArrivedEventHandler(OnServerClipboard));
     clientwatch       = xsReportClipboard.Watch(new EventArrivedEventHandler(OnClientClipboard));
 }
Beispiel #2
0
        /// <summary>
        /// Constructor of the NetInfo class
        /// </summary>
        /// <param name="exceptionhandler">The exception handler, trigger when exception occurs</param>
        /// <param name="devicePath"> xenstore device path of NIC device</param>
        /// <param name="attrPath"> xenstore path NIC device data info report back to</param>
        /// <param name="session"> wmi session, mainly used to access xenstore</param>
        public NetInfo(IExceptionHandler exceptionhandler, string devicePath, string attrPath, AWmiSession session)
        {
            wmisession            = session;
            this.exceptionhandler = exceptionhandler;
            updating = new Object();

            this.devicePath = devicePath;
            this.attrPath   = attrPath;

            netDeviceItem = wmisession.GetXenStoreItem(devicePath);
            netAttrItem   = wmisession.GetXenStoreItem(attrPath);

            netDeviceItem.Watch(onXenstoreNetChanged);

            addrChangeHandler = new NetworkAddressChangedEventHandler(onVmNicAddrChange);
            NetworkChange.NetworkAddressChanged += addrChangeHandler;

            netStaticIpSetting = wmisession.GetXenStoreItem(STATIC_IP_FEATURE_MONITOR_KEY);
            netStaticIpSetting.Watch(onXenstoreStaticIpSettingChanged);

            // trigger the first update
            needsRefresh = true;
        }
Beispiel #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(""))
     {
         this.addAdvert(advertise);
     }
     Disposer.Add(this);
 }