示例#1
0
        private static bool ProcessCommandLine()
        {
            string cmdLine = Environment.CommandLine.ToLowerInvariant();

            // Detect whether the app was launched from uninstaller
            if (cmdLine.Contains("9566b126-2205-4e61-8c1c-e6d4d0fc34f0"))
            {
                _launchFromUninstaller = true;
                Translator.SetInterfaceLanguage(AppConfig.InstallLanguageID);
            }
            else if (cmdLine.Contains("cleanup"))
            {
                _launchFromUninstaller = false;
                Translator.SetInterfaceLanguage(AppConfig.LanguageID);
            }
            else
            {
                Translator.SetInterfaceLanguage(AppConfig.LanguageID);

                LoggedApplication.Start(Constants.UtilityName);
                Application.Run(LogFileConsoleDialog.ShowLogConsole(true));
                return(false);
            }

            return(true);
        }
 void SettingsForm_HandleDestroyed(object sender, EventArgs e)
 {
     if (_restart)
     {
         LoggedApplication.Restart();
     }
 }
        static void Main()
        {
            LaunchPath = string.Empty;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                LoggedApplication.Start(ProTONEConstants.LibraryName);

                string[] cmdLineArgs = Environment.GetCommandLineArgs();

                if (cmdLineArgs.Length > 2)
                {
                    switch (cmdLineArgs.Length)
                    {
                    case 3:
                        switch (cmdLineArgs[1].ToLowerInvariant())
                        {
                        case "launch":
                            LaunchPath = cmdLineArgs[2];
                            break;
                        }
                        break;
                    }
                }

                Translator.RegisterTranslationAssembly(typeof(MediaPlayer).Assembly);
                Translator.RegisterTranslationAssembly(typeof(MediaLibraryForm).Assembly);

                string cmdLine = Environment.CommandLine.ToLowerInvariant();
                if (cmdLineArgs != null && cmdLineArgs.Length > 2 && cmdLine.Contains("configaddons"))
                {
                    Translator.SetInterfaceLanguage(cmdLineArgs[2]);

                    AddonsConfig.IsInitialConfig = true;
                    AppConfig.SkinType           = string.Empty;

                    try
                    {
                        AddonAppSettingsForm.Show("TXT_S_ADDONSETTINGS");
                    }
                    finally
                    {
                    }
                }
                else
                {
                    Translator.SetInterfaceLanguage(AppConfig.LanguageID);
                    Application.Run(new MediaLibraryForm());
                }
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchFatalError(ex);
            }
        }
示例#4
0
        protected override void OnStop()
        {
            Logger.LogInfo("Service preparing to stop ...");

            try
            {
                StopServiceHelper();
                Logger.LogInfo("Service stopped with success.");
            }
            catch (Exception ex)
            {
                Logger.LogInfo("Service failed to stop correctly. {0}", ex.Message);
            }

            LoggedApplication.Stop();
        }
示例#5
0
        protected override void OnStart(string[] args)
        {
            LoggedApplication.Start(this.ServiceName);
            Logger.LogInfo("Service preparing to start ...");

            try
            {
                StartServiceHelper();
                Logger.LogInfo("Service started with success.");
            }
            catch (Exception ex)
            {
                Logger.LogInfo("Service failed to start correctly. {0}", ex.Message);
                Stop();
            }
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoggedApplication.Start("OPMedia.RemoteControlEmulator");

            try
            {
                Application.Run(new MainForm());
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            LoggedApplication.Stop();
        }
示例#7
0
        public async Task <string> LogMessages(List <Message> messages)
        {
            var loggedApplication = new LoggedApplication();
            var loggedMessagess   = new List <LoggedMessage>();

            var appName = string.Empty;

            foreach (var message in messages)
            {
                var logLevel = message.ProcessLogLevel(message.MessageText);
                loggedMessagess.Add(new LoggedMessage()
                {
                    ApplicationId = loggedApplication.Name == message.ApplicationName ? loggedApplication.Id : 0,
                    Date          = message.LogDate,
                    Message       = message.ProcessMessage(message.MessageText).MessageText,
                    LogLevel      = logLevel
                });

                appName = message.ApplicationName;
            }
            // Because LoggedApplication and LoggedMessage are in one-to-many relation,
            // we need to check is there already record in application table with the same name,
            // basing on that, we either insert new record or update existing one
            loggedApplication = LoggingServiceDbContext.application.Where(x => x.Name == appName).FirstOrDefault();

            if (loggedApplication == null)
            {
                loggedApplication                = new LoggedApplication();
                loggedApplication.Name           = appName;
                loggedApplication.LoggedMessages = loggedMessagess;
                await LoggingServiceDbContext.application.AddAsync(loggedApplication);
            }
            else
            {
                loggedApplication.LoggedMessages = loggedMessagess;
                LoggingServiceDbContext.application.Update(loggedApplication);
            }

            await LoggingServiceDbContext.SaveChangesAsync();

            return("Ok");
        }
示例#8
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                LoggedApplication.Start("GuiTester");

                //AppConfig.AllowRealtimeGUISetup = false;
                Translator.SetInterfaceLanguage(AppConfig.LanguageID);


                Application.Run(new MainForm());
            }
            finally
            {
                LoggedApplication.Stop();
            }
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                Translator.SetInterfaceLanguage(AppConfig.LanguageID);

                Translator.RegisterTranslationAssembly(typeof(MainForm).Assembly);
                Translator.RegisterTranslationAssembly(typeof(SerialDeviceCfgDlg).Assembly);
                Translator.RegisterTranslationAssembly(typeof(MediaPlayer).Assembly);

                LoggedApplication.Start(ProTONEConstants.RCCManagerName);

                if (!AppConfig.CurrentUserIsAdministrator)
                {
                    MessageDisplay.Show(Translator.Translate("TXT_ADMIN_RIGHTS_REQUIRED"),
                                        Translator.Translate("TXT_CAUTION"), MessageBoxIcon.Exclamation);

                    Logger.LogInfo("RCC Manager started with non-admin rights. Exiting.");

                    return;
                }

                ServiceControl.StopService();

                mainFrm = new MainForm();
                Application.Run(mainFrm);
                mainFrm.Dispose();
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchFatalError(ex);
            }
            finally
            {
                LoggedApplication.Stop();
                ServiceControl.StartService();
            }
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                LoggedApplication.Start("SampleAddonApplication");

                Translator.RegisterTranslationAssembly(typeof(MainForm).Assembly);
                Translator.SetInterfaceLanguage(AppConfig.LanguageID);
                Application.Run(new MainForm());

                AppConfig.Save();
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex);
            }

            Logger.StopLogger();
        }
        static void Main()
        {
            LaunchPath = string.Empty;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                LoggedApplication.Start("SkinBuilder");

                string[] cmdLineArgs = Environment.GetCommandLineArgs();

                if (cmdLineArgs.Length > 2)
                {
                    switch (cmdLineArgs.Length)
                    {
                    case 3:
                        switch (cmdLineArgs[1].ToLowerInvariant())
                        {
                        case "launch":
                            LaunchPath = cmdLineArgs[2];
                            break;
                        }
                        break;
                    }
                }

                AppConfig.AllowRealtimeGUISetup = false;

                Translator.RegisterTranslationAssembly(typeof(SkinBuilderForm).Assembly);
                Translator.SetInterfaceLanguage("en"); // Only English
                Application.Run(new SkinBuilderForm());
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }
        }
        protected override void OnStop()
        {
            Logger.LogInfo("Service preparing to stop ...");

            TicToc ticToc = new TicToc("Persistence.Service.OnStop", 1);

            try
            {
                ticToc.Tic();

                StopServiceHelper();
                Logger.LogInfo("Service stopped with success.");
            }
            catch (Exception ex)
            {
                Logger.LogInfo("Service failed to stop correctly. {0}", ex.Message);
            }
            finally
            {
                ticToc.Toc();
            }

            LoggedApplication.Stop();
        }
        protected override void OnStart(string[] args)
        {
            LoggedApplication.Start(this.ServiceName);
            Logger.LogInfo("Service preparing to start ...");

            TicToc ticToc = new TicToc("Persistence.Service.OnStart", 1);

            try
            {
                ticToc.Tic();

                StartServiceHelper();
                Logger.LogInfo("Service started with success.");
            }
            catch (Exception ex)
            {
                Logger.LogInfo("Service failed to start correctly. {0}", ex.Message);
                Stop();
            }
            finally
            {
                ticToc.Toc();
            }
        }