示例#1
0
        public static void Main(string[] args)
        {
            VisionChannel = new VisionChannel1()
            {
                AttentionLevel               = AttentionLevel.deepDetail,
                DisplayFilterMinLevel        = AttentionLevel.deepDetail,
                DisplayedLogMessagesMaxCount = 1000,
                ClearLog_RamSizeMB           = 100,
                ClearLog_MessagesCount       = 1000,
            };
            VisionChannel.SevereMessageEmitted += (msg) => Console.WriteLine(msg.Message);

            try
            {
                VisionChannel.Emit("", "", AttentionLevel.higherLevelDetail, "creating user app");
                UserAppEngine = new UserAppEngine(UserAppConfiguration.Default, VisionChannel);
                VisionChannel.Emit("", "", AttentionLevel.higherLevelDetail, $"creating web host at {Url}");
                var host = CreateHostBuilder(Url, args).Build();
                VisionChannel.Emit("", "", AttentionLevel.higherLevelDetail, $"created web host at {Url}");

                Console.WriteLine($"please access messenger web UI from same machine in browser: {Url}");

                VisionChannel.Emit("", "", AttentionLevel.higherLevelDetail, $"running web host at {Url}");
                host.Run();
                UserAppEngine?.Dispose();
            }
            catch (Exception exc)
            {
                VisionChannel.Emit("", "", AttentionLevel.strongPain, $"error in Program.Main(): {exc}");
                UserAppEngine?.Dispose();
            }
        }
示例#2
0
        public override void OnDestroy()
        {
            // We need to shut things down.
            //  Log.Debug(TAG, GetFormattedTimestamp() ?? "The TimeStamper has been disposed.");
            //   Log.Info(TAG, "OnDestroy: The started service is shutting down.");

            // Stop the handler.
            //   handler.RemoveCallbacks(runnable);

            // Remove the notification from the status bar.
            var notificationManager = (NotificationManager)GetSystemService(NotificationService);

            notificationManager.Cancel(SERVICE_RUNNING_NOTIFICATION_ID);

            //   timestamper = null;
            //   isStarted = false;
            StopSelf();
            StopForeground(true);


            if (_userAppEngine != null)
            {
                _userAppEngine.Dispose();
            }


            base.OnDestroy();
        }