示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        public MainWindow()
        {
            this.InitializeComponent();

            // Check if the argument list includes a store to open.
            // First arg is this exe's filename, second arg (if it exists) is the store to open
            var    args     = Environment.GetCommandLineArgs();
            string filename = null;

            if (args.Length > 1)
            {
                filename = args[1];
            }

            this.Loaded += (s, e) => this.Activate();

            this.context.VisualizationContainer = new VisualizationContainer();
            this.context.VisualizationContainer.Navigator.ViewRange.SetRange(DateTime.UtcNow, TimeSpan.FromSeconds(60));

            // register an async handler to load the current layout once the main window has finished loading
            this.Loaded += this.MainWindow_Loaded;

            if (!string.IsNullOrWhiteSpace(filename))
            {
                // register an async handler to open the dataset once the main window has finished loading
                this.Loaded += async(s, e) => await this.context.OpenDatasetAsync(filename);
            }

            this.DataContext = this.context;

            PipelineDiagnosticsVisualizationModel.RegisterKnownSerializationTypes(); // necessary for .NET Core types
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        public MainWindow()
        {
            this.InitializeComponent();

            // Create the context
            MainWindowViewModel viewModel = new MainWindowViewModel();

            // Create the visualization container and set the navigator range to an arbitrary default
            VisualizationContext visualizationContext = VisualizationContext.Instance;

            visualizationContext.VisualizationContainer = new VisualizationContainer();
            visualizationContext.VisualizationContainer.Navigator.ViewRange.SetRange(DateTime.UtcNow, TimeSpan.FromSeconds(60));

            // Set the values for the timing buttons on the navigator
            visualizationContext.VisualizationContainer.Navigator.ShowAbsoluteTiming = viewModel.AppSettings.ShowAbsoluteTiming;
            visualizationContext.VisualizationContainer.Navigator.ShowTimingRelativeToSessionStart   = viewModel.AppSettings.ShowTimingRelativeToSessionStart;
            visualizationContext.VisualizationContainer.Navigator.ShowTimingRelativeToSelectionStart = viewModel.AppSettings.ShowTimingRelativeToSelectionStart;

            // Set the data context
            this.DataContext = viewModel;

            // Register the known serializers, this is necessary for some .NET Core types
            PipelineDiagnosticsVisualizationModel.RegisterKnownSerializationTypes();
        }