private DummyDoc CreateNewDocument(string text)
        {
            DummyDoc dummyDoc = new DummyDoc();

            dummyDoc.Text = text;
            return(dummyDoc);
        }
Exemple #2
0
        private void menuItemLayoutByCode_Click(object sender, System.EventArgs e)
        {
            dockPanel.SuspendLayout(true);

            CloseAllContents();

            CreateStandardControls();

            m_solutionExplorer.Show(dockPanel, DockState.DockRight);
            m_propertyWindow.Show(m_solutionExplorer.Pane, m_solutionExplorer);
            m_toolbox.Show(dockPanel, new Rectangle(98, 133, 200, 383));
            m_outputWindow.Show(m_solutionExplorer.Pane, DockAlignment.Bottom, 0.35);
            m_taskList.Show(m_toolbox.Pane, DockAlignment.Left, 0.4);

            DummyDoc doc1 = CreateNewDocument("Document1");
            DummyDoc doc2 = CreateNewDocument("Document2");
            DummyDoc doc3 = CreateNewDocument("Document3");
            DummyDoc doc4 = CreateNewDocument("Document4");

            doc1.Show(dockPanel, DockState.Document);
            doc2.Show(doc1.Pane, null);
            doc3.Show(doc1.Pane, DockAlignment.Bottom, 0.5);
            doc4.Show(doc3.Pane, DockAlignment.Right, 0.5);

            dockPanel.ResumeLayout(true, true);
        }
Exemple #3
0
        private void menuItemOpen_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.InitialDirectory = Application.ExecutablePath;
            openFile.Filter           = "rtf files (*.rtf)|*.rtf|txt files (*.txt)|*.txt|All files (*.*)|*.*";
            openFile.FilterIndex      = 1;
            openFile.RestoreDirectory = true;

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                string fullName = openFile.FileName;
                string fileName = Path.GetFileName(fullName);

                if (FindDocument(fileName) != null)
                {
                    MessageBox.Show("The document: " + fileName + " has already opened!");
                    return;
                }

                DummyDoc dummyDoc = new DummyDoc();
                dummyDoc.Text = fileName;
                dummyDoc.Show(dockPanel);
                try {
                    dummyDoc.FileName = fullName;
                } catch (Exception exception) {
                    dummyDoc.Close();
                    MessageBox.Show(exception.Message);
                }
            }
        }
        private IDockContent GetContentFromPersistString(string persistString)
        {
            if (persistString == typeof(DummySolutionExplorer).ToString())
            {
                return(m_solutionExplorer);
            }
            else if (persistString == typeof(DummyPropertyWindow).ToString())
            {
                return(m_propertyWindow);
            }
            else if (persistString == typeof(DummyToolbox).ToString())
            {
                return(m_toolbox);
            }
            else if (persistString == typeof(DummyOutputWindow).ToString())
            {
                return(m_outputWindow);
            }
            else if (persistString == typeof(DummyTaskList).ToString())
            {
                return(m_taskList);
            }
            else
            {
                // DummyDoc overrides GetPersistString to add extra information into persistString.
                // Any DockContent may override this value to add any needed information for deserialization.

                string[] parsedStrings = persistString.Split(new char[] { ',' });
                if (parsedStrings.Length != 3)
                {
                    return(null);
                }

                if (parsedStrings[0] != typeof(DummyDoc).ToString())
                {
                    return(null);
                }

                DummyDoc dummyDoc = new DummyDoc();
                if (parsedStrings[1] != string.Empty)
                {
                    dummyDoc.FileName = parsedStrings[1];
                }
                if (parsedStrings[2] != string.Empty)
                {
                    dummyDoc.Text = parsedStrings[2];
                }

                return(dummyDoc);
            }
        }
        private void menuItemNew_Click(object sender, System.EventArgs e)
        {
            DummyDoc dummyDoc = CreateNewDocument();

            if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
            {
                dummyDoc.MdiParent = this;
                dummyDoc.Show();
            }
            else
            {
                dummyDoc.Show(dockPanel);
            }
        }
Exemple #6
0
		private DummyDoc CreateNewDocument() {
			DummyDoc dummyDoc = new DummyDoc();

			int count = 1;
			//string text = "C:\\MADFDKAJ\\ADAKFJASD\\ADFKDSAKFJASD\\ASDFKASDFJASDF\\ASDFIJADSFJ\\ASDFKDFDA" + count.ToString();
			string text = "Document" + count.ToString();
			while( FindDocument( text ) != null ) {
				count++;
				//text = "C:\\MADFDKAJ\\ADAKFJASD\\ADFKDSAKFJASD\\ASDFKASDFJASDF\\ASDFIJADSFJ\\ASDFKDFDA" + count.ToString();
				text = "Document" + count.ToString();
			}
			dummyDoc.Text = text;
			return dummyDoc;
		}
Exemple #7
0
        private DummyDoc CreateNewDocument()
        {
            DummyDoc dummyDoc = new DummyDoc();

            int count = 1;
            string text = "Document " + count.ToString();
            while (FindDocument(text) != null)
            {
                ++count;
                text = "Document " + count.ToString();
            }
            dummyDoc.Text = text;
            return dummyDoc;
        }
Exemple #8
0
        private IDockContent GetContentFromPersistString(string persistString)
        {
            if (persistString == typeof(DummySolutionExplorer).ToString())
            {
                return(m_solutionExplorer);
            }
            else if (persistString == typeof(DummyPropertyWindow).ToString())
            {
                return(m_propertyWindow);
            }
            else if (persistString == typeof(DummyToolbox).ToString())
            {
                return(m_toolbox);
            }
            else if (persistString == typeof(DummyOutputWindow).ToString())
            {
                return(m_outputWindow);
            }
            else if (persistString == typeof(DummyTaskList).ToString())
            {
                return(m_taskList);
            }
            else
            {
                string[] parsedStrings = persistString.Split(new char[] { ',' });
                if (parsedStrings.Length != 3)
                {
                    return(null);
                }

                if (parsedStrings[0] != typeof(DummyDoc).ToString())
                {
                    return(null);
                }

                DummyDoc dummyDoc = new DummyDoc();
                if (parsedStrings[1] != string.Empty)
                {
                    dummyDoc.FileName = parsedStrings[1];
                }
                if (parsedStrings[2] != string.Empty)
                {
                    dummyDoc.Text = parsedStrings[2];
                }

                return(dummyDoc);
            }
        }
Exemple #9
0
        private DummyDoc CreateNewDocument()
        {
            DummyDoc dummyDoc = new DummyDoc();

            int    count = 1;
            string text  = $"Document{count}";

            while (FindDocument(text) != null)
            {
                count++;
                text = $"Document{count}";
            }

            dummyDoc.Text = text;
            return(dummyDoc);
        }
        private DummyDoc CreateNewDocument()
        {
            DummyDoc dummyDoc = new DummyDoc();

            int count = 1;
            //string text = "C:\\MADFDKAJ\\ADAKFJASD\\ADFKDSAKFJASD\\ASDFKASDFJASDF\\ASDFIJADSFJ\\ASDFKDFDA" + count.ToString();
            string text = "Document" + count.ToString();

            while (FindDocument(text) != null)
            {
                count++;
                //text = "C:\\MADFDKAJ\\ADAKFJASD\\ADFKDSAKFJASD\\ASDFKASDFJASDF\\ASDFIJADSFJ\\ASDFKDFDA" + count.ToString();
                text = "Document" + count.ToString();
            }
            dummyDoc.Text = text;
            return(dummyDoc);
        }
Exemple #11
0
        private DummyDoc CreateNewDocument()
        {
            DummyDoc dummyDoc = new DummyDoc();

            dummyDoc.DefaultText = "<?xml version=\"1.0\"?>\r\n<page>\r\n\t\r\n</page>\r\n</xml>";

            int    count = 1;
            string text  = "Document" + count.ToString();

            while (FindDocument(text) != null)
            {
                count++;
                text = "Document" + count.ToString();
            }
            dummyDoc.TabText = text;
            dummyDoc.Text    = text;

            return(dummyDoc);
        }
Exemple #12
0
		private DummyDoc CreateNewDocument( string text ) {
			DummyDoc dummyDoc = new DummyDoc();
			dummyDoc.Text = text;
			return dummyDoc;
		}
Exemple #13
0
		private IDockContent GetContentFromPersistString( string persistString ) {
			if( persistString == typeof( DummySolutionExplorer ).ToString() )
				return m_solutionExplorer;
			else if( persistString == typeof( DummyPropertyWindow ).ToString() )
				return m_propertyWindow;
			else if( persistString == typeof( DummyToolbox ).ToString() )
				return m_toolbox;
			else if( persistString == typeof( DummyOutputWindow ).ToString() )
				return m_outputWindow;
			else if( persistString == typeof( DummyTaskList ).ToString() )
				return m_taskList;
			else {
				string[] parsedStrings = persistString.Split( new char[] { ',' } );
				if( parsedStrings.Length != 3 )
					return null;

				if( parsedStrings[ 0 ] != typeof( DummyDoc ).ToString() )
					return null;

				DummyDoc dummyDoc = new DummyDoc();
				if( parsedStrings[ 1 ] != string.Empty )
					dummyDoc.FileName = parsedStrings[ 1 ];
				if( parsedStrings[ 2 ] != string.Empty )
					dummyDoc.Text = parsedStrings[ 2 ];

				return dummyDoc;
			}
		}
Exemple #14
0
		private void menuItemOpen_Click( object sender, System.EventArgs e ) {
			OpenFileDialog openFile = new OpenFileDialog();

			openFile.InitialDirectory = Application.ExecutablePath;
			openFile.Filter = "rtf files (*.rtf)|*.rtf|txt files (*.txt)|*.txt|All files (*.*)|*.*";
			openFile.FilterIndex = 1;
			openFile.RestoreDirectory = true;

			if( openFile.ShowDialog() == DialogResult.OK ) {
				string fullName = openFile.FileName;
				string fileName = Path.GetFileName( fullName );

				if( FindDocument( fileName ) != null ) {
					MessageBox.Show( "The document: " + fileName + " has already opened!" );
					return;
				}

				DummyDoc dummyDoc = new DummyDoc();
				dummyDoc.Text = fileName;
				dummyDoc.Show( dockPanel );
				try {
					dummyDoc.FileName = fullName;
				} catch( Exception exception ) {
					dummyDoc.Close();
					MessageBox.Show( exception.Message );
				}

			}
		}
Exemple #15
0
		private IDockContent GetContentFromPersistString(string persistString)
		{
			if (persistString == typeof(DummySolutionExplorer).ToString())
				return m_solutionExplorer;
			else if (persistString == typeof(DummyPropertyWindow).ToString())
				return m_propertyWindow;
			else if (persistString == typeof(DummyToolbox).ToString())
				return m_toolbox;
			else if (persistString == typeof(DummyOutputWindow).ToString())
				return m_outputWindow;
			else if (persistString == typeof(DummyTaskList).ToString())
				return m_taskList;
			else
			{
                // DummyDoc overrides GetPersistString to add extra information into persistString.
                // Any DockContent may override this value to add any needed information for deserialization.

				string[] parsedStrings = persistString.Split(new char[] { ',' });
				if (parsedStrings.Length != 3)
					return null;

				if (parsedStrings[0] != typeof(DummyDoc).ToString())
					return null;

				DummyDoc dummyDoc = new DummyDoc();
				if (parsedStrings[1] != string.Empty)
					dummyDoc.FileName = parsedStrings[1];
				if (parsedStrings[2] != string.Empty)
					dummyDoc.Text = parsedStrings[2];

				return dummyDoc;
			}
		}
        private DummyDoc CreateNewDocument()
        {
            DummyDoc dummyDoc = new DummyDoc();

            int count = 1;
            string text = $"Document{count}";
            while (FindDocument(text) != null)
            {
                count++;
                text = $"Document{count}";
            }

            dummyDoc.Text = text;
            return dummyDoc;
        }