Exemplo n.º 1
0
        private void New_click(object sender, RoutedEventArgs e)
        {
            string title = "newDoc";
            int i = 0;
            while (dockingManager.Documents.Any(d => d.Title == title))
            {
                title = "newDoc" + i.ToString();
                i++;
            }

            var doc = new Document() { Title = title };
            doc.Show(dockingManager);
            doc.Activate();
        }
Exemplo n.º 2
0
        private void OpenFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Filter = "Text Files (*.txt)|*.txt";

            if (dlg.ShowDialog().GetValueOrDefault())
            {
                using (StreamReader sr = new StreamReader(dlg.FileName))
                {
                    var doc = new Document() { Title = System.IO.Path.GetFileName(dlg.FileName) };
                    doc.Show(dockingManager);

                    doc.TextContent = sr.ReadToEnd();
                    doc.Activate();
                }
            }
        }
Exemplo n.º 3
0
        private void New_click(object sender, RoutedEventArgs e)
        {
            string title = "newDoc";
            int    i     = 0;

            while (dockingManager.Documents.Any(d => d.Title == title))
            {
                title = "newDoc" + i.ToString();
                i++;
            }

            var doc = new Document()
            {
                Title = title
            };

            doc.Show(dockingManager);
            doc.Activate();
        }
Exemplo n.º 4
0
        private void OpenFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "Text Files (*.txt)|*.txt";

            if (dlg.ShowDialog().GetValueOrDefault())
            {
                using (StreamReader sr = new StreamReader(dlg.FileName))
                {
                    var doc = new Document()
                    {
                        Title = System.IO.Path.GetFileName(dlg.FileName)
                    };
                    doc.Show(dockingManager);

                    doc.TextContent = sr.ReadToEnd();
                    doc.Activate();
                }
            }
        }