/// <summary> /// Bring down the object from operation. Access to this allows externals to use the 2 step component registration process. /// </summary> public bool UnInitializeComponent(IFxpaBaseCompoent component) { // TracerHelper.Trace(component.Name); component.UnInitialize(); //Arbiter.RemoveClient(component); return(true); }
/// <summary> /// Prepare the object for operation. Access to this allows externals to use the 2 step component registration process. /// </summary> public bool InitializeComponent(IFxpaBaseCompoent component) { // TracerHelper.Trace(component.Name); //Arbiter.AddClient(component); //if (component.IsInitialized == false && component.Initialize(this) == false) //{ // Arbiter.RemoveClient(component); // return false; //} component.Initialize(this); return(true); }
void removeItem_Click(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; IFxpaBaseCompoent component = (IFxpaBaseCompoent)item.Tag; if (component == null) {// This a UI only component. RemoveComponentTab((FxpaCommonControl)item.Tag); } else if (MessageBox.Show("Remove " + component.Name + "?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { fxpaBaseForm.UnRegisterComponent(component); UpdateComponentsMenu(); } }
public bool UnRegisterComponent(IFxpaBaseCompoent component) { // TracerHelper.Trace(component.Name); UnInitializeComponent(component); lock (this) { if (_components.Remove(component) == false) { return(true); } } if (ActiveComponentUpdateEvent != null) { ActiveComponentUpdateEvent(component, false); } return(true); }
void uiThread_ActiveComponentUpdateEvent(IFxpaBaseCompoent component, bool added) { if (added) { FxpaCommonControl control = FxpaCommonControl.CreateCorrespondingControl(component); CreateComponentTab(control); } else { foreach (TabPage page in tabControl.TabPages) { IFxpaBaseCompoent currentComponent = ((FxpaCommonControl)page.Tag).Component as IFxpaBaseCompoent; if (currentComponent == component) { RemoveComponentTab((FxpaCommonControl)page.Tag); break; } } } UpdateTabTitles(); UpdateComponentsMenu(); }
/// <summary> /// Add the object to the list of active objects and call event to notify all listeners, a new object has been added. /// </summary> /// <param name="component"></param> /// <returns></returns> public bool RegisterComponent(IFxpaBaseCompoent component) { // TracerHelper.Trace(component.Name); if (InitializeComponent(component) == false) { return(false); } lock (this) { if (_components.Contains(component)) { return(true); } _components.Add(component); } GeneralHelper.SafeEventRaise(new GeneralHelper.GenericDelegate <IFxpaBaseCompoent, bool>( ActiveComponentUpdateEvent), component, true); return(true); }
void Platform_ActiveComponentUpdateEvent(IFxpaBaseCompoent component, bool isAdded) { // TracerHelper.Trace(component.Name); //if (component is DataSource == false && component is ExecutionSource == false) //{ // return; //} if (component is FxpaSource == false) { return; } //SourceUpdatedMessage message = new SourceUpdatedMessage(component.SubscriptionClientID, component is DataSource, isAdded); lock (this) { //foreach (TransportInfo info in _sourcesUpdatesSubscribers) //{ // this.SendResponding(info, message); //} } }
void createItem_Click(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; Type type = (Type)item.Tag; IFxpaBaseCompoent component = null; if (type.IsSubclassOf(typeof(Analyzer))) { component = new LocalAnalyzerHost(CustomNameAttribute.GetClassAttributeName(type), type); } else { ConstructorInfo info = type.GetConstructor(new Type[] { }); if (info != null) { component = (IFxpaBaseCompoent)info.Invoke(new object[] { }); } } // ... if (component == null) { MessageBox.Show("Failed to create component.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Set settings for component. if (component.SetInitialState(fxpaBaseForm.Settings) == false) { MessageBox.Show("Component failed to initialize from initial state.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Register to platform. fxpaBaseForm.RegisterComponent(component); }
public bool UnInitialize() { // TracerHelper.TraceEntry(); lock (this) { //this.SendRespondingToMany(_sourcesUpdatesSubscribers, new SourcesSubscriptionTerminatedMessage()); //_sourcesUpdatesSubscribers.Clear(); while (_components.Count > 0) {// Cycling this way, since a component might be removing other components. IFxpaBaseCompoent component = this._components[0]; if (component.IsInitialized) { UnInitializeComponent(component); } _components.Remove(component); } //this.Arbiter.Dispose(); } return(true); }
void platform_ActiveComponentUpdateEvent(IFxpaBaseCompoent component, bool added) { this.BeginInvoke(new GeneralHelper.GenericDelegate <IFxpaBaseCompoent, bool>( uiThread_ActiveComponentUpdateEvent), component, added); }