Exemple #1
0
        IDockContent DeserializeDockContent(string persistString)
        {
            var openCommand = new Commands.OpenPath(persistString, Commands.OpenCommand.OpenStyles.InitialLoad);

            openCommand.Execute(ProjectModel, this);
            if (openCommand.Panel != null)
            {
                openCommand.Panel.InvokeCommand += ProcessControllerCommand;
            }
            return(openCommand.Panel);
        }
Exemple #2
0
        private int TotalDocument(String Path, Model Model, Main View)
        {
            var openCommand = new Commands.OpenPath(Path, Commands.OpenCommand.OpenStyles.Transient);

            openCommand.Execute(Model, View);
            if (openCommand.Document != null)
            {
                return(openCommand.Document.CountWords(Model, View));
            }
            else
            {
                return(0);
            }
        }
Exemple #3
0
        public void Execute(Model Model, Main View)
        {
            var openCommand = new OpenPath(Path, OpenCommand.OpenStyles.Transient);

            openCommand.Execute(Model, View);
            if (openCommand.Document != null)
            {
                Count = openCommand.Document.CountWords(Model, View);
                System.Windows.Forms.MessageBox.Show(String.Format("{0} words", Count),
                                                     "Word count", System.Windows.Forms.MessageBoxButtons.OK);
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Error", "Word count",
                                                     System.Windows.Forms.MessageBoxButtons.OK);
            }
        }
Exemple #4
0
        public override void Load(Model Model, Main View, string Path)
        {
            this.Path = Path;
            var split      = ParsePathParts(Path);
            var openParent = new Commands.OpenPath(split[0], Commands.OpenCommand.OpenStyles.CreateView);

            openParent.Execute(Model, View);
            if (!openParent.Succeeded)
            {
                throw new InvalidOperationException();
            }
            if (openParent.Document == null)
            {
                throw new InvalidOperationException();
            }
            ParentDocument = openParent.Document;
        }
Exemple #5
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= dataGridView1.Rows.Count)
            {
                return;
            }
            var position    = dataGridView1.Rows[e.RowIndex].Tag as TextPosition;
            var openCommand = new Commands.OpenPath(position.Path, Commands.OpenCommand.OpenStyles.CreateView);

            InvokeCommand(openCommand);
            if (openCommand.Succeeded && openCommand.Document != null)
            {
                var textEditor = openCommand.Document.OpenEditors.FirstOrDefault(d => d is TextDocumentEditor) as TextDocumentEditor;
                if (textEditor != null)
                {
                    textEditor.SetCursorAndScroll(position.Place);
                }
            }
        }
Exemple #6
0
        private void listView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var item = listView.GetItemAt(e.Location.X, e.Location.Y);

            if (item != null)
            {
                var position    = item.Tag as NotePosition;
                var openCommand = new Commands.OpenPath(position.Path,
                                                        Commands.OpenCommand.OpenStyles.CreateView);
                InvokeCommand(openCommand);
                if (openCommand.Succeeded && openCommand.Document != null)
                {
                    var textEditor = openCommand.Document.OpenEditors.FirstOrDefault(d => d is TextDocumentEditor) as TextDocumentEditor;
                    if (textEditor != null)
                    {
                        textEditor.SetCursorAndScroll(position.Place);
                        textEditor.Focus();
                    }
                }
            }
        }