Beispiel #1
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            Exit  = new DelegateCommand(ee => Close());
            About = new DelegateCommand(
                ee =>
            {
                var about = new AboutWindow(this);
                about.ShowDialog();
            });

            Add             = new DelegateCommand(AddNewListenerAction, b => tabControl.Items.Count < 1);
            ShowPreferences = new DelegateCommand(ShowPreferencesAction);
            ExportLogs      = new DelegateCommand(ExportLogsAction, b => tabControl.Items.Count > 0);
            SaveSession     = new DelegateCommand(SaveSessionAction);
            NewSession      = new DelegateCommand(NewSessionAction);
            LoadSession     = new DelegateCommand(LoadSessionAction);
            RecentFiles     = new ObservableCollection <string>(recentFilePathList.Take(13));

            BindViewToViewModel();

            var commandLine = Environment.GetCommandLineArgs();

            if (UpgradeService != null)
            {
                // Determine whether anything passed on the command line, limited options
                // may be supplied and they will suppress the prompting of the new listener wizard.
                commandLine = UpgradeService.ParseCommandLine(commandLine);
            }

            if (commandLine.Length == 1)
            {
                Add.Execute(null);
            }
            else
            {
                ProcessCommandLine(commandLine.Skip(1));
            }

            // Debug the available loggers.
            var logManager = ServiceLocator.Instance.Get <Logs.Interfaces.ILogManager>();

            foreach (var logger in logManager)
            {
                Log.DebugFormat("Log: {0}", logger.Name);
            }

            var providerManager = ServiceLocator.Instance.Get <IProviderManager>();

            foreach (var instance in providerManager.Instances)
            {
                Log.DebugFormat("Provider: {0}", instance.Name);
                Log.DebugFormat("   - is {0}active", instance.IsActive ? string.Empty : "not ");
                Log.DebugFormat("   - logger = {0}", instance.Logger);
            }

            // Provide the upgrade service with a Dispatcher for the main UI thread
            // which is needed for providing UI updates.
            if (UpgradeService != null)
            {
                UpgradeService.DispatcherUiThread = Dispatcher;
            }
        }
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            Exit = new DelegateCommand(ee => Close());
            About = new DelegateCommand(ee =>
            {
                var about = new AboutWindow(this);
                about.ShowDialog();
            });

            Add = new DelegateCommand(AddNewListenerAction, b => tabControl.Items.Count < 1);
            ShowPreferences = new DelegateCommand(ShowPreferencesAction);
            ExportLogs = new DelegateCommand(ExportLogsAction, b => tabControl.Items.Count > 0);
            SaveSession = new DelegateCommand(SaveSessionAction);
            NewSession = new DelegateCommand(NewSessionAction);
            LoadSession = new DelegateCommand(LoadSessionAction);
            RecentFiles = new ObservableCollection<string>(recentFilePathList.Take(13));

            BindViewToViewModel();

            // Determine whether anything passed on the command line, limited options
            // may be supplied and they will suppress the prompting of the new listener wizard.
            var commandLine = Environment.GetCommandLineArgs();
            if (commandLine.Length == 1)
            {
                Add.Execute(null);
            }
            else
            {
                ProcessCommandLine(commandLine.Skip(1));
            }

            // Debug the available loggers.
            var logManager = ServiceLocator.Instance.Get<Logs.Interfaces.ILogManager>();
            foreach (var logger in logManager)
            {
                log.DebugFormat("Log: {0}", logger.Name);
            }

            var providerManager = ServiceLocator.Instance.Get<IProviderManager>();
            foreach (var instance in providerManager.GetInstances())
            {
                log.DebugFormat("Provider: {0}", instance.Name);
                log.DebugFormat("   - is {0}active", instance.IsActive ? string.Empty : "not ");
                log.DebugFormat("   - logger = {0}", instance.Logger);
            }
        }