public ParamMgrPresenter(IParamMgr mgr, IParamsView view) { Mgr = mgr; View = view; if (Mgr!=null && View!=null) UpdateValuesInView(); }
public override void PersistMgr(IParamMgr target, System.Xml.XmlWriter writer) { IExtractKthCoreParamMgr mgr = (IExtractKthCoreParamMgr)target; writer.WriteStartElement("ParamMgr"); using (ExtractKthCoreParamBagPersister bagPersiter = new ExtractKthCoreParamBagPersister()) { bagPersiter.PersistBag(mgr.Bag, writer); } writer.WriteEndElement(); }
public IParamMgrPresenter Create(IParamMgr mgr, IParamsView view) { IParamMgrPresenter presenter = null; if (mgr!=null && view!=null) { presenter = new ParamMgrPresenter(mgr, view); view.Presenter = presenter; } return presenter; }
public override void PersistMgr(IParamMgr target, System.Xml.XmlWriter writer) { IImportNetworkParamMgr mgr = (IImportNetworkParamMgr)target; writer.WriteStartElement("ParamMgr"); using (ImportNetworkParamBagPersister bagPersiter = new ImportNetworkParamBagPersister()) { bagPersiter.PersistBag(mgr.Bag, writer); } writer.WriteEndElement(); }
public IParamsView Create(IParamMgr mgr) { IParamsView view = null; if (mgr is RandomGenerators.Params.IRandomNetGenParamMgr) view = CreateView((RandomGenerators.Params.IRandomNetGenParamMgr)mgr); else if (mgr is IImportNetworkParamMgr) view = CreateView((IImportNetworkParamMgr)mgr); else if (mgr is IExportNetworkParamMgr) view = CreateView((IExportNetworkParamMgr)mgr); else if (mgr is IExtractKthCoreParamMgr) view = CreateView((IExtractKthCoreParamMgr)mgr); else if (mgr != null) { view = CreateEmptyView(mgr.ParentId, mgr); } return view; }
public void UnpersistMgr(IParamMgr target, System.Xml.XmlReader reader) { // Assumes reader has started the read of element "ParamMgr" if (reader.Name == "ParamMgr" && !reader.IsEmptyElement) { reader.ReadStartElement("ParamMgr"); IExportNetworkParamMgr mgr = (IExportNetworkParamMgr)target; using (ExportNetworkParamBagUnpersister unpersiter = new ExportNetworkParamBagUnpersister()) { unpersiter.UnpersistBag(mgr.Bag, reader); } if (reader.IsStartElement() && !reader.IsEmptyElement) { reader.Read(); } } }
public void Execute(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { IsAsynch = false; WorkerStatus = FxWorkerStatus.ExecutingSynch; CompletionCalled = false; PercentProgress = 0; ExecWorker(paramMgr, inPortMgr, settings, outPortMgr); }
public void Execute(IParamMgr paramMgr, IInputPortMgr inPortMgr, ICompoundSettingsMgr settings, IOutputPortMgr outPortMgr) { SetStatus(FxStatus.Validating, StatusChangeDriver.NormalTransition, "Beginning pre-execution validations."); if (paramMgr != null) { var myParamMgr = paramMgr as IDataPropertiesElementParamMgr; if (myParamMgr != null) { #region Log _Logger.Info("Execute() begin"); #endregion // begin execution ------------------------------------------------ SetStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); //1) get the input data IInputDataPort inPort = inPortMgr[0] as IInputDataPort; var retriever = new FramePropertyRetrieverToPlainText(); Properties = retriever.GetProperties(inPort.InputDataObj); // inform listeners that values/items at the core have been modified and to refesh the UI. OnCoreModified(new CoreModifiedEventArgs()); // now set the input data as the item to be displaed in the secondary fx M } else SetStatus(FxStatus.UnInitialized, StatusChangeDriver.ValidationFailure, "ParamMgr is not of type IDataPropertiesElementParamMgr."); } else { SetStatus(FxStatus.UnInitialized, StatusChangeDriver.ValidationFailure, "ParamMgr is null."); } }
internal void ExecWorker(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { #region Log _Logger.Debug("ExecWorker() begin"); #endregion Exception ex = null; bool isValidContinue = false; // --- begin execution ------------------------------------------------ UpdateStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); try { int numNodes = 0; int numOfNodesRemoved = 0; int kValue = -1; INetwork inputNet = null; INetwork outputNet = null; IFrame frame1 = null; // Singular frame returns count of isolates removed // --- //1) Validate the parameters var myParamMgr = paramMgr as IExtractKthCoreParamMgr; isValidContinue = ValidateParams(myParamMgr, out kValue, out ex); if (isValidContinue && !IsCancelled) { //2) Get the input network and validate it GetInputs(inPortMgr, out inputNet, out numNodes); isValidContinue = ValidateInputNetwork(inputNet, out ex); if (isValidContinue && !IsCancelled) { //3) Validate the input network combined with the input parameters isValidContinue = ValidateCombinedInputs(inputNet, kValue, out ex); if (isValidContinue && !IsCancelled) { //4) Create and validate a copy of the input network (the copy will be modified) outputNet = CopyInputNetwork(inputNet); isValidContinue = ValidateNetworkCopy(inputNet, outputNet, out ex); if (isValidContinue && !IsCancelled) { //5) Perform the kth core extraction numOfNodesRemoved = ExtractKthCore(outputNet, kValue); //6) Validate the output isValidContinue = ValidateOutputNetwork0(outputNet, numNodes, numOfNodesRemoved, out ex); } } } } WrapUp(isValidContinue, outputNet, outPortMgr, ex); } catch (Exception x) { // update the status if the ex is not recoverable ExecWorkerCleanUp(x); } }
public IParamsView CreateEmptyView(Guid ownerId, IParamMgr mgr) { return Standard.UI.EmptyCtrlProvider.GetCtrl(ownerId, mgr); }
public static IParamsView GetCtrl(Guid ownerId, IParamMgr mgr) { return new EmptyParamsCtrl(ownerId, mgr.Bag); }
public virtual void ExecWorker(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { #region Log _logger.Debug("ExecWorker() begin"); #endregion // --- begin execution ------------------------------------------------ UpdateStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); try { ExecuteCore(paramMgr, inPortMgr, settings, outPortMgr); // WrapUp(IsValidContinue, outputFrame, outPortMgr, ex); ****** WrapUp(outPortMgr); } catch (Exception x) { _logger.ErrorException("ExecWorker() handled the exception and passed it to ExecWorkerCleanUp()", x); // update the status if the ex is not recoverable ExecWorkerCleanUp(x); } }
internal void _Mgr_SettingsChanged(IParamMgr sender, SettingsChangedEventArgs ea) { throw new NotImplementedException("_Mgr_SettingsChanged(IParamMgr sender, SettingsChangedEventArgs ea)"); }
internal void ExecWorker(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { #region Log _Logger.Info("ExecWorker() begin"); #endregion Exception ex = null; bool isValidContinue = false; // --- begin execution ------------------------------------------------ UpdateStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); try { int nodeCount, edgeCount = 0; bool isDirected, allowCycles, allowSelfLoops, allowMultiEdges; string networkName = null; INetwork outputNet = null; IRandomNetGenParamMgr myParamMgr = paramMgr as IRandomNetGenParamMgr; isValidContinue = ValidateParams(myParamMgr, out nodeCount, out edgeCount, out isDirected, out networkName, out allowCycles, out allowSelfLoops, out allowMultiEdges, out ex); if (isValidContinue && !IsCancelled) { outputNet = CreateNetwork(Guid.NewGuid(), myParamMgr); isValidContinue = ValidateOutputNetwork(outputNet, nodeCount, edgeCount, isDirected, out ex); } WrapUp(isValidContinue, IsCancelled, outputNet, outPortMgr, ex); } catch (Exception x) { // update the status if the ex is not recoverable ExecWorkerCleanUp(x); } }
internal void _Execute( IParamMgr paramMgr, IInputPortMgr inPortMgr, ICompoundSettingsMgr settings, IOutputPortMgr outPortMgr) { SetStatus(FxStatus.Validating, StatusChangeDriver.NormalTransition, "Beginning pre-execution validations."); if (paramMgr != null) { // IDataPropertiesElementParamMgr myParamMgr = paramMgr as IDataPropertiesElementParamMgr; // if (myParamMgr != null) // { // #region Log // Log(BlueSpider.Common.Constants.LogEntryTitle_Start, null); // #endregion // // begin execution ------------------------------------------------ // SetStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); // //1) get the input data // IInputDataPort inPort = inPortMgr[0] as IInputDataPort; // InputData = inPort.InputDataObj; // // inform listeners that values/items at the core have been modified and to refesh the UI. // OnCoreModified(new CoreModifiedEventArgs()); // // now set the input data as the item to be displaed in the secondary fx M // } // else // SetStatus(FxStatus.UnInitialized, StatusChangeDriver.ValidationFailure, "ParamMgr is not of type IDataPropertiesElementParamMgr."); } else { SetStatus(FxStatus.UnInitialized, StatusChangeDriver.ValidationFailure, "ParamMgr is null."); } }
internal IParamMgrPresenter CreateParamMgrPresenter(IParamMgr mgr, IParamsView view) { IParamMgrPresenter presenter = null; using (ParamMgrPresenterFactory fac = new ParamMgrPresenterFactory()) { presenter = fac.Create(mgr, view); } return presenter; }
public void ExecuteAsync(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { throw new Exception("The method or operation is not implemented."); }
public void ExecuteAsync(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { if (IsBusy) { CancelAsync(); Reset(); } IsAsynch = true; WorkerStatus = FxWorkerStatus.ExecutingAsynch; CompletionCalled = false; PercentProgress = 0; AsynchOp = AsyncOperationManager.CreateOperation(null); new ExecDelegate(ExecWorker).BeginInvoke(paramMgr, inPortMgr, settings, outPortMgr, null, null); }
public abstract void ExecuteCore(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr);
internal void ExecWorker(IParamMgr paramMgr, IInputPortMgr inPortMgr, ISimpleSettingsMgr settings, IOutputPortMgr outPortMgr) { #region Log _Logger.Info("ExecWorker() begin"); #endregion Exception ex = null; bool isValidContinue = false; // --- begin execution ------------------------------------------------ UpdateStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, "Beginning execution."); try { string fileName = null; bool exportNodeAttributes = false; bool exportEdgeAttributes = false; NetworkFileTypes fileType = NetworkFileTypes.GraphML; INetwork inputNet = null; // --- IExportNetworkParamMgr myParamMgr = paramMgr as IExportNetworkParamMgr; isValidContinue = ValidateParams(myParamMgr, out fileName, out exportNodeAttributes, out exportEdgeAttributes, out fileType, out ex); if (isValidContinue && !IsCancelled) { GetInputs(inPortMgr, out inputNet); // --- isValidContinue = ValidateInputNetwork(inputNet, exportNodeAttributes, exportEdgeAttributes, out ex); if (isValidContinue && !IsCancelled) { WriteFile((IBasicAdjList)inputNet, fileName, exportNodeAttributes, exportEdgeAttributes, fileType); } } WrapUp(isValidContinue, fileName, outPortMgr, ex); } catch (Exception x) { // update the status if the ex is not recoverable ExecWorkerCleanUp(x); } }
/// <summary> /// This method is responsible for un-persisting the <paramref name="target"/> param mgr. /// It is assumed that <paramref name="target"/> is appropriate Type for this element. /// </summary> /// <param name="target">The IParamMgr object to be un-persisted.</param> /// <param name="reader">The XmlReader from which to un-persisted the mgr.</param> public virtual void UnpersistMgr(IParamMgr target, System.Xml.XmlReader reader) { // do nothing }
/// <summary> /// This method is responsible for persisting <paramref name="target"/> which is the IParamMgr /// for a particular type of element. It is assumed that <paramref name="target"/> is appropriate /// Type for this element. /// </summary> /// <param name="target">The IParamMgr object to be persisted.</param> /// <param name="writer">The XmlWriter which will persist the object.</param> public virtual void PersistMgr(IParamMgr target, System.Xml.XmlWriter writer) { // do nothing }