/// <summary> /// 属性变换事件 /// </summary> /// <param name="sender">源</param> /// <param name="v">变化后的值</param> /// <param name="old">变化前的值</param> /// <param name="hander"></param> protected virtual void OnChanged(object sender, object v, object old, ChangedHandler hander) { if (!v.Equals(old) && hander != null) { hander(sender, v); } }
/// Update Menu with new Radio Action Entries public void AddMenus(string ui, RadioActionEntry[] entries, int values, ChangedHandler changed) { AddUiFromString(ui); actionGroup.Add(entries, values, changed); EnsureUpdate(); }
public void Add(RadioActionEntry[] entries, int value, ChangedHandler changed) { GLib.SList group = new GLib.SList(typeof(RadioAction)); RadioAction[] actions = new RadioAction[entries.Length]; for (int i = 0; i < entries.Length; i++) { actions[i] = new RadioAction(entries[i].name, entries[i].label, entries[i].tooltip, entries[i].stock_id, entries[i].value); actions[i].Group = group; group = actions[i].Group; actions[i].Active = value == entries[i].value; if (entries[i].accelerator == null) { Add(actions[i]); } else { Add(actions[i], entries[i].accelerator); } } // Add the ChangedHandler when we're done adding all the actions. // Otherwise, setting the Active property will trigger a premature event. if (changed != null) { actions[0].Changed += changed; } }
public CpDeviceUpdateList(NetworkAdapter aAdapter, Preferences aPreferences, IUpdateListener aUpdateListener, CpDeviceReprogramListRepeater aRepeater, FirmwareCache aCache, VersionInfoReader aVersionInfoReader, ChangedHandler aAdded, ChangedHandler aRemoved) { iLock = new object(); iDisposed = false; iVersionInfoAvailable = false; iAdded = aAdded; iRemoved = aRemoved; iPreferences = aPreferences; iPreferences.EventFirmwareBetaChanged += HandleFirmwareBetaChanged; iUpdateListener = aUpdateListener; iCache = aCache; iVersionReader = aVersionInfoReader; iVersionReader.EventVersionInfoAvailable += VersionInfoAvailable; iPendingList = new List <CpDeviceReprogrammable>(); //iDeviceList = new CpDeviceReprogramList(Added, Removed); iRepeater = aRepeater; iRepeater.Added += Added; iRepeater.Removed += Removed; iDeviceUpdateList = new List <CpDeviceUpdate>(); SetAdapter(aAdapter); }
public SimpleBoolOption(string name, bool value, ChangedHandler handler, bool toggle = true) { this.name = name; this.value = value; this.toggle = toggle; this.handler = handler; }
public FileWatch(CancellationToken?shutdown, ChangedHandler on_changed, int id, object?ctx, params string[] files) : this(shutdown) { foreach (string file in files) { m_watched.Add(new WatchedFile(file, on_changed, id, ctx)); } }
/// <summary> /// Removes a cell changed handler listening to the specified index. /// </summary> /// <param name="index">The inventory index.</param> /// <param name="handler">The handler to remove.</param> public void RemoveCellChangedHandler(int index, ChangedHandler handler) { if (index < 0 || index >= this.cellChanged.Length) { throw new IndexOutOfRangeException("Invalid cell index"); } this.cellChanged[index] -= handler; }
public SimpleFloatOption(string name, float value, float minValue, float maxValue, float step, ChangedHandler handler) { this.name = name; this.value = value; this.minValue = minValue; this.maxValue = maxValue; this.step = step; this.handler = handler; }
internal void OnSendingMessage(IMessage message) { ChangedHandler handler = Changed; if (handler != null) { handler(this, new MessageStoreChangedEventArgs(message, MessageAction.Sending)); } }
public void OnChanged(Int64 eventId, Int64 requestId, Actioned actioned) { if (Changed != null) { foreach (ChangedHandler changedHandler in Changed.GetInvocationList()) { try { changedHandler(eventId, requestId, actioned); } catch (SocketException) { Changed -= changedHandler; } } } }
public void OnChanged(Int64 eventId, Int64 requestId, Actioned actioned) { if (Changed != null) { foreach (ChangedHandler changedHandler in Changed.GetInvocationList()) { try { changedHandler(eventId, requestId, actioned); } catch (SocketException) { Changed -= changedHandler; } } } }
public CpDeviceReprogramList(ChangedHandler aAdded, ChangedHandler aRemoved) { iAdded = aAdded; iRemoved = aRemoved; iDisposed = false; iLock = new object(); iDeviceListPending = new List <CpDeviceVolkano>(); iDeviceListReprogrammable = new SortedList <string, CpDeviceReprogrammable>(); iDeviceListVolkano = new CpDeviceListUpnpServiceType("linn.co.uk", "Volkano", 1, Added, Removed); }
private void OnChanged(MessageStoreChangedEventArgs e) { if (canFireChangedHandler) { ChangedHandler handler = Changed; if (handler != null) { handler(this, e); } } }
public WatchedDir(string dirpath, ChangedHandler onchange, int id, object?ctx) { m_files = new Dictionary <string, WatchedFile>(); Path = dirpath; m_onchange = onchange; m_ctx = ctx; Id = id; // Get the files in the directory and create a watcher for each var files = Path_.EnumFileSystem(Path, SearchOption.TopDirectoryOnly, exclude: FileAttributes.Hidden | FileAttributes.Directory).ToList(); m_files = files.ToDictionary(x => x.FullName.ToLowerInvariant(), x => new WatchedFile(x.FullName, onchange, id, ctx)); }
public CpDeviceRecogniserList(IList <IRecogniser> aRecognisers, ChangedHandler aAdded, ChangedHandler aRemoved) { iAdded = aAdded; iRemoved = aRemoved; iRecognisers = aRecognisers; iDisposed = false; iLock = new object(); iDeviceListPending = new List <CpDeviceRecognised>(); iDeviceListRecognised = new List <CpDeviceRecognised>(); iDeviceListAll = new CpDeviceListUpnpAll(Added, Removed); }
internal void OnFailedToSendMessage(IMessage message, bool willRetry) { ChangedHandler handler = Changed; if (handler != null) { handler(this, new MessageStoreChangedEventArgs(message, willRetry ? MessageAction.SendFailedWillRetry : MessageAction.SendFailed)); } if (!willRetry) { Remove(message); } }
public long m_size0, m_size1; // The last recorded size of the file public WatchedFile(string filepath, ChangedHandler onchange, int id, object?ctx) { Path = filepath; m_onchange = onchange; m_ctx = ctx; Id = id; m_info = new FileInfo(filepath); m_exists0 = m_info.Exists; m_stamp0 = m_exists0 ? m_info.LastWriteTimeUtc.Ticks : 0; m_size0 = m_exists0 ? m_info.Length : 0; m_exists1 = m_exists0; m_stamp1 = m_stamp0; m_size1 = m_size0; }
public CpDeviceFacDefList(NetworkAdapter aAdapter, IUpdateListener aUpdateListener, CpDeviceReprogramListRepeater aRepeater, ChangedHandler aAdded, ChangedHandler aRemoved) { iLock = new object(); iDisposed = false; iAdded = aAdded; iRemoved = aRemoved; iUpdateListener = aUpdateListener; //iDeviceList = new CpDeviceReprogramList(Added, Removed); iRepeater = aRepeater; iDeviceFacDefList = new List <CpDeviceFacDef>(); SetAdapter(aAdapter); }
public Reprogrammer(IPAddress aAdapterAddress, string aUglyname, string aFilename, bool aNoTrust, ChangedHandler aHandler) { iHandler = aHandler; iMessage = "Updating Software..."; iProgress = 0; iFallbackToMain = false; iFallbackToFallback = false; iMainToMain = false; iRebooting = false; iCount = 0; iCountMax = kInitCount + kFallbackToMainCount + kRebootCount + kFallbackToFallbackCount + kRebootCount + kMainToMainCount + kRebootCount; if (iHandler != null) { iHandler(iMessage, iProgress); } Linn.ProductSupport.Flash.Reprogrammer reprogrammer = new Linn.ProductSupport.Flash.Reprogrammer(aAdapterAddress, this, aUglyname, aFilename); reprogrammer.Fallback = false; reprogrammer.NoExec = false; reprogrammer.Wait = true; // wait to discover device after reprogramming reprogrammer.NoTrust = aNoTrust; string failMessage; bool result = reprogrammer.Execute(out failMessage); reprogrammer.Close(); iProgress = 100; if (!result) { iMessage = "Software Update Failed (" + failMessage + ")"; } else { iMessage = "Software Update Succeeded"; } if (iHandler != null) { iHandler(iMessage, iProgress); } }
public CpDeviceAdvancedList(NetworkAdapter aAdapter, IUpdateListener aUpdateListener, CpDeviceReprogramListRepeater aRepeater, VersionInfoReader aVersionReader, ChangedHandler aAdded, ChangedHandler aRemoved) { iLock = new object(); iDisposed = false; iUpdateListener = aUpdateListener; iVersionReader = aVersionReader; iAdded = aAdded; iRemoved = aRemoved; iDeviceListAdvanced = new List <CpDeviceAdvanced>(); iRepeater = aRepeater; iRepeater.Added += Added; iRepeater.Removed += Removed; SetAdapter(aAdapter); }
public FactoryDefaulter(IPAddress aAdapterAddress, string aUglyname, ChangedHandler aHandler) { iHandler = aHandler; iMessage = "Restoring To Factory Defaults..."; iProgress = 0; iRebooting = false; iSettingDefaults = false; iCount = 0; iCountMax = kSettingDefaultsCount + kRebootCount; if (iHandler != null) { iHandler(iMessage, iProgress); } Linn.ProductSupport.Flash.FactoryDefaulter defaulter = new Linn.ProductSupport.Flash.FactoryDefaulter(aAdapterAddress, this, aUglyname); defaulter.NoExec = false; defaulter.Wait = true; // wait to discover device after reprogramming string failMessage; bool result = defaulter.Execute(out failMessage); defaulter.Close(); iProgress = 100; if (!result) { iMessage = "Resetting To Factory Defaults Failed (" + failMessage + ")"; } else { iMessage = "Resetting To Factory Defaults Succeeded"; } if (iHandler != null) { iHandler(iMessage, iProgress); } }
public void Add (RadioActionEntry[] entries, int value, ChangedHandler changed) { RadioAction[] group = null; RadioAction[] actions = new RadioAction[entries.Length]; for (int i = 0; i < entries.Length; i++) { actions[i] = new RadioAction (entries[i].name, entries[i].label, entries[i].tooltip, entries[i].stock_id, entries[i].value); actions[i].Group = group; group = actions[i].Group; actions[i].Active = value == entries[i].value; if (entries[i].accelerator == null) Add (actions[i]); else Add (actions[i], entries[i].accelerator); } // Add the ChangedHandler when we're done adding all the actions. // Otherwise, setting the Active property will trigger a premature event. if (changed != null) actions[0].Changed += changed; }
/// <summary> /// Removes a changed handler. /// </summary> /// <param name="handler">The handler to remove.</param> public void RemoveChangedHandler(ChangedHandler handler) { this.changed -= handler; }
/// <summary> /// Adds a changed handler. /// </summary> /// <param name="handler">The handler to call on changes.</param> public void AddChangedHandler(ChangedHandler handler) { this.changed += handler; }
///<summary> /// Intantiates a new instance of the BindingListener. ///</summary> ///<param name="changedHandler"></param> public BindingListener(ChangedHandler changedHandler) { this.changedHandler = changedHandler; }
///<summary> /// Intantiates a new instance of the BindingListener. ///</summary> ///<param name="changedHandler"></param> public BindingListener(ChangedHandler changedHandler) { this.changedHandler = changedHandler; }
public BindingListener(object context, ChangedHandler changedHandler) { Context = context; this.changedHandler = changedHandler; }
protected virtual void OnStateChanged(StateChangedEventArgs e) { ChangedHandler?.Invoke(this, e); }
/// <summary> /// Constructor. /// </summary> /// <param name="context">The context of the binding.</param> /// <param name="changedHandler">Callback whenever the value of this binding has changed.</param> public BindingListener(object context, ChangedHandler changedHandler) { Context = context; this.changedHandler = changedHandler; }
public FileWatch(CancellationToken?shutdown, ChangedHandler on_changed, params string[] files) : this(shutdown, on_changed, 0, null, files) { }
public GenericOption(string name, ChangedHandler handler, TType value = default(TType)) { this.name = name; this.handler = handler; this.value = value; }