Пример #1
0
 protected virtual void OnFileOpening(FileOpeningEventArgs e)
 {
     if (FileOpening != null)
     {
         FileOpening.Invoke(this, e);
     }
 }
Пример #2
0
        public EditorWinForm()
        {
            InitializeComponent();

            var host = new ElementHost();

            host.Size     = new Size(200, 100);
            host.Location = new Point(100, 100);
            host.Dock     = DockStyle.Fill;

            _extEditor              = new ExtendedEditor();
            _extEditor.Host         = this;
            _extEditor.FileOpening += (s, e) =>
            {
                if (FileOpening != null)
                {
                    FileOpening.Invoke(this, e);
                }
            };

            var editor = _extEditor.editor;

            editor.FontFamily = _fixedWidth;
            editor.FontSize   = 12.0;
            editor.Options.ConvertTabsToSpaces        = true;
            editor.Options.EnableRectangularSelection = true;
            editor.Options.IndentationSize            = 2;
            editor.ShowLineNumbers = true;
            editor.TextArea.MouseRightButtonDown += TextArea_MouseRightButtonDown;
            editor.TextArea.PreviewKeyDown       += TextArea_PreviewKeyDown;
            editor.TextArea.TextEntering         += TextArea_TextEntering;
            editor.TextArea.TextEntered          += TextArea_TextEntered;
            editor.TextArea.KeyDown                     += TextArea_KeyDown;
            editor.TextArea.TextView.MouseHover         += TextView_MouseHover;
            editor.TextArea.TextView.MouseHoverStopped  += TextView_MouseHoverStopped;
            editor.TextArea.TextView.VisualLinesChanged += TextView_VisualLinesChanged;
            editor.TextArea.SelectionChanged            += TextArea_SelectionChanged;
            editor.TextArea.Caret.PositionChanged       += Caret_PositionChanged;
            editor.TextChanged += editor_TextChanged;

            host.Child = _extEditor;

            editor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();

            this.Controls.Add(host);

            BindToolStripItem(mniCut, System.Windows.Input.ApplicationCommands.Cut);
            BindToolStripItem(mniCopy, System.Windows.Input.ApplicationCommands.Copy);
            BindToolStripItem(mniPaste, System.Windows.Input.ApplicationCommands.Paste);
        }
Пример #3
0
        public void OpenFile(string filePath)
        {
            if (IsFileOpen)
            {
                CloseFile();
            }

            FileOpening?.Invoke(this, new FileOpeningEventArgs(filePath));

            this.filePath = filePath;

            using (var stream = File.OpenRead(filePath))
            {
                this.memory = Memory.CreateFromStream(stream);
            }

            FileOpened?.Invoke(this, new FileOpenedEventArgs(filePath));
        }
Пример #4
0
 /// <summary>
 /// The OnFileOpening
 /// </summary>
 /// <param name="e">The e<see cref="OpeningEventArgs"/></param>
 protected virtual void OnFileOpening(OpeningEventArgs e)
 {
     FileOpening?.Invoke(this, e);
 }
Пример #5
0
 private void OnFileOpening(string path)
 {
     Log.InfoF("Opening file{0}...", (path != null) ? $": {path}" : "");
     FileOpening?.Invoke(this, path);
 }