コード例 #1
0
ファイル: ExternalProperty.cs プロジェクト: LukaHorvat/Kento
 public ExternalProperty( string Name, bool Static, ChangeHandler OnChange, ExternalGetter External )
 {
     this.OnChange = OnChange;
     this.Static = Static;
     this.Name = Name;
     this.External = External;
 }
コード例 #2
0
ファイル: ExternalProperty.cs プロジェクト: LukaHorvat/Kento
 public ExternalProperty( string Name, bool Static, ChangeHandler OnChange, Value Value )
 {
     this.OnChange = OnChange;
     this.Static = Static;
     this.Name = Name;
     this.Value = Value;
 }
コード例 #3
0
 public DirectoryTreeWatcher(DirectoryTree target, int side, string path, System.Windows.Threading.Dispatcher disp, ChangeHandler Change,
     HashSet<string> fullTextExtensions,
     PleaseWait initProgress)
 {
     this.target = target;
     this.side = side;
     this.path = path;
     this.Change += Change;
     this.disp = disp;
     this.fullTextExtensions = fullTextExtensions;
     init(initProgress);
 }
コード例 #4
0
    public ClientServiceProtocol(String name,
      String path,
      LoadHandler loadHandler,
      SaveHandler saveHandler,
      SaveAsHandler saveAsHandler,
      Graphic graphic,
      Model model,
      ChangePermissionsHandler clientChangePermissions, 
      GetPropertyValuesHandler getPropertyValuesHandler, 
      GetSubTagsHandler getSubTagsHandler,
      ChangeHandler changeHandler,
      RequestPortInfoHandler requestPortInfoHandler,
      PropertyListHandler propertyListHandler, 
      LogMessageHandler logMessageHandler,
      AnnounceHandler announceHandler, 
      RenounceHandler renounceHandler)
    {
      this.Name = name;
      this.Path = path;

      this.graphic = graphic;
      this.model = model;

      this.loadHandler = loadHandler;
      this.saveHandler = saveHandler;
      this.saveAsHandler = saveAsHandler;

      this.clientChangePermissions = clientChangePermissions;

      this.getPropertyValuesHandler = getPropertyValuesHandler;
      this.getSubTagsHandler = getSubTagsHandler;

      this.changeHandler = changeHandler;

      this.requestPortInfoHandler = requestPortInfoHandler;

      this.propertyListHandler = propertyListHandler;

      this.logMessageHandler = logMessageHandler;

      this.announceHandler = announceHandler;
      this.renounceHandler = renounceHandler;
    }
コード例 #5
0
ファイル: CpDeviceUpnp.cs プロジェクト: wifigeek/ohNet
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="aDomainName">Vendor domain for the target service (e.g. upnp.org).</param>
 /// <param name="aServiceType">Name of the target service.</param>
 /// <param name="aVersion">Version number for the target service.</param>
 /// <param name="aAdded">Delegate which will be run when a new device is detected.
 /// Clients who are interested this new device should call AddRef() on it and add it to some local collection.
 /// This callback will never be run for a device that is already in the list.</param>
 /// <param name="aRemoved">Delegatewhich will be run when a device is removed from the network.
 /// Clients who had previously stored a reference to the device in their aAdded callback should call RemoveRef()
 /// and remove the device from their local collection.
 /// Clients who had not previously claimed a reference to a device must not call ReleaseRef().</param>
 public unsafe CpDeviceListUpnpServiceType(String aDomainName, String aServiceType, uint aVersion,
                                           ChangeHandler aAdded, ChangeHandler aRemoved)
 {
     iAdded = aAdded;
     iRemoved = aRemoved;
     char* domain = (char*)Marshal.StringToHGlobalAnsi(aDomainName).ToPointer();
     char* type = (char*)Marshal.StringToHGlobalAnsi(aServiceType).ToPointer();
     IntPtr ptr = GCHandle.ToIntPtr(iGch);
     iHandle = CpDeviceListCreateUpnpServiceType(domain, type, aVersion, iFnAdded, ptr, iFnRemoved, ptr);
     Marshal.FreeHGlobal((IntPtr)domain);
     Marshal.FreeHGlobal((IntPtr)type);
 }
コード例 #6
0
ファイル: CpDeviceUpnp.cs プロジェクト: wifigeek/ohNet
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="aUuid">Unique identifier for the target device.</param>
 /// <param name="aAdded">Delegate which will be run when a new device is detected.
 /// Clients who are interested this new device should call AddRef() on it and add it to some local collection.
 /// This callback will never be run for a device that is already in the list.</param>
 /// <param name="aRemoved">Delegatewhich will be run when a device is removed from the network.
 /// Clients who had previously stored a reference to the device in their aAdded callback should call RemoveRef()
 /// and remove the device from their local collection.
 /// Clients who had not previously claimed a reference to a device must not call ReleaseRef().</param>
 public unsafe CpDeviceListUpnpUuid(String aUuid, ChangeHandler aAdded, ChangeHandler aRemoved)
 {
     iAdded = aAdded;
     iRemoved = aRemoved;
     char* uuid = (char*)Marshal.StringToHGlobalAnsi(aUuid).ToPointer();
     IntPtr ptr = GCHandle.ToIntPtr(iGch);
     iHandle = CpDeviceListCreateUpnpUuid(uuid, iFnAdded, ptr, iFnRemoved, ptr);
     Marshal.FreeHGlobal((IntPtr)uuid);
 }
コード例 #7
0
        public CpDeviceDiagnosticsReportList(DebugReport aReport, ChangeHandler aAdded, ChangeHandler aRemoved)
        {
            iLock     = new object();
            iDisposed = false;

            iReport = aReport;

            iAdded   = aAdded;
            iRemoved = aRemoved;

            iDeviceListDiagnosticsItem = new List <CpDeviceDiagnosticsItem>();

            iDeviceList = new CpDeviceDiagnosticsList(Added, Removed);
        }
コード例 #8
0
 public DirectoryTreeWatcher(DirectoryTree target, int side, string path, System.Windows.Threading.Dispatcher disp, ChangeHandler Change,
                             HashSet <string> fullTextExtensions,
                             PleaseWait initProgress)
 {
     this.target             = target;
     this.side               = side;
     this.path               = path;
     this.Change            += Change;
     this.disp               = disp;
     this.fullTextExtensions = fullTextExtensions;
     init(initProgress);
 }
コード例 #9
0
 /// <summary>
 ///     Removes a listener from this handler
 /// </summary>
 /// <param name="listerner"></param>
 public void removeListener(ChangeHandler listerner)
 {
     handlers.Remove(listerner);
 }
コード例 #10
0
ファイル: SelectionHandler.cs プロジェクト: neoayi/osu
 private void deleteSelected()
 {
     ChangeHandler?.BeginChange();
     EditorBeatmap?.RemoveRange(selectedBlueprints.Select(b => b.HitObject));
     ChangeHandler?.EndChange();
 }
コード例 #11
0
 /// <summary>
 /// Registers a change handler to be triggered on next late update.
 /// </summary>
 public void RegisterChangeHandler(ChangeHandler changeHandler)
 {
     _registeredChangeHandlers.Add(changeHandler);
 }
コード例 #12
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="aDomainName">Vendor domain for the target service (e.g. upnp.org).</param>
 /// <param name="aServiceType">Name of the target service.</param>
 /// <param name="aVersion">Version number for the target service.</param>
 /// <param name="aAdded">Delegate which will be run when a new device is detected.
 /// Clients who are interested this new device should call AddRef() on it and add it to some local collection.
 /// This callback will never be run for a device that is already in the list.</param>
 /// <param name="aRemoved">Delegatewhich will be run when a device is removed from the network.
 /// Clients who had previously stored a reference to the device in their aAdded callback should call RemoveRef()
 /// and remove the device from their local collection.
 /// Clients who had not previously claimed a reference to a device must not call ReleaseRef().</param>
 public CpDeviceListUpnpServiceType(String aDomainName, String aServiceType, uint aVersion,
                                    ChangeHandler aAdded, ChangeHandler aRemoved)
 {
     iAdded = aAdded;
     iRemoved = aRemoved;
     IntPtr domain = InteropUtils.StringToHGlobalUtf8(aDomainName);
     IntPtr type = InteropUtils.StringToHGlobalUtf8(aServiceType);
     IntPtr ptr = GCHandle.ToIntPtr(iGch);
     iHandle = CpDeviceListCreateUpnpServiceType(domain, type, aVersion, iFnAdded, ptr, iFnRemoved, ptr);
     Marshal.FreeHGlobal(domain);
     Marshal.FreeHGlobal(type);
 }
コード例 #13
0
 /// <summary>
 /// Remove a handler from listening to changes.
 /// </summary>
 /// <param name="handler">The handler to remove.</param>
 public void RemoveChangeHandler(ChangeHandler handler)
 {
     this.change -= handler;
 }
コード例 #14
0
ファイル: CpDeviceUpnp.cs プロジェクト: RoonLabs/ohNet
 protected CpDeviceListUpnp(ChangeHandler aAdded, ChangeHandler aRemoved)
     : base(aAdded, aRemoved)
 {
 }
コード例 #15
0
 /// <summary>
 /// Add a handler to listen to variable changes.
 /// </summary>
 /// <param name="handler">The handler to add.</param>
 public void AddChangeHandler(ChangeHandler handler)
 {
     this.change += handler;
 }
コード例 #16
0
 /// <summary>Stops executing the function setup by the corresponding AddListener</summary>
 /// <param name="functionToStopCalling">The local function that you've setup to receive on change events</param>
 /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param>
 public void RemoveOnChangeListener(ChangeHandler functionToStopCalling, SteamVR_Input_Sources inputSource)
 {
     sourceMap[inputSource].onChange -= functionToStopCalling;
 }
コード例 #17
0
 /// <summary>Executes a function when the axis changes by more than the specified changeTolerance</summary>
 /// <param name="functionToCall">A local function that receives the boolean action who's state has changed, the corresponding input source, and the new value</param>
 /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param>
 public void AddOnChangeListener(ChangeHandler functionToCall, SteamVR_Input_Sources inputSource)
 {
     sourceMap[inputSource].onChange += functionToCall;
 }
コード例 #18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="aAdded">Delegate which will be run when a new device is detected.
 /// Clients who are interested this new device should call AddRef() on it and add it to some local collection.
 /// This callback will never be run for a device that is already in the list.</param>
 /// <param name="aRemoved">Delegatewhich will be run when a device is removed from the network.
 /// Clients who had previously stored a reference to the device in their aAdded callback should call RemoveRef()
 /// and remove the device from their local collection.
 /// Clients who had not previously claimed a reference to a device must not call ReleaseRef().</param>
 public CpDeviceListUpnpRoot(ChangeHandler aAdded, ChangeHandler aRemoved)
 {
     iAdded = aAdded;
     iRemoved = aRemoved;
     IntPtr ptr = GCHandle.ToIntPtr(iGch);
     iHandle = CpDeviceListCreateUpnpRoot(iFnAdded, ptr, iFnRemoved, ptr);
 }
コード例 #19
0
ファイル: CpDevice.cs プロジェクト: MatthewMiddleweek/ohNet
 private static void CallListChangedDelegate(ChangeHandler aDelegate, CpDeviceList aList, CpDevice aDevice)
 {
     try
     {
         aDelegate(aList, aDevice);
     }
     catch (ProxyError e)
     {
         Console.WriteLine("WARNING: ProxyError ({0}:{1}) thrown from {2} in device list change delegate", e.Code, (e.Description != null ? e.Description : "<none>"), e.TargetSite.Name);
     }
 }
コード例 #20
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="aUuid">Unique identifier for the target device.</param>
 /// <param name="aAdded">Delegate which will be run when a new device is detected.
 /// Clients who are interested this new device should call AddRef() on it and add it to some local collection.
 /// This callback will never be run for a device that is already in the list.</param>
 /// <param name="aRemoved">Delegatewhich will be run when a device is removed from the network.
 /// Clients who had previously stored a reference to the device in their aAdded callback should call RemoveRef()
 /// and remove the device from their local collection.
 /// Clients who had not previously claimed a reference to a device must not call ReleaseRef().</param>
 public CpDeviceListUpnpUuid(String aUuid, ChangeHandler aAdded, ChangeHandler aRemoved)
 {
     iAdded = aAdded;
     iRemoved = aRemoved;
     IntPtr uuid = InteropUtils.StringToHGlobalUtf8(aUuid);
     IntPtr ptr = GCHandle.ToIntPtr(iGch);
     iHandle = CpDeviceListCreateUpnpUuid(uuid, iFnAdded, ptr, iFnRemoved, ptr);
     Marshal.FreeHGlobal(uuid);
 }
コード例 #21
0
 protected virtual void TraceChanges(object newObject, object oldObject, ChangeHandler changes, string parentClassName)
 {
     if (newObject != null && oldObject != null)
     {
         TypeMetadata metadata = new TypeMetadata(factory.GetClassMetadata(E.Type(newObject.GetType())), newObject);
         TypeMetadata oldmetadata = new TypeMetadata(factory.GetClassMetadata(E.Type(oldObject.GetType())), oldObject);
         foreach (HibernateProperty property in metadata.Properties)
         {
             if (!property.IgnoreAudit)
                 TraceChanges(property, oldmetadata.Property(property.Name), changes, parentClassName);
         }
     }
     else if (oldObject == null && newObject != null)
         changes(newEntity, parentClassName, String.Empty, newObject.ToString());
     else if (oldObject != null)
         changes(newEntity, parentClassName, oldObject.ToString(), String.Empty);
 }
コード例 #22
0
 /// <summary>
 ///     Adds a new listener to this handler
 /// </summary>
 /// <param name="listener"></param>
 public void addListener(ChangeHandler listener)
 {
     handlers.Add(listener);
 }
コード例 #23
0
        private void TraceChanges(HibernateProperty newProperty, HibernateProperty oldProperty, ChangeHandler changes, string parentClassName)
        {
            if (!newProperty.Type.IsCollection)
            {
                if (newProperty.Type.IsComponent)
                {
                    TraceChangesInComponent(changes, newProperty, oldProperty);
                    return;
                }

                if (newProperty.ShouldTraverse())
                {
                    TraceChanges(newProperty.Value, oldProperty.Value, changes, newProperty.ReturnClassName);
                    return;
                }

                MarkIfChanged(changes, newProperty, oldProperty, parentClassName);
            }
        }
コード例 #24
0
 /// <summary>
 /// Initializes a new instance of the FeatureSetApplyEditArgs class.
 /// </summary>
 /// <param name="editCopy">The IFeatureSet edit copy.</param>
 /// <param name="handler">The delegate should point to a method handler to work with the edit copy.</param>
 public FeatureSetApplyEditArgs(IFeatureSet editCopy, ChangeHandler handler)
 {
     _myChangeHandler = handler;
 }
 public void ProcessUncorrelatedStatus(StatusMessage statusMessage)
 {
     Trace.TraceError("Error Status Notification: {0}", statusMessage);
     ChangeHandler.OnErrorStatusNotification(statusMessage);
 }
コード例 #26
0
 public void FindChanges(AbstractEntity newObject, AbstractEntity oldEntity, ChangeHandler changes)
 {
     newEntity = newObject;
     TraceChanges(newObject, oldEntity, changes, string.Empty);
 }
コード例 #27
0
ファイル: CpDevice.cs プロジェクト: openhome/ohNet
 private static void CallListChangedDelegate(ChangeHandler aDelegate, CpDeviceList aList, CpDevice aDevice)
 {
     try
     {
         aDelegate(aList, aDevice);
     }
     catch (ProxyError e)
     {
         System.Diagnostics.Debug.WriteLine("WARNING: ProxyError thrown in device list change delegate: {0}", new object[] { e });
     }
 }
コード例 #28
0
        private void MarkIfChanged(ChangeHandler changes, HibernateProperty newProperty, HibernateProperty oldProperty, string parentClassName)
        {
            if (S.AreDifferent(newProperty.Value, oldProperty.Value) && !newProperty.IgnoreAudit)
            {
                string oldValue = S.Value(oldProperty.Value);
                string newValue = S.Value(newProperty.Value);

                if (oldValue.Length >= 2000 || newValue.Length >= 2000) return;
                changes(newEntity, parentClassName + " " + newProperty.Name, oldValue, newValue);
            }
        }
コード例 #29
0
ファイル: CpDevice.cs プロジェクト: wifigeek/ohNet
 private static void CallListChangedDelegate(ChangeHandler aDelegate, CpDeviceList aList, CpDevice aDevice)
 {
     try
     {
         aDelegate(aList, aDevice);
     }
     catch (Exception e)
     {
         Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name);
         Console.WriteLine("         No exceptions should be thrown by device list change delegates");
     }
 }
コード例 #30
0
        private void TraceChangesInComponent(ChangeHandler changes, HibernateProperty newProperty, HibernateProperty oldProperty)
        {
            if (newProperty.Value != null)
            {
                List<HibernateProperty> properties = newProperty.ComponentProperties;
                List<HibernateProperty> oldProperties;

                if (oldProperty != null && oldProperty.Value != null)
                    oldProperties = oldProperty.ComponentProperties;
                else
                {
                    oldProperties = new List<HibernateProperty>();
                    for (int i = 0; i < properties.Count; i++)
                        oldProperties.Add(new NullHibernateProperty());
                }
                for (int i = 0; i < properties.Count; i++)
                    TraceChanges(properties[i], oldProperties[i], changes, newProperty.Name);
            }
        }
コード例 #31
0
        protected override IEnumerable <MenuItem> GetContextMenuItemsForSelection(IEnumerable <SelectionBlueprint> selection)
        {
            if (selection.All(s => s.HitObject is Hit))
            {
                var hits = selection.Select(s => s.HitObject).OfType <Hit>();

                yield return(new TernaryStateMenuItem("Rim", action: state =>
                {
                    ChangeHandler.BeginChange();

                    foreach (var h in hits)
                    {
                        switch (state)
                        {
                        case TernaryState.True:
                            h.Type = HitType.Rim;
                            break;

                        case TernaryState.False:
                            h.Type = HitType.Centre;
                            break;
                        }
                    }

                    ChangeHandler.EndChange();
                })
                {
                    State = { Value = getTernaryState(hits, h => h.Type == HitType.Rim) }
                });
            }

            if (selection.All(s => s.HitObject is TaikoHitObject))
            {
                var hits = selection.Select(s => s.HitObject).OfType <TaikoHitObject>();

                yield return(new TernaryStateMenuItem("Strong", action: state =>
                {
                    ChangeHandler.BeginChange();

                    foreach (var h in hits)
                    {
                        switch (state)
                        {
                        case TernaryState.True:
                            h.IsStrong = true;
                            break;

                        case TernaryState.False:
                            h.IsStrong = false;
                            break;
                        }

                        EditorBeatmap?.UpdateHitObject(h);
                    }

                    ChangeHandler.EndChange();
                })
                {
                    State = { Value = getTernaryState(hits, h => h.IsStrong) }
                });
            }
        }