protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
                New();

            base.OnActivated(eventArgs);
        }
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (Item == null)
                New();

            base.OnActivated(eventArgs);
        }
Ejemplo n.º 3
0
        private void OnDialogActivated(object sender, ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
                Log.Add("Dialog opened");

            Log.Add("Dialog activated");
        }
Ejemplo n.º 4
0
 private void OnEditorActivated(object sender, ActivationEventArgs eventArgs)
 {
     AddCommandBindings();
     Editor.Activated -= OnEditorActivated;
 }
Ejemplo n.º 5
0
        private void OnEditorActivated(object sender, ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                Editor.Activated -= OnEditorActivated;

                // Load EditorWindow state.
                LoadEditorWindowState();

                // Check if a layout was requested using the --layout command line parameter.
                var layoutName = GetLayoutNameFromCommandLine();
                WindowLayout layout = null;
                if (layoutName != null)
                {
                    layout = Layouts.FirstOrDefault(l => l.Name == layoutName);
                    if (layout == null)
                        Logger.Error(Invariant($"The layout \"{layoutName}\" was not found. This layout was requested using a command line parameter."));
                }

                if (layout == null)
                {
                    // Load previous window layout.
                    layout = Layouts.FirstOrDefault(l => l.Name == Settings.Default.ActiveWindowLayout)
                             ?? Layouts.FirstOrDefault();
                }
                SwitchLayout(layout);

                if (Editor.Window != null)
                {
                    // Save EditorWindow state and window layout before window is closed.
                    Editor.Window.Closing += (s, e) =>
                                             {
                                                 SaveEditorWindowState();
                                                 SaveLayouts();
                                             };
                }
            }
        }
Ejemplo n.º 6
0
 private void OnEditorActivated(object sender, ActivationEventArgs eventArgs)
 {
     Editor.Activated -= OnEditorActivated;
     AddQuickLaunchItems();
 }
Ejemplo n.º 7
0
 /// <inheritdoc/>
 protected override void OnActivated(ActivationEventArgs eventArgs)
 {
     Items.OfType<IActivatable>().ForEach(item => item.OnActivate());
     base.OnActivated(eventArgs);
 }
Ejemplo n.º 8
0
        private void OnWindowActivated(object sender, ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
                Log.Add("Window opened");

            Log.Add("Window activated");

            RefreshButtons();
        }
Ejemplo n.º 9
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            IsFxcEnabled = _shaderExtension.IsFxcEffectProcessorEnabled;
            IsMonoGameEnabled = _shaderExtension.IsMonoGameEffectProcessorEnabled;
            IsXnaEnabled = _shaderExtension.IsXnaEffectProcessorEnabled;

            base.OnActivated(eventArgs);
        }
Ejemplo n.º 10
0
        /// <inheritdoc/>
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            base.OnActivated(eventArgs);

            // Activate all selected items.
            this.GetDockElements()
                .OfType<IDockTabPane>()
                .Where(dockTabPane => dockTabPane.IsVisible)
                .Select(dockTabPane => dockTabPane.SelectedItem)
                .OfType<IActivatable>()
                .ForEach(activatable => activatable.OnActivate());

            if (eventArgs.Opened)
            {
                // Note: Some extensions register command bindings when in 
                // EditorViewModel.Activated. Therefore, base.OnActivate must be called before this.
                UpdateInputAndCommandBindings();
            }
        }
Ejemplo n.º 11
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                // We cannot do this in the ctor because the output view model is created before
                // all other services are registered.
                // --> To improve this, let the OutputExtension implement IOutputService.
                // Or do not register an instance in the service container - only the type which is
                // then created by the service container on-demand.

                // We can use the context menu of the text service, but then we also have menu items
                // for syntax highlighting and formatting.
                //TextContextMenu = _editor?.Services.GetInstance<ITextService>()?.ContextMenu;

                var commandExtension = _editor.Extensions.OfType<CommandExtension>().ThrowIfMissing().First();
                TextContextMenu = new MenuItemViewModelCollection
                {
                    commandExtension.CommandItems["Cut"].CreateMenuItem(),
                    commandExtension.CommandItems["Copy"].CreateMenuItem(),
                    commandExtension.CommandItems["Paste"].CreateMenuItem(),
                    commandExtension.CommandItems["Delete"].CreateMenuItem(),
                    new CommandSeparator("ClipboardSeparator").CreateMenuItem(),
                    commandExtension.CommandItems["SelectAll"].CreateMenuItem(),
                    new CommandSeparator("SelectSeparator").CreateMenuItem()
                };
            }

            base.OnActivated(eventArgs);
        }
Ejemplo n.º 12
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            base.OnActivated(eventArgs);

            if (eventArgs.Opened)
                ActivateNode(SelectedNode);
        }
Ejemplo n.º 13
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                Options.Set(_textExtension.Options);
                RaisePropertyChanged(() => Font);
            }

            base.OnActivated(eventArgs);
        }
Ejemplo n.º 14
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                // Initialize graphics screens.
                var graphicsService = _editor.Services.GetInstance<IGraphicsService>().ThrowIfMissing();
                GraphicsScreens = new GraphicsScreen[]
                {
                    new TriangleGraphicsScreen(graphicsService),
                    new DebugGraphicsScreen(_editor.Services) { ShowTitleSafeArea = true }
                };
            }

            base.OnActivated(eventArgs);
        }
Ejemplo n.º 15
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                // Initialize timer.
                _timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(200) };
                _timer.Tick += OnTimerTick;
            }

            UpdateTimer();
            base.OnActivated(eventArgs);
        }
Ejemplo n.º 16
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
                Theme = _themeExtension.Theme;

            base.OnActivated(eventArgs);
        }
Ejemplo n.º 17
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                Document.RegisterViewModel(this);
                UpdateProperties();
                PropertyChangedEventManager.AddHandler(Document, OnDocumentPropertyChanged, string.Empty);
            }

            base.OnActivated(eventArgs);
        }
Ejemplo n.º 18
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                _gameExtension = Document.Editor.Extensions.OfType<GameExtension>().FirstOrDefault().ThrowIfMissing();
                _gameExtension.GameLogicUpdating += OnGameLogicUpdating;

                Document.PropertyChanged += OnDocumentPropertyChanged;
                Initialize();
            }

            base.OnActivated(eventArgs);
        }
Ejemplo n.º 19
0
        private async void OnEditorActivated(object sender, ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                AddCommandBindings();

                // Enable drag-drop.
                Editor.Window.DragEnter += OnDragEnter;
                Editor.Window.Drop += OnDrop;
                Editor.Window.AllowDrop = true;

                // Load files specified at command-line.
                await OpenFromCommandLineAsync(Editor.CommandLineResult);
            }
        }
Ejemplo n.º 20
0
        /// <inheritdoc/>
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            Logger.Debug("Activating {0} (\"{1}\").", GetType().Name, DisplayName);

            // If the user does not set a context menu, we use the default context menu defined
            // in the editor.
            if (DockContextMenu == null)
                DockContextMenu = (Conductor as EditorViewModel)?.DockContextMenu;

            base.OnActivated(eventArgs);
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Raises the <see cref="Activated"/> event.
 /// </summary>
 /// <param name="eventArgs">
 /// <see cref="ActivationEventArgs"/> object that provides the arguments for the event.
 /// </param>
 /// <remarks>
 /// <strong>Notes to Inheritors:</strong> When overriding <see cref="OnActivated"/> in a
 /// derived class, be sure to call the base class's <see cref="OnActivated"/> method so that
 /// registered delegates receive the event.
 /// </remarks>
 protected virtual void OnActivated(ActivationEventArgs eventArgs)
 {
     Activated?.Invoke(this, eventArgs);
 }
Ejemplo n.º 22
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                if (Categories == null)
                {
                    // Get all command items.
                    var items = _editor.Extensions
                                       .SelectMany(extension => extension.CommandItems)
                                       .OfType<CommandItem>()
                                       .ToList();

                    // Sort and group into "All" category.
                    var all = items.OrderBy(item => EditorHelper.FilterAccessKeys(item.Text))
                                   .GroupBy(item => "All");

                    // Sort and group by category.
                    var categories = items.OrderBy(item => item.Category)
                                          .ThenBy(item => EditorHelper.FilterAccessKeys(item.Text))
                                          .GroupBy(item => item.Category);

                    Categories = all.Concat(categories)
                                    .ToArray();

                    SelectedCategory = Categories.FirstOrDefault(group => group.Key == "File")
                                       ?? Categories.FirstOrDefault();
                }
            }

            base.OnActivated(eventArgs);
        }
Ejemplo n.º 23
0
 /// <inheritdoc/>
 protected override void OnActivated(ActivationEventArgs eventArgs)
 {
     (Item as IActivatable)?.OnActivate();
     base.OnActivated(eventArgs);
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Raises the <see cref="Activated"/> event.
 /// </summary>
 /// <param name="eventArgs">
 /// <see cref="ActivationEventArgs"/> object that provides the arguments for the event.
 /// </param>
 /// <remarks>
 /// <strong>Notes to Inheritors:</strong> When overriding <see cref="OnActivated"/> in a
 /// derived class, be sure to call the base class's <see cref="OnActivated"/> method so that
 /// registered delegates receive the event.
 /// </remarks>
 protected virtual void OnActivated(ActivationEventArgs eventArgs)
 {
     Activated?.Invoke(this, eventArgs);
 }
Ejemplo n.º 25
0
 /// <inheritdoc/>
 protected override void OnActivated(ActivationEventArgs eventArgs)
 {
     (Item as IActivatable)?.OnActivate();
     base.OnActivated(eventArgs);
 }
Ejemplo n.º 26
0
 /// <inheritdoc/>
 protected override void OnActivated(ActivationEventArgs eventArgs)
 {
     Items.OfType <IActivatable>().ForEach(item => item.OnActivate());
     base.OnActivated(eventArgs);
 }