private static void RaiseTextChanged(IntPtr cPtr, IntPtr sender, IntPtr e) { try { if (!_TextChanged.ContainsKey(cPtr)) { throw new System.InvalidOperationException("Delegate not registered for TextChanged event"); } if (sender == System.IntPtr.Zero && e == System.IntPtr.Zero) { _TextChanged.Remove(cPtr); return; } if (Noesis.Extend.Initialized) { TextChangedHandler handler = _TextChanged[cPtr]; if (handler != null) { handler(Noesis.Extend.GetProxy(sender, false), new RoutedEventArgs(e, false)); } } } catch (System.Exception exception) { Noesis.Error.SetNativePendingError(exception); } }
private ContentDescriptor m_Descriptor; //The descriptor which this textbox edits.; public DescriptoBox(descriptor ContentDescriptor, ContextMenu ContextMenu, TextChangedHandler EventHandler) { // Builds a DescriptoBox with a specific visual style. It also hooks- // up a TextChanged event handler so the member node and content // descriptor's states can be updated. m_Descriptor = descriptor; this.Multiline = true; this.ContextMenu = ContextMenu; this.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; //Width will be adjusted automatically, but the height will remain static. this.Height = BOX_HEIGHT; //The inital contents of the DescriptoBox is the content of its corresponding content descriptor. this.Text = descriptor.Content; //A descriptor with errors can! be edited, so make the DescriptoBox readonly, otherwise //hook-up the textchanged event handler. if (descriptor.HasErrors) { this.ReadOnly = true; this.ForeColor = Color.Red; } else { this.TextChanged += new System.EventHandler(TextChangedHandler); } }
private static IEventBus InitializeEventBus(IEventHandler<NewNoteAdded> handler, TextChangedHandler textChangedHandler) { var bus = new InProcessEventBus(); bus.RegisterHandler(handler); bus.RegisterHandler(textChangedHandler); return bus; }
public static void BootUp(IEventHandler<NewNoteAdded> handler, TextChangedHandler textChangedHandler) { var config = new StructureMapConfiguration(cfg => { cfg.For<ICommandService>().Use(InitializeCommandService); cfg.For<IEventBus>().Use(InitializeEventBus(handler, textChangedHandler)); cfg.For<IEventStore>().Use(InitializeEventStore); cfg.For<ISnapshotStore>().Use(InitializeSnapshotStore); cfg.For<IUnitOfWorkFactory>().Use(() => new SnapshottingUnitOfWorkFactory()); }); NcqrsEnvironment.Configure(config); }
private protected virtual void NotifyTextChanged(WriteableChangeTextOperation operation) { TextChangedHandler?.Invoke(operation); }