main
1using System;
2using System.Diagnostics;
3using System.IO;
4using System.Security.Principal;
5using System.Windows;
6using System.Windows.Threading;
7using Gorilla.Commons.Infrastructure.Logging;
8using presentation.windows.bootstrappers;
9using presentation.windows.views;
10
11namespace presentation.windows
12{
13 static public class Program
14 {
15 [STAThread]
16 static public void Main(string[] args)
17 {
18 Process.Start(new ProcessStartInfo
19 {
20 FileName = get_service_startup_path(args),
21 //WindowStyle = ProcessWindowStyle.Hidden,
22 });
23 AppDomain.CurrentDomain.UnhandledException += (o, e) =>
24 {
25 (e.ExceptionObject as Exception).add_to_log();
26 };
27 AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
28 Dispatcher.CurrentDispatcher.UnhandledException += (o, e) =>
29 {
30 e.Exception.add_to_log();
31 new ErrorWindow {DataContext = e.Exception}.ShowDialog();
32 e.Handled = true;
33 };
34 new WPFApplication
35 {
36 ShutdownMode = ShutdownMode.OnMainWindowClose,
37 }.Run(ClientBootstrapper.create_window());
38 }
39
40 static string get_service_startup_path(string[] args)
41 {
42 if (args.Length > 0)
43 return Path.Combine(args[0], @"momoney.server.exe");
44 return Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\server\bin\Debug\momoney.server.exe"));
45 }
46 }
47}