示例#1
0
        public static int Main(string[] arguments)
        {
            // TODO: Set via build
            StringEncryptionTypeConverter.RgbIv  = "dlgjowejgogkklwj";
            StringEncryptionTypeConverter.RgbKey = "lsjvkwhvwujkagfauguwcsjgu2wueuff";

            // Make sure the exceptions in the log are readable, uses Ben.Demystifier
            //LogSettings.ExceptionToStacktrace = exception => exception.ToStringDemystified();
#if DEBUG
            // Initialize a debug logger for Dapplo packages
            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Verbose);
#endif
            var applicationConfig = ApplicationConfigBuilder
                                    .Create()
                                    .WithApplicationName("Greenshot")
                                    .WithMutex("F48E86D3-E34C-4DB7-8F8F-9A0EA55F0D08")
                                    .WithConfigSupport()
                                    .WithCaliburnMicro()
                                    .WithAssemblyPatterns("Greenshot.Addon*")
                                    .BuildApplicationConfig();

            var application = new Dapplication(applicationConfig)
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };

            // Prevent multiple instances
            if (application.WasAlreadyRunning)
            {
                // TODO: Call the running instance, pass the commandline
                ShowInstances();
                // Don't start the dapplication, exit with 0
                application.Shutdown(0);
                return(-1);
            }

            RegisterErrorHandlers(application);

            application.Bootstrapper.OnContainerCreated += container =>
            {
                var autofacServiceLocator = new AutofacServiceLocator(container);
                ServiceLocator.SetLocatorProvider(() => autofacServiceLocator);
            };
            application.Run();
            return(0);
        }
示例#2
0
        public static int Main()
        {
#if DEBUG
            // Initialize a debug logger for Dapplo packages
            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Verbose);
#else
            LogSettings.RegisterDefaultLogger <ForwardingLogger>(LogLevels.Debug);
#endif

            // TODO: Set via build
            StringEncryptionTypeConverter.RgbIv  = "dlgjowejgogkklwj";
            StringEncryptionTypeConverter.RgbKey = "lsjvkwhvwujkagfauguwcsjgu2wueuff";

            // Use this to setup the culture of your UI
            var cultureInfo = CultureInfo.GetCultureInfo("en-US");
            Thread.CurrentThread.CurrentCulture   = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;

            var applicationConfig = ApplicationConfigBuilder
                                    .Create()
                                    .WithApplicationName("Finder")
                                    .WithMutex("896482B0-2E32-480C-A9C1-87B1CCF245BF")
                                    .WithoutCopyOfEmbeddedAssemblies()
                                    .WithCaliburnMicro()
                                    .BuildApplicationConfig();

            var application = new Dapplication(applicationConfig)
            {
                ShutdownMode = ShutdownMode.OnLastWindowClose
            };

            // Prevent multiple instances
            if (application.WasAlreadyRunning)
            {
                Log.Warn().WriteLine("{0} was already running.", applicationConfig.ApplicationName);
                // Don't start the dapplication, exit with 0
                application.Shutdown(-1);
                return(-1);
            }

            RegisterErrorHandlers(application);

            application.Run();
            return(0);
        }
示例#3
0
        public static int Main()
        {
#if DEBUG
            // Initialize a debug logger for Dapplo packages
            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Verbose);
#else
            LogSettings.RegisterDefaultLogger <ForwardingLogger>(LogLevels.Debug);
#endif

            // TODO: Set via build
            StringEncryptionTypeConverter.RgbIv  = "dlgjowejgogkklwj";
            StringEncryptionTypeConverter.RgbKey = "lsjvkwhvwujkagfauguwcsjgu2wueuff";

            Log.Info().WriteLine("Windows version {0}", Environment.OSVersion.Version);
            var applicationConfig = ApplicationConfigBuilder
                                    .Create()
                                    .WithApplicationName("Pip")
                                    .WithMutex("214222E8-9878-451F-BF9B-B788F591E7DD")
                                    .WithCaliburnMicro()
                                    .WithoutCopyOfEmbeddedAssemblies()
#if NET471
                                    .WithoutCopyOfAssembliesToProbingPath()
#endif
                                    .BuildApplicationConfig();

            var application = new Dapplication(applicationConfig)
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };

            // Prevent multiple instances
            if (application.WasAlreadyRunning)
            {
                Log.Warn().WriteLine("{0} was already running.", applicationConfig.ApplicationName);
                // Don't start the dapplication, exit with -1
                application.Shutdown(-1);
                return(-1);
            }

            RegisterErrorHandlers(application);

            application.Run();
            return(0);
        }
示例#4
0
        public static void Main(string[] arguments)
        {
            // TODO: Set via build
            StringEncryptionTypeConverter.RgbIv  = "dlgjowejgogkklwj";
            StringEncryptionTypeConverter.RgbKey = "lsjvkwhvwujkagfauguwcsjgu2wueuff";

            // Make sure the exceptions in the log are readable, uses Ben.Demystifier
            LogSettings.ExceptionToStacktrace = exception => exception.ToStringDemystified();
#if DEBUG
            // Initialize a debug logger for Dapplo packages
            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Debug);
#endif

            var application = new Dapplication("Greenshot", "F48E86D3-E34C-4DB7-8F8F-9A0EA55F0D08")
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };

            // Prevent multiple instances
            if (application.WasAlreadyRunning)
            {
                // TODO: Call the running instance, pass the commandline
                ShowInstances();
                // Don't start the dapplication, exit with 0
                application.Shutdown(0);
                return;
            }

            RegisterErrorHandlers(application);

            // Load the assemblies, and run the application
            application.Bootstrapper.FindAndLoadAssemblies("Dapplo.*");
            // Make sure the non-plugin DLLs are also loaded, so exports are available.
            application.Bootstrapper.FindAndLoadAssemblies("Greenshot*");
            application.Bootstrapper.FindAndLoadAssemblies("Greenshot*", extensions: new[] { "gsp" });
            application.Run();
        }