public ImportPopulateByTable(
            LogInstance log,
            ExportTableRecord job,
            AdminShell.Submodel sm,
            AdminShell.AdministrationShellEnv env,
            ExportTableOptions options)
        {
            // context
            _log     = log;
            _job     = job;
            _sm      = sm;
            _env     = env;
            _options = options;

            // prepare Submodel
            if (sm == null || _job.Top == null || _job.Body == null)
            {
                return;
            }
            if (sm.submodelElements == null)
            {
                sm.submodelElements = new AdminShell.SubmodelElementWrapperCollection();
            }

            // prepare matchers
            _matcherTop  = _job.Top.Select((s) => ImportCellMatcherBase.Create(s)).ToList();
            _matcherBody = _job.Body.Select((s) => ImportCellMatcherBase.Create(s)).ToList();
        }
Esempio n. 2
0
 public override void OnQuit()
 {
     Debugger.Log("App shutDown");
     Debugger.logger = null;
     LogInstance.ShutDown();
     MainCamera = null;
 }
Esempio n. 3
0
        /// <summary>
        /// Initialize the Telemetry client with appropriate settings
        /// </summary>
        /// <param name="instrumentationKey">Application Insight instrumentation key</param>
        /// <param name="userKey">Key that uniquely identify the user</param>
        public static async Task InitializeAsync(string instrumentationKey, string userKey)
        {
            try
            {
                await StartupLock.WaitAsync();

                if (IsInitialized)
                {
                    LogInstance.Warning("Client can only be initialized once");
                    return;
                }
                _telemetryClient = new TelemetryClient
                {
                    InstrumentationKey = instrumentationKey
                };

                _telemetryClient.Context.User.Id                = userKey;
                _telemetryClient.Context.Session.Id             = Guid.NewGuid().ToString();
                _telemetryClient.Context.Device.OperatingSystem = GetWindowsFriendlyName();
                _telemetryClient.Context.Device.Model           = GetDeviceModel();
                _telemetryClient.Context.Device.OemName         = GetDeviceManufacturer();
                _telemetryClient.Context.Component.Version      = GetComponentVersion();
                IsInitialized = true;
            }
            finally
            {
                StartupLock.Release();
            }
        }
Esempio n. 4
0
        public static ShelfControl FillWithWpfControls(
            LogInstance log,
            object opackage, object osm,
            AasxPluginDocumentShelf.DocumentShelfOptions options,
            PluginEventStack eventStack,
            object masterDockPanel)
        {
            // access
            var package = opackage as AdminShellPackageEnv;
            var sm      = osm as AdminShell.Submodel;
            var master  = masterDockPanel as DockPanel;

            if (package == null || sm == null || master == null)
            {
                return(null);
            }

            // the Submodel elements need to have parents
            sm.SetAllParents();

            // create TOP control
            var shelfCntl = new ShelfControl();

            shelfCntl.Start(log, package, sm, options, eventStack);
            master.Children.Add(shelfCntl);

            // return shelf
            return(shelfCntl);
        }
Esempio n. 5
0
        public static WpfMtpControlWrapper FillWithWpfControls(
            object opackage, object osm,
            AasxPluginMtpViewer.MtpViewerOptions options,
            PluginEventStack eventStack,
            LogInstance log,
            object masterDockPanel)
        {
            // access
            var package = opackage as AdminShellPackageEnv;
            var sm      = osm as AdminShell.Submodel;
            var master  = masterDockPanel as DockPanel;

            if (package == null || sm == null || master == null)
            {
                return(null);
            }

            // the Submodel elements need to have parents
            sm.SetAllParents();

            // create TOP control
            var wrapperCntl = new WpfMtpControlWrapper();

            wrapperCntl.Start(package, sm, options, eventStack, log);
            master.Children.Add(wrapperCntl);

            // return shelf
            return(wrapperCntl);
        }
Esempio n. 6
0
        public static bool Execute(LogInstance logInstance, string dataconnectionstring)
        {
            using (var connection = new SqlConnection(dataconnectionstring))
            {
                var cmd = new SqlCommand("usp_KirokuG2_Instance_Insert", connection);

                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("dt_session", logInstance.Start);
                cmd.Parameters.AddWithValue("nvc_id", logInstance.Id);
                cmd.Parameters.AddWithValue("nvc_source", logInstance.Source);
                cmd.Parameters.AddWithValue("nvc_function", logInstance.Function);
                cmd.Parameters.AddWithValue("i_duration", logInstance.Duration);
                cmd.Parameters.AddWithValue("i_errors", logInstance.Errors);

                cmd.CommandTimeout = 0;

                connection.Open();

                var reader = cmd.ExecuteReader();

                var recordCount = reader.RecordsAffected;

                return(true);
            }
        }
Esempio n. 7
0
        public static void LogAndUpload(string message)
        {
#if UNITY_EDITOR
            Log(message);
#else
            LogInstance.Log(message, true);
#endif
            Debug.LogError(message);
        }
Esempio n. 8
0
 public UaServerWrapper(
     bool _autoAccept, int _stopTimeout, AdminShellPackageEnv _aasxEnv, LogInstance logger = null,
     AasxUaServerOptions _serverOptions = null)
 {
     autoAccept        = _autoAccept;
     aasxEnv           = _aasxEnv;
     aasxServerOptions = _serverOptions;
     serverRunTime     = _stopTimeout == 0 ? Timeout.Infinite : _stopTimeout * 1000;
     this.Log          = logger;
 }
 public void Start(
     LogInstance log,
     AdminShellPackageEnv thePackage,
     AdminShell.Submodel theSubmodel,
     KnownSubmodelsOptions theOptions,
     PluginEventStack eventStack)
 {
     _log        = log;
     _package    = thePackage;
     _submodel   = theSubmodel;
     _options    = theOptions;
     _eventStack = eventStack;
 }
Esempio n. 10
0
 public void Start(
     AdminShellPackageEnv thePackage,
     AdminShell.Submodel theSubmodel,
     AasxPluginMtpViewer.MtpViewerOptions theOptions,
     PluginEventStack eventStack,
     LogInstance log)
 {
     this.thePackage    = thePackage;
     this.theSubmodel   = theSubmodel;
     this.theOptions    = theOptions;
     this.theEventStack = eventStack;
     this.theLog        = log;
 }
Esempio n. 11
0
 public void Start(
     LogInstance log,
     AdminShellPackageEnv thePackage,
     AdminShell.Submodel theSubmodel,
     AasxPluginDocumentShelf.DocumentShelfOptions theOptions,
     PluginEventStack eventStack)
 {
     this.Log           = log;
     this.thePackage    = thePackage;
     this.theSubmodel   = theSubmodel;
     this.theOptions    = theOptions;
     this.theEventStack = eventStack;
 }
Esempio n. 12
0
        /// <summary>
        /// Check if we can post Telemetry data.
        /// This method checks if the client has been initialized and if posting of telemetry data is allowed
        /// </summary>
        /// <returns>True - Telemetry data can be posted</returns>
        private static bool TelemetryCanBePosted()
        {
            var canPost = true;

            if (!IsInitialized)
            {
                LogInstance.Warning("Cannot track telemetry - Client has not been initialized");
                canPost = false;
            }
            if (!TrackTelemetry)
            {
                LogInstance.Verbose("Telemetry data posting is disabled");
                canPost = false;
            }
            return(canPost);
        }
        //
        // Constructor
        //

        public IntegratedConnectFlyout(
            PackageCentral packageCentral,
            string caption          = null,
            double?maxWidth         = null,
            string initialLocation  = null,
            string initialDirectory = null,
            LogInstance logger      = null)
        {
            InitializeComponent();

            _packageCentral   = packageCentral;
            _caption          = caption;
            _maxWidth         = maxWidth;
            _location         = initialLocation;
            _initialDirectory = initialDirectory;
            _logger           = logger;
        }
        /// <summary>
        /// Starts the log
        /// </summary>
        /// <param name="logfile">Log filename</param>
        public static void StartLog(string logfile)
        {
            Log log = Log.LogInstance;

            if (log != null)
            {
                if (!log.Active)
                {
                    log.LogFile = logfile;

                    // register an event handler that loads as soon as the domain unloads to close the log file
                    AppDomain domain = AppDomain.CurrentDomain;
                    domain.DomainUnload += new EventHandler(domain_DomainUnload);

                    // close everything down before you start a new log
                    LogInstance.closeAllStreams();

                    // set up the filestream and streamwriter for the log
                    log.m_Fs = new FileStream(logfile, FileMode.Create);
                    log.m_Tw = new StreamWriter(log.m_Fs);
                }
            }
        }
Esempio n. 15
0
 public bool Initialize()
 {
     return(LogInstance.Initialize());
 }
Esempio n. 16
0
 public void RequestMessageLog(string Message, string UnitName, TiS.Logger.Log.Severity Severity, Exception exception)
 {
     LogInstance.RequestMessageLog(Message, UnitName, Severity, exception);
 }
Esempio n. 17
0
        static void Main(string[] args)
        {
            // start
            Console.Error.WriteLine(
                "AAS OPC UA Server. (c) 2019 Michael Hoffmeister, Festo AG & Co. KG. See LICENSE.TXT.");

            // arguments
            var options = new AasOpcUaServer.AasxUaServerOptions();

            options.ParseArgs(args);

            // load aasx
            if (options.AasxToLoad == null)
            {
                Console.Error.WriteLine("No .aasx-file to load given. Exiting!");
                return;
            }
            Console.Error.WriteLine($"loading: {options.AasxToLoad} ..");
            var env = new AdminShellPackageEnv(options.AasxToLoad);

            // ReSharper disable HeuristicUnreachableCode
            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            if (env == null)
            {
                Console.Error.WriteLine($"Cannot open {options.AasxToLoad}. Aborting..");
            }

            // configure UA here a little bit
            ApplicationInstance.MessageDlg = new ApplicationMessageDlg();

            // logger
            var logger = new LogInstance();

            // start
            Console.WriteLine("Starting server ...");
            Console.WriteLine("Press 'x' to exit.");
            UaServerWrapper server = new UaServerWrapper(_autoAccept: true, _stopTimeout: 0, _aasxEnv: env,
                                                         logger: logger, _serverOptions: options);

            server.Run();

            // loop
            while (true)
            {
                StoredPrint sp;
                while ((sp = logger.PopLastShortTermPrint()) != null)
                {
                    Console.WriteLine(sp.ToString());
                }

                Thread.Sleep(10);

                if (Console.KeyAvailable)
                {
                    var cki = Console.ReadKey(true);
                    if (cki.Key == ConsoleKey.X)
                    {
                        Console.WriteLine("Stopping initiated ...");
                        break;
                    }
                }
            }

            // stop
            server.Stop();
        }
Esempio n. 18
0
 public LogHelper(LogInstance li)
 {
     ins = li;
     switch (li)
     {
         case LogInstance.LITxtLog:
             {
                 log = new TxtLogHelper();
                 break;
             }
         case LogInstance.LIEventLog:
             {
                 log = new EventLogHelper();
                 break;
             }
     }
 }
Esempio n. 19
0
 public static void Log(string message)
 {
     LogInstance.Log(message);
 }
Esempio n. 20
0
        public static bool InsertInstance(LogInstance logInstance)
        {
            InsertInstanceOperation.Execute(logInstance, _sqlConnection);

            return(true);
        }
Esempio n. 21
0
 public static ILogHelper GetInstance(LogInstance li)
 {
     ILogHelper result = null;
     switch (li)
     {
         case LogInstance.LITxtLog:
             {
                 result = new TxtLogHelper();
                 break;
             }
         case LogInstance.LIEventLog:
             {
                 result = new EventLogHelper();
                 break;
             }
     }
     return result;
 }
Esempio n. 22
0
 public bool setAppender(TiS.Logger.TISAppender appender)
 {
     return(LogInstance.setAppender(appender));
 }