Example #1
0
        private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            if (MainWindow != null)
            {
                MessageBox.Show(MainWindow, ViewModelCommon.ConvertExceptionToString(e.Exception), "Chyba", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                MessageBox.Show(ViewModelCommon.ConvertExceptionToString(e.Exception), "Chyba", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            e.Handled = true;
            Shutdown(-1);
        }
Example #2
0
        static void Main(string[] args)
        {
            try
            {
                throw new NotImplementedException();
            }
            catch (Exception exc)
            {
                if (Console.CursorLeft > 0)
                {
                    Console.WriteLine();
                }

                Console.WriteLine(ViewModelCommon.ConvertExceptionToString(exc));
            }
            Console.WriteLine();
            Console.WriteLine("Stiskněte Enter pro ukončení aplikace.");
            Console.ReadLine();
        }
Example #3
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                GameModel.T         model      = ModelException.TryThrow <GameModel.T>(GameModel.tryCreate());
                GameController.T    controller = GameController.create(model);
                MainWindowViewModel viewModel  = new MainWindowViewModel(model);

                MainWindow win = new GUI.MainWindow(viewModel, controller);
                MainWindow = win;
                win.Show();
            }
            catch (Exception exc)
            {
                MessageBox.Show(string.Format("Aplikaci Latrunculi se nepodařilo spustit:{0}{1}", Environment.NewLine, ViewModelCommon.ConvertExceptionToString(exc)),
                                "Chyba", MessageBoxButton.OK, MessageBoxImage.Error);
                Shutdown(-1);
            }
        }