Exemple #1
0
            public override void ExecuteSimple()
            {
                // extract domain object
                var domainObject = arguments.DomainObject;

                //
                if (domainObject == null)
                {
                    return;
                }
                //
                /// Get the Info Factory services from the Core System
                INameInfoFactory    nameInfoFactory    = CoreSystem.GetService <INameInfoFactory>(domainObject);
                IColorInfoFactory   colorInfoFactory   = CoreSystem.GetService <IColorInfoFactory>(domainObject);
                ICommentInfoFactory commentInfoFactory = CoreSystem.GetService <ICommentInfoFactory>(domainObject);

                if (nameInfoFactory != null && colorInfoFactory != null && commentInfoFactory != null)
                {
                    NameInfo    nameInfo    = nameInfoFactory.GetNameInfo(domainObject);
                    ColorInfo   colorInfo   = colorInfoFactory.GetColorInfo(domainObject);
                    CommentInfo commentInfo = commentInfoFactory.GetCommentInfo(domainObject);

                    if (nameInfo != null && colorInfo != null && commentInfo != null)
                    {
                        /// Print the Borehole Domain objects settings data.
                        PetrelLogger.InfoOutputWindow(Environment.NewLine);
                        PetrelLogger.InfoOutputWindow("Settings Info Data Access for    : " + domainObject.GetType().Name);
                        PetrelLogger.InfoOutputWindow("---------------------------------------------------------------------------");
                        PetrelLogger.InfoOutputWindow(" Name                    : " + nameInfo.Name);
                        PetrelLogger.InfoOutputWindow(" Color                   : " + colorInfo.Color.ToString());
                        PetrelLogger.InfoOutputWindow(" TypeName                : " + nameInfo.TypeName);
                        PetrelLogger.InfoOutputWindow(" Comments                : " + commentInfo.Comment);
                        PetrelLogger.InfoOutputWindow(" Can change the Name     : " + nameInfo.CanChangeName.ToString());
                    }
                }

                IHistoryInfoEditor borholeHistoryEditor = HistoryService.GetHistoryInfoEditor(domainObject);

                if (borholeHistoryEditor != null)
                {
                    PetrelLogger.InfoOutputWindow(Environment.NewLine);
                    PetrelLogger.InfoOutputWindow("History Data Access for  : " + domainObject.GetType().Name);
                    PetrelLogger.InfoOutputWindow("---------------------------------------------------------------------------");

                    /// add an History Entry
                    HistoryEntry testHistoryEntry = new HistoryEntry(DateTime.Now, DateTime.Now, Environment.UserName, "Test", "Test Arguments", "Test Version");
                    borholeHistoryEditor.AddHistoryEntry(testHistoryEntry);

                    /// Update the last history record
                    borholeHistoryEditor.UpdateLastHistoryEntry(Environment.UserName, "Test", "Test Arguments", "Test Version");

                    /// access to old history
                    foreach (HistoryEntry entry in borholeHistoryEditor.History)
                    {
                        PetrelLogger.InfoOutputWindow(" User Name               : " + entry.UserName);
                        PetrelLogger.InfoOutputWindow(" Operation               : " + entry.Operation);
                        PetrelLogger.InfoOutputWindow(" Arguments               : " + entry.Arguments);
                        PetrelLogger.InfoOutputWindow(" AppVersion              : " + entry.AppVersion);
                        PetrelLogger.InfoOutputWindow(" Begin Date              : " + entry.BeginDate.ToString());
                        PetrelLogger.InfoOutputWindow(" End Date                : " + entry.EndDate.ToString());
                        PetrelLogger.InfoOutputWindow(Environment.NewLine);
                    }
                }


                //Type type = typeof(argumentPackage.Borehole);
                if (StatisticsService.CanGetStatistics(domainObject.GetType()))
                {
                    Statistics stats = StatisticsService.GetStatistics(domainObject);
                    if (stats != null)
                    {
                        PetrelLogger.InfoOutputWindow("Statistics Data Access for   : " + domainObject.GetType().Name);
                        PetrelLogger.InfoOutputWindow("---------------------------------------------------------------------------");
                        PetrelLogger.InfoOutputWindow(Environment.NewLine);

                        PetrelLogger.InfoOutputWindow("Axis Info items : ");
                        PetrelLogger.InfoOutputWindow(Environment.NewLine);
                        foreach (AxisInfoItem axis in stats.AxisInfo)
                        {
                            PetrelLogger.InfoOutputWindow(" Axis Name               : " + axis.Name);
                            PetrelLogger.InfoOutputWindow(" Axis Min Value          : " + axis.Min);
                            PetrelLogger.InfoOutputWindow(" Axis Max Value          : " + axis.Max);
                            PetrelLogger.InfoOutputWindow(" Axis Delta Value        : " + axis.Delta);
                            PetrelLogger.InfoOutputWindow(" Axis UnitMeasurement    : " + axis.UnitMeasurement.ToString());
                            PetrelLogger.InfoOutputWindow(Environment.NewLine);
                        }

                        PetrelLogger.InfoOutputWindow("Key Value Pair items : ");
                        PetrelLogger.InfoOutputWindow(Environment.NewLine);
                        foreach (KeyValuePair <string, string> keypair in stats.Attributes)
                        {
                            PetrelLogger.InfoOutputWindow(" Key                     : " + keypair.Key);
                            PetrelLogger.InfoOutputWindow(" Value                   : " + keypair.Value);
                            PetrelLogger.InfoOutputWindow(Environment.NewLine);
                        }
                    }
                }
            }