Esempio n. 1
0
        private static async void AppMainAsync(string[] args)
        {
            try
            {
                AvalonStudio.Extensibility.Theme.ColorTheme.LoadTheme(AvalonStudio.Extensibility.Theme.ColorTheme.VisualStudioDark);
                MainWindowViewModel.Instance = new MainWindowViewModel();

                await Global.InitializeNoWalletAsync();

                MainWindowViewModel.Instance.Initialize();

                Dispatcher.UIThread.Post(GC.Collect);
            }
            catch (Exception ex)
            {
                if (!(ex is OperationCanceledException))
                {
                    Logger.LogCritical(ex);
                }

                await Global.DisposeAsync().ConfigureAwait(false);

                Environment.Exit(1);
            }
        }
Esempio n. 2
0
        private static async void AppMainAsync(string[] args)
        {
            try
            {
                SetTheme();
                var statusBarViewModel = new StatusBarViewModel(Global.DataDir, Global.Network, Global.Config, Global.HostedServices, Global.BitcoinStore.SmartHeaderChain, Global.Synchronizer, Global.LegalDocuments);
                MainWindowViewModel.Instance = new MainWindowViewModel(Global.Network, Global.UiConfig, Global.WalletManager, statusBarViewModel, IoC.Get <IShell>());

                await Global.InitializeNoWalletAsync();

                MainWindowViewModel.Instance.Initialize(Global.Nodes.ConnectedNodes);

                Dispatcher.UIThread.Post(GC.Collect);
            }
            catch (Exception ex)
            {
                if (!(ex is OperationCanceledException))
                {
                    Logger.LogCritical(ex);
                    Global.CrashReporter.SetException(ex);
                }

                await DisposeAsync();

                // There is no other way to stop the creation of the WasabiWindow.
                Environment.Exit(1);
            }
        }
Esempio n. 3
0
        private static async void AppMainAsync(string[] args)
        {
            try
            {
                AvalonStudio.Extensibility.Theme.ColorTheme.LoadTheme(AvalonStudio.Extensibility.Theme.ColorTheme.VisualStudioDark);

                MainWindowViewModel.Instance = new MainWindowViewModel(Global.Network, Global.UiConfig, Global.WalletManager, new StatusBarViewModel(), IoC.Get <IShell>());

                await Global.InitializeNoWalletAsync();

                MainWindowViewModel.Instance.Initialize(Global.Nodes.ConnectedNodes, Global.Synchronizer);

                Dispatcher.UIThread.Post(GC.Collect);
            }
            catch (Exception ex)
            {
                if (!(ex is OperationCanceledException))
                {
                    Logger.LogCritical(ex);
                    Global.CrashReporter.SetException(ex);
                }

                await DisposeAsync();

                // There is no other way to stop the creation of the WasabiWindow.
                Environment.Exit(1);
            }
        }
Esempio n. 4
0
        private static async void AppMainAsync(string[] args)
        {
            AvalonStudio.Extensibility.Theme.ColorTheme.LoadTheme(AvalonStudio.Extensibility.Theme.ColorTheme.VisualStudioDark);
            MainWindowViewModel.Instance = new MainWindowViewModel();

            await Global.InitializeNoWalletAsync();

            MainWindowViewModel.Instance.Initialize();

            Dispatcher.UIThread.Post(GC.Collect);
        }
Esempio n. 5
0
#pragma warning disable IDE1006 // Naming Styles

        private static async Task Main(string[] args)
#pragma warning restore IDE1006 // Naming Styles
        {
            StatusBarViewModel statusBar = null;

            try
            {
                Platform.BaseDirectory = Path.Combine(Global.DataDir, "Gui");
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                TaskScheduler.UnobservedTaskException      += TaskScheduler_UnobservedTaskException;

                if (!await Daemon.RunAsyncReturnTrueIfContinueWithGuiAsync(args))
                {
                    return;
                }
                BuildAvaloniaApp()
                .BeforeStarting(async builder =>
                {
                    MainWindowViewModel.Instance = new MainWindowViewModel();

                    await Global.InitializeNoWalletAsync();

                    statusBar = new StatusBarViewModel(Global.Nodes.ConnectedNodes, Global.Synchronizer, Global.UpdateChecker);

                    MainWindowViewModel.Instance.StatusBar = statusBar;

                    if (Global.Network != Network.Main)
                    {
                        MainWindowViewModel.Instance.Title += $" - {Global.Network}";
                    }

                    Dispatcher.UIThread.Post(() =>
                    {
                        GC.Collect();
                    });
                }).StartShellApp <AppBuilder, MainWindow>("Wasabi Wallet", null, () => MainWindowViewModel.Instance);
            }
            catch (Exception ex)
            {
                Logger.LogCritical <Program>(ex);
                throw;
            }
            finally
            {
                statusBar?.Dispose();
                await Global.DisposeAsync();

                AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException;
                TaskScheduler.UnobservedTaskException      -= TaskScheduler_UnobservedTaskException;

                Logger.LogInfo($"Wasabi stopped gracefully.", Logger.InstanceGuid.ToString());
            }
        }
Esempio n. 6
0
        private static async void AppMainAsync(string[] args)
        {
            AvalonStudio.Extensibility.Theme.ColorTheme.LoadTheme(AvalonStudio.Extensibility.Theme.ColorTheme.VisualStudioDark);
            MainWindowViewModel.Instance = new MainWindowViewModel();
            StatusBar = new StatusBarViewModel();
            MainWindowViewModel.Instance.StatusBar  = StatusBar;
            MainWindowViewModel.Instance.LockScreen = new LockScreenViewModel();

            await Global.InitializeNoWalletAsync();

            StatusBar.Initialize(Global.Nodes.ConnectedNodes, Global.Synchronizer);

            if (Global.Network != Network.Main)
            {
                MainWindowViewModel.Instance.Title += $" - {Global.Network}";
            }

            Dispatcher.UIThread.Post(GC.Collect);
        }
Esempio n. 7
0
        private static async void AppMainAsync(string[] args)
        {
            try
            {
                SetTheme();
                var statusBarViewModel = new StatusBarViewModel(Global.DataDir, Global.Network, Global.Config, Global.HostedServices, Global.BitcoinStore.SmartHeaderChain, Global.Synchronizer, Global.LegalDocuments);
                MainWindowViewModel.Instance = new MainWindowViewModel(Global.Network, Global.UiConfig, Global.WalletManager, statusBarViewModel, IoC.Get <IShell>());

                await Global.InitializeNoWalletAsync(TerminateService);

                MainWindowViewModel.Instance.Initialize(Global.Nodes.ConnectedNodes);

                Dispatcher.UIThread.Post(GC.Collect);
            }
            catch (Exception ex)
            {
                // There is no other way to stop the creation of the WasabiWindow, we have to exit the application here instead of return to Main.
                TerminateAppAndHandleException(ex, true);
            }
        }
Esempio n. 8
0
#pragma warning disable IDE1006 // Naming Styles

        private static async Task Main(string[] args)
#pragma warning restore IDE1006 // Naming Styles
        {
            StatusBarViewModel statusBar = null;
            bool runGui = false;

            try
            {
                Global = new Global();
                Platform.BaseDirectory = Path.Combine(Global.DataDir, "Gui");
                AvaloniaGlobalComponent.AvaloniaInstance    = Global;
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                TaskScheduler.UnobservedTaskException      += TaskScheduler_UnobservedTaskException;

                runGui = await CommandInterpreter.ExecuteCommandsAsync(Global, args);

                if (!runGui)
                {
                    return;
                }
                Logger.LogStarting("Wasabi GUI");

                BuildAvaloniaApp()
                .BeforeStarting(async builder =>
                {
                    MainWindowViewModel.Instance        = new MainWindowViewModel();
                    MainWindowViewModel.Instance.Global = Global;
                    statusBar = new StatusBarViewModel(Global);
                    MainWindowViewModel.Instance.StatusBar = statusBar;

                    await Global.InitializeNoWalletAsync();

                    statusBar.Initialize(Global.Nodes.ConnectedNodes, Global.Synchronizer, Global.UpdateChecker);

                    if (Global.Network != Network.Main)
                    {
                        MainWindowViewModel.Instance.Title += $" - {Global.Network}";
                    }
                    Dispatcher.UIThread.Post(() =>
                    {
                        GC.Collect();
                    });
                }).StartShellApp <AppBuilder, MainWindow>("Wasabi Wallet", null, () => MainWindowViewModel.Instance);
            }
            catch (Exception ex)
            {
                Logger.LogCritical <Program>(ex);
                throw;
            }
            finally
            {
                statusBar?.Dispose();
                await Global.DisposeAsync();

                AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException;
                TaskScheduler.UnobservedTaskException      -= TaskScheduler_UnobservedTaskException;

                if (runGui)
                {
                    Logger.LogInfo($"Wasabi GUI stopped gracefully.", Logger.InstanceGuid.ToString());
                }
            }
        }