Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            Dispatcher.UnhandledException += (object sender, DispatcherUnhandledExceptionEventArgs e) =>
            {
                _log.Error(e.Exception.ToString());
                _log.WriteLog();
            };

            _log = new RiZhi()
            {
                FilePrefix = "ReplayBookLog"
            };

            _settingsManager = new SettingsManager(_log);

            _files    = new FileManager(_settingsManager.Settings, _log);
            _requests = new RequestManager(_settingsManager.Settings, _log);

            var context = new MainWindowViewModel(_files, _requests, _settingsManager, _log);

            this.DataContext = context;

            var version = Assembly.GetEntryAssembly()?.GetName().Version.ToString(2);

            _log.Error($"Log files are generated for each run while in prerelease. Prerelease version: {version}");

            // Decide to show welcome window
            context.ShowWelcomeWindow();
            context.ShowMissingReplayFoldersMessageBox();
        }
Ejemplo n.º 2
0
        public MainWindow(RiZhi log, SettingsManager settingsManager, RequestManager requests, FileManager files, ReplayPlayer player)
        {
            InitializeComponent();

            _log             = log;
            _settingsManager = settingsManager;
            _requests        = requests;
            _files           = files;
            _player          = player;

            _lastSelection = null;

            Dispatcher.UnhandledException += (object sender, DispatcherUnhandledExceptionEventArgs e) =>
            {
                _log.Error(e.Exception.ToString());
                _log.WriteLog();
            };

            var context = new MainWindowViewModel(_files, _requests, _settingsManager, _player, _log);

            this.DataContext = context;

            // Decide to show welcome window
            context.ShowWelcomeWindow();
            context.ShowMissingReplayFoldersMessageBox();
        }
Ejemplo n.º 3
0
        private void CreateCommonObjects()
        {
            // Create common objects
            var assemblyName = Assembly.GetEntryAssembly()?.GetName();

            _log = new RiZhi()
            {
                FilePrefix      = "ReplayBookLog",
                AssemblyName    = assemblyName.Name,
                AssemblyVersion = assemblyName.Version.ToString(2)
            };

            try
            {
                _settingsManager = new SettingsManager(_log);
                _files           = new FileManager(_settingsManager.Settings, _log);
                _requests        = new RequestManager(_settingsManager.Settings, _log);
                _player          = new ReplayPlayer(_files, _settingsManager, _log);
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
                _log.WriteLog();
                throw;
            }
        }
Ejemplo n.º 4
0
 private void Application_Exit(object sender, ExitEventArgs e)
 {
     if (_log.ErrorFlag)
     {
         _log.WriteLog();
     }
 }
Ejemplo n.º 5
0
        public static void Main(string[] args)
        {
            var log = new RiZhi
            {
                FilePrefix      = "ExampleApp",
                AssemblyVersion = "1.0.0",
                AssemblyName    = "Example Program"
            };

            log.Debug("Debug message, appears first");
            log.Information("Information message, appears second");
            log.Warning($"Warning message, appears third. Error Flag = {log.ErrorFlag}");
            log.Error("Error message, appears fourth");

            if (log.ErrorFlag)
            {
                log.Debug($"Error was logged");
            }

            log.WriteLog();
        }