private void OnActivated(object sender, ActivationEventArgs e)
        {
            Execute.OnUIThreadAsync(() =>
            {
                var settings = new Dictionary <string, object>
                {
                    ["ShowCloseButton"]         = false,
                    ["IsCloseButtonEnabled"]    = false,
                    ["ShowMaximizeButton"]      = false,
                    ["IsMaximizeButtonEnabled"] = false,
                    ["ShowMinimizeButton"]      = false,
                    ["IsMinimizeButtonEnabled"] = false,
                };

                var dialogResult = _windowManager.ShowDialog(IoC.Get <ConfigViewModel>(), settings: settings);

                if (dialogResult.HasValue && dialogResult.Value)
                {
                    ActivateItem(IoC.Get <ImgDiffViewModel>());
                }
                else
                {
                    Application.Current.Shutdown(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);
        }
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (Item == null)
                New();

            base.OnActivated(eventArgs);
        }
 private void GMHistoryTicksViewModel_Activated(object sender, ActivationEventArgs e)
 {
     if (App.CurrentInstrument != null)
     {
         Symbol = App.CurrentInstrument.Symbol;
     }
 }
 public void ScopeActivated(object source, ActivationEventArgs e)
 {
     foreach (var actionItem in scopeItems)
     {
         actionItem.Activate();
     }
 }
Exemple #6
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);
        }
Exemple #7
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            IsFxcEnabled      = _shaderExtension.IsFxcEffectProcessorEnabled;
            IsMonoGameEnabled = _shaderExtension.IsMonoGameEffectProcessorEnabled;
            IsXnaEnabled      = _shaderExtension.IsXnaEffectProcessorEnabled;

            base.OnActivated(eventArgs);
        }
Exemple #8
0
        private void OnRootWindowActivated(ActivationEventArgs e)
        {
            var handler = this.RootWindowActivated;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemple #9
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            base.OnActivated(eventArgs);

            if (eventArgs.Opened)
            {
                ActivateNode(SelectedNode);
            }
        }
Exemple #10
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                Theme = _themeExtension.Theme;
            }

            base.OnActivated(eventArgs);
        }
Exemple #11
0
        static void OnActivate(object sender, ActivationEventArgs e)
        {
            Neuron temp = (Neuron)sender;

            if (temp.ID == outputID)
            {
                activationFlag = false;
            }
        }
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                New();
            }

            base.OnActivated(eventArgs);
        }
Exemple #13
0
        private void OnRuleFiring(object sender, ActivationEventArgs args)
        {
            var keys = args.Activation.GetState <ChangeKeys>(KeyName);

            if (keys != null)
            {
                keys.Current = keys.New;
            }
        }
        private void OnDialogActivated(object sender, ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                Log.Add("Dialog opened");
            }

            Log.Add("Dialog activated");
        }
Exemple #15
0
 private void ReportingViewModel_Activated(object sender, ActivationEventArgs e)
 {
     using (var db = new SamContext())
     {
         Classes.Clear();
         var classes = db.Students.GroupBy(student => student.ClassName)
                       .Select(students => students.Key);
         Classes.AddRange(classes);
     }
 }
Exemple #16
0
        private async void RootWindowActivated(object sender, ActivationEventArgs e)
        {
            if (this.toastCts != null)
            {
                this.toastCts.Cancel();
            }

            // Always check on root window activated
            await this.CheckForUpdatesAsync();
        }
Exemple #17
0
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                Options.Set(_textExtension.Options);
                RaisePropertyChanged(() => Font);
            }

            base.OnActivated(eventArgs);
        }
Exemple #18
0
        public override void OnDisabled(DesignCanvas canvas, ActivationEventArgs args)
        {
            base.OnDisabled(canvas, args);

            if (args.ActivationKind != ActivationKind.TemporarySwitch &&
                TryRemoveTrailingOffCurve(canvas.Layer))
            {
                ((App)Application.Current).InvalidateData();
            }
        }
        protected override void OnActivated(ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                Document.RegisterViewModel(this);
                UpdateProperties();
                PropertyChangedEventManager.AddHandler(Document, OnDocumentPropertyChanged, string.Empty);
            }

            base.OnActivated(eventArgs);
        }
        private void OnWindowActivated(object sender, ActivationEventArgs eventArgs)
        {
            if (eventArgs.Opened)
            {
                Log.Add("Window opened");
            }

            Log.Add("Window activated");

            RefreshButtons();
        }
Exemple #21
0
        private async void RootWindowActivated(object sender, ActivationEventArgs e)
        {
            if (this.toastCts != null)
            {
                this.toastCts.Cancel();
            }

            if (this.UpdateCheckDue())
            {
                await this.CheckForUpdatesAsync();
            }
        }
        private void RootViewModelActivated(object sender, ActivationEventArgs e)
        {
            // If it's minimize to tray, not close to tray, then we'll have set the shutdown mode to OnExplicitShutdown just before closing
            // In this case, re-set Shutdownmode
            this.SetShutdownMode();

            this.viewModel.MainWindowVisible = true;
            if (this.ShowOnlyOnClose)
            {
                this.viewModel.Visible = false;
            }
        }
Exemple #23
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);
        }
        /// <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);
        }
        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);
        }
Exemple #26
0
        protected override void OnActivated(ActivationEventArgs e)
        {
            if (!IsActive())
            {
                base.OnActivated(e);

                var editbox = GetEditbox();

                if (!editbox.IsActive())
                {
                    editbox.Activate();
                }
            }
        }
Exemple #27
0
        private async void MainViewModel_Activated(object sender, ActivationEventArgs e)
        {
            await Task.Yield();

            /*
             * var tab = new IrcTabViewModel() {DisplayName = "Root"};
             * tab.AddChild(new IrcTabViewModel() {DisplayName = "Child"});
             * tab.AddChild(new IrcTabViewModel() {DisplayName = "Child2"});
             * ActivateItem(tab);
             * tab = new IrcTabViewModel() {DisplayName = "Root2"};
             * tab.AddChild(new IrcTabViewModel() {DisplayName = "2Child"});
             * ActivateItem(tab);
             */
        }
Exemple #28
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);
            }
        }
Exemple #29
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);
        }
Exemple #30
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();
            }
        }