コード例 #1
0
        public static void Main()
        {
#if DEBUG
            // Initialize a debug logger for Dapplo packages
            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Verbose);
#endif
            var applicationConfig = ApplicationConfigBuilder
                                    .Create()
                                    .WithApplicationName("Wapplo")
                                    .WithMutex("BF63D6C4-5F1A-4D43-87C7-0607EB50D0D0")
                                    .WithConfigSupport()
                                    .WithIniSectionResolving()
                                    .WithLanguageResolving()
                                    .WithCaliburnMicro()
                                    .WithAssemblyNames("Dapplo.Owin", "Dapplo.Signalr")
                                    .WithAssemblyPatterns("Wapplo*")
                                    .WithScanDirectories(
#if DEBUG
                @"..\..\..\Wapplo.ShareContext\bin\Debug",
                @"..\..\..\Wapplo.WindowsServices\bin\Debug"
#else
                @"..\..\..\Wapplo.ShareContext\bin\Release",
                @"..\..\..\Wapplo.WindowsServices\bin\DebugRelease"
#endif
                )
                                    .BuildApplicationConfig();

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

            dapplication.Run();
        }
コード例 #2
0
        public static int Main()
        {
#if DEBUG
            // Initialize a debug logger for Dapplo packages
            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Verbose);
#endif

            var applicationConfig = ApplicationConfigBuilder.Create()
                                    .WithApplicationName("Dapplo.SabNZB")
                                    .WithMutex("68cb5937-90cd-4a17-9d30-d68fa9906cd6")
                                    .WithCaliburnMicro()
                                    .WithConfigSupport()
                                    // Activate automatic "IniSection" resolving
                                    .WithIniSectionResolving()
                                    // Activate automatic "ILanguage" resolving
                                    .WithLanguageResolving()
                                    .BuildApplicationConfig();
            var dapplication = new Dapplication(applicationConfig)
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };

            if (dapplication.WasAlreadyRunning)
            {
                return(-1);
            }

            StringEncryptionTypeConverter.RgbIv  = "0@94hFj3&E4r!k231E!";
            StringEncryptionTypeConverter.RgbKey = "lkfwWF/63)=ßDeefkez4§Rf33g39hh§F";

            dapplication.Run();
            return(0);
        }
コード例 #3
0
        public static void Main()
        {
            LogSettings.RegisterDefaultLogger <FileLogger>(LogLevels.Verbose);
            //LogSettings.RegisterDefaultLogger<DebugLogger>(LogLevels.Verbose);

            // 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("ClickOnceDemo")
                                    .WithMutex("2141D0DC-2B87-4B70-A8A7-A1EFDB588656")
                                    .WithCaliburnMicro()
                                    .WithAssemblyPatterns("Application.Demo*")
                                    .BuildApplicationConfig();

            var application = new Dapplication(applicationConfig)
            {
                ShutdownMode     = ShutdownMode.OnLastWindowClose,
                OnAlreadyRunning = () =>
                {
                    MessageBox.Show("Already started, exiting");
                    return(-1);
                }
            };

            // Handle exceptions
            application.DisplayErrorView();
            application.Run();
        }
コード例 #4
0
        public static void Main()
        {
            LogSettings.RegisterDefaultLogger <FileLogger>(LogLevels.Verbose);
            //LogSettings.RegisterDefaultLogger<DebugLogger>(LogLevels.Verbose);

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

            Thread.CurrentThread.CurrentCulture   = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;

            var application = new Dapplication("ClickOnceDemo", "2141D0DC-2B87-4B70-A8A7-A1EFDB588656")
            {
                ShutdownMode     = ShutdownMode.OnLastWindowClose,
                OnAlreadyRunning = () =>
                {
                    MessageBox.Show("Already started, exiting");
                    return(-1);
                }
            };

            // Load the Application.Demo.* assemblies
            application.Bootstrapper.FindAndLoadAssemblies("Application.Demo.*.dll");
            // Handle exceptions
            application.DisplayErrorView();
            application.Run();
        }
コード例 #5
0
ファイル: Startup.cs プロジェクト: punker76/Dapplo.Dopy
        public static void Main()
        {
#if DEBUG
            // Initialize a debug logger for Dapplo packages
            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Verbose);
#else
            // Make sure everything is logged, until the next logger is set, so it can be forwarded
            LogSettings.RegisterDefaultLogger <ForwardingLogger>(LogLevels.Debug);
#endif

            var applicationConfig = ApplicationConfigBuilder
                                    .Create()
                                    .WithApplicationName("Dapplo.Dopy")
                                    .WithMutex("06486F0F-0DBC-4912-9C5C-5C9C777BA34E")
                                    .WithCaliburnMicro()
                                    .WithoutCopyOfEmbeddedAssemblies()
                                    .WithAssemblyPatterns("Dapplo.Dopy*")
                                    .BuildApplicationConfig();
            var application = new Dapplication(applicationConfig)
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };

            application.Run();
        }
コード例 #6
0
        /// <summary>
        /// Show the exception
        /// </summary>
        /// <param name="application">Dapplication</param>
        /// <param name="exception">Exception</param>
        private static void DisplayErrorViewModel(Dapplication application, Exception exception)
        {
            var windowManager = application.Bootstrapper.Container.Resolve <IWindowManager>();

            using (var errorViewModel = application.Bootstrapper.Container.Resolve <Owned <ErrorViewModel> >())
            {
                if (windowManager == null || errorViewModel == null)
                {
                    return;
                }
                errorViewModel.Value.SetExceptionToDisplay(exception);
                windowManager.ShowDialog(errorViewModel.Value);
            }
        }
コード例 #7
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);
        }
コード例 #8
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);
        }
コード例 #9
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);
        }
コード例 #10
0
        private static void Start(ApplicationConfig applicationConfig)
        {
            // Make sure the log entries are demystified
            //LogSettings.ExceptionToStacktrace = exception => exception.ToStringDemystified();
#if DEBUG
            // Initialize a debug logger for Dapplo packages
            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Verbose);
#endif

            var application = new Dapplication(applicationConfig)
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };
            // Handle exceptions
            application.DisplayErrorView();

            // Run!!!
            application.Run();
        }
コード例 #11
0
        public static void Main()
        {
#if DEBUG
            // Initialize a debug logger for Dapplo packages
            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Debug);
#endif

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

            var application = new Dapplication("Today", "FFC42632-134E-4677-A703-9B5B1AF9BB24")
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };

            // Start the application
            application.Run();
        }
コード例 #12
0
        public static void Main()
        {
#if DEBUG
            // Initialize a debug logger for Dapplo packages
            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Verbose);
#endif
            var applicationConfig = ApplicationConfigBuilder
                                    .Create()
                                    .WithApplicationName("Dapplo.Exchange.ExampleClient")
                                    .WithMutex("05ffc82c-f7cd-45d3-831d-867660a231ff")
                                    .WithCaliburnMicro()
                                    .BuildApplicationConfig();
            var application = new Dapplication(applicationConfig)
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };
            if (application.WasAlreadyRunning)
            {
            }
            application.Run();
        }
コード例 #13
0
ファイル: Startup.cs プロジェクト: dapplo/Dapplo.Jolokia
		public static void Main()
		{
			var dapplication = new Dapplication("Jolokia", "1392C220-45DA-468D-BA32-53B93D9F6E70")
			{
				ShutdownMode = ShutdownMode.OnMainWindowClose,
				// Don't allow the application to run multiple times
				OnAlreadyRunning = () =>
				{
					MessageBox.Show("Already running, this process exits", "Jolokia", MessageBoxButton.OK, MessageBoxImage.Exclamation);
					Dapplication.Current.Shutdown();
				},
				ObserveUnhandledTaskException = true,
				OnUnhandledTaskException = exception => new LogSource().Error().WriteLine(exception.Message)
			};
			LogSettings.RegisterDefaultLogger<DebugLogger>(LogLevels.Verbose);

			// Add some DLL's we need
			dapplication.Bootstrapper.FindAndLoadAssemblies("Dapplo*");

			// Let Dapplo initialize everything, including the web-app
			dapplication.Run();
		}
コード例 #14
0
ファイル: Startup.cs プロジェクト: enihcam/Dapplo.Jolokia
        public static void Main()
        {
            var dapplication = new Dapplication("Jolokia", "1392C220-45DA-468D-BA32-53B93D9F6E70")
            {
                ShutdownMode = ShutdownMode.OnMainWindowClose,
                // Don't allow the application to run multiple times
                OnAlreadyRunning = () =>
                {
                    MessageBox.Show("Already running, this process exits", "Jolokia", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    Dapplication.Current.Shutdown();
                },
                ObserveUnhandledTaskException = true,
                OnUnhandledTaskException      = exception => new LogSource().Error().WriteLine(exception.Message)
            };

            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Verbose);

            // Add some DLL's we need
            dapplication.Bootstrapper.FindAndLoadAssemblies("Dapplo*");

            // Let Dapplo initialize everything, including the web-app
            dapplication.Run();
        }
コード例 #15
0
ファイル: Startup.cs プロジェクト: Vistritium/greenshot
        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();
        }
コード例 #16
0
        private static void Start(ApplicationConfig applicationConfig)
        {
            // Make sure the log entries are demystified
            LogSettings.ExceptionToStacktrace = exception => exception.ToStringDemystified();
#if DEBUG
            // Initialize a debug logger for Dapplo packages
            LogSettings.RegisterDefaultLogger <DebugLogger>(LogLevels.Debug);
#endif

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

            var application = new Dapplication(applicationConfig)
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };
            // Handle exceptions
            application.DisplayErrorView();

            // Run!!!
            application.Run();
        }
コード例 #17
0
 /// <summary>
 /// Make sure all exception handlers are hooked
 /// </summary>
 /// <param name="application">Dapplication</param>
 private static void RegisterErrorHandlers(Dapplication application)
 {
     application.OnUnhandledAppDomainException  += (exception, b) => DisplayErrorViewModel(exception);
     application.OnUnhandledDispatcherException += DisplayErrorViewModel;
     application.OnUnhandledTaskException       += DisplayErrorViewModel;
 }
コード例 #18
0
 /// <summary>
 /// Handle exceptions, and display them in a view.
 /// Make sure that
 /// </summary>
 /// <param name="application">Dapplication to handle the exceptions for</param>
 public static void DisplayErrorView(this Dapplication application)
 {
     application.OnUnhandledAppDomainException  += (exception, b) => DisplayErrorViewModel(exception);
     application.OnUnhandledDispatcherException += DisplayErrorViewModel;
     application.OnUnhandledTaskException       += DisplayErrorViewModel;
 }