Esempio n. 1
0
        public MainWindow()
        {
            UIThread.Initialize(this.Dispatcher, false);

            this.Closing            += MainWindow_Closing;
            this.Loaded             += MainWindow_Loaded;
            this.DataContextChanged += MainWindow_DataContextChanged;
            this.AllowDrop           = true;
            this.Drop += MainWindow_Drop;
            this.FocusOnFindControlCommand = new RelayCommand(FocusOnFindControlCommand_Executed);
            this.ResetFocusCommand         = new RelayCommand(ResetFocusCommand_Executed);
            this.FoldLevelCommand          = new RelayCommand <string>(l => FoldSections(l, true));
            this.UnFoldLevelCommand        = new RelayCommand <string>(l => FoldSections(l, false));

            InitializeComponent();

            this.AvalonEditor.PreviewKeyDown           += AvalonEditor_PreviewKeyDown;
            this.AvalonEditor.TextArea.DocumentChanged += TextArea_DocumentChanged;
            this.AvalonEditor.TextArea.TextView.LineTransformers.Add(new AllSelectionColorizer(this.AvalonEditor, this.ViewModel.Settings));
            this.AvalonEditor.TextArea.SelectionChanged      += (sender, args) => this.AvalonEditor.TextArea.TextView.Redraw();
            this.AvalonEditor.TextArea.Caret.PositionChanged += AvalonEditor_CaretPositionChanged;
            this.AvalonEditor.TextChanged += AvalonEditor_TextChanged;

            this.FoldingManager  = FoldingManager.Install(this.AvalonEditor.TextArea);
            this.FoldingStrategy = new XmlFoldingStrategy();

            this.IgnoreNextTextChange = false;
            SetWindowGlow();
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            UIThread.Initialize(SynchronizationContext.Current);

            AttachEventHandlers();

            return;


            /// Local Functions



            void AttachEventHandlers()
            {
                UnhandledException += OnUnhandledException;
                TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
                Suspending += OnSuspending;
#if DEBUG
                DebugSettings.BindingFailed += OnBindingFailed;
#endif
            }
        }