/// <summary>
        /// Run Data menu workflow
        /// </summary>
        public override bool Run(WorkInfo workInfo)
        {
            bool bStatus = false;

            try
            {
                logger.Info($"{this.DisplayName} Running_workflow");
                workInfo.Log(this.DisplayName, NLog.LogLevel.Info, "Running workflow");

                if (!CanRun(workInfo))
                {
                    return(false);
                }

                //var workFlow = InputModule.GetState(InputModule);
                //var state = ((OutputNode)this.InputNode.Connector).State;

                // string msg = "";



                // ModulePageBorder.BorderBrush = System.Windows.Media.Brushes.Green;

                logger.Trace($"Creating [{DisplayName}] XmlFilter object");
                workInfo.Log(this.DisplayName, NLog.LogLevel.Info, "Starting XmlFilter process");

                using (Xml.XmlFilter filter = new Xml.XmlFilter())
                {
                    filter.InputFileName  = InputNode.State.DataFilePath;
                    filter.OutputFileName = OutputNode.State.DataFilePath;

                    if (OutputNode2 != null)
                    {
                        filter.OutputFileName2 = OutputNode2.State.DataFilePath;
                    }

                    filter.DataDir = this.DataDir;

                    foreach (var ff in FilterFields)
                    {
                        filter.Filters.Add(ff);
                    }

                    filter.InputNodeCount = workInfo.Indexer.ItemCount;
                    Action <float> OnProgress = (p) =>
                    {
                        workInfo.UpdateProgress(this, p);
                    };

                    filter.OnProgressUpdate = OnProgress;

                    filter.Filter();
                }

                bStatus = true;
            }
            catch (XPathException ex)
            {
                var msg = $"Critical failure in [{DisplayName}] module error: {ex.Message} ";
                logger.Error(msg);
                workInfo.Log(this.DisplayName, NLog.LogLevel.Error, msg);
                bStatus = false;
            }
            catch (Exception ex)
            {
                var msg = $"Critical failure in [{DisplayName}] module error: {ex.Message} ";
                logger.Error(msg);
                workInfo.Log(this.DisplayName, NLog.LogLevel.Error, msg);
                bStatus = false;
            }

            workInfo.Log(this.DisplayName, NLog.LogLevel.Info, $"Module completed processing with Status: {bStatus}");
            logger.Info($"{this.DisplayName} module completed processing with status:{bStatus}");
            return(bStatus);
        }
示例#2
0
 public static void Main()
 {
     Xml.XmlFilter filter = new Xml.XmlFilter();
     filter.LoadData();
     filter.Filter();
 }