예제 #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);
        }
예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #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;
        }
예제 #5
0
파일: Find.cs 프로젝트: tonley/TreeWriter
        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);
                }
            }
        }
예제 #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();
                    }
                }
            }
        }