/// <summary> /// Handles the Executed event of the ViewAnalyticsCommandBinding control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ExecutedRoutedEventArgs"/> instance containing the event data.</param> private void ViewAnalyticsCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { if (this._analytics == null || !this._analytics.IsVisible) { this._analytics = new AnalyticsWindow(); } this._analytics.ShowActivated = true; this._analytics.Show(); if (this._analytics.WindowState == WindowState.Minimized) { this._analytics.WindowState = WindowState.Normal; } this._analytics.Focus(); }
static void Init() { // Get existing open window or if none, make a new one: AnalyticsWindow window = (AnalyticsWindow)EditorWindow.GetWindow(typeof(AnalyticsWindow)); // Listen for updates - use this if you want real time graphs // if (EditorApplication.update != window.EditorUpdate) EditorApplication.update += window.EditorUpdate; // Listen for moves window.wantsMouseMove = true; // Create a style which loads a background image window.boxStyle = new GUIStyle(); window.boxStyle.normal.background = (Texture2D)Resources.Load("Border", typeof(Texture2D)); window.boxStyle.border = new RectOffset(32, 32, 32, 32); window.boxStyle.margin = new RectOffset(4, 4, 4, 4); window.Focus(); }