private void NewDocument()
        {
            if (_workspace == null)
            {
                _workspace = _container.Resolve <AbstractWorkspace>();
            }

            if (_availableNewContent.Count == 1)
            {
                IContentHandler handler   = _dictionary[_availableNewContent[0]];
                var             openValue = handler.NewContent(_availableNewContent[0]);
                _workspace.Documents.Add(openValue);
                _workspace.ActiveDocument = openValue;
            }
            else
            {
                NewFileWindow window = new NewFileWindow();
                Brush         backup = _statusBar.Background;
                _statusBar.Background = _newBackground;
                _statusBar.Text       = "Select a new file";
                if (Application.Current.MainWindow is MetroWindow)
                {
                    window.Resources = Application.Current.MainWindow.Resources;
                    Window win = Application.Current.MainWindow as MetroWindow;
                    window.Resources = win.Resources;
                    //window.GlowBrush = win.GlowBrush;
                    //window.TitleForeground = win.TitleForeground;
                }
                window.DataContext = _availableNewContent;
                if (window.ShowDialog() == true)
                {
                    NewContentAttribute newContent = window.NewContent;
                    if (newContent != null)
                    {
                        IContentHandler handler   = _dictionary[newContent];
                        var             openValue = handler.NewContent(newContent);
                        _workspace.Documents.Add(openValue);
                        _workspace.ActiveDocument = openValue;
                    }
                }
                _statusBar.Background = backup;
                _statusBar.Clear();
            }
        }
Ejemplo n.º 2
0
        private void NewDocument()
        {
            if (_workspace == null)
                _workspace = _container.Resolve<AbstractWorkspace>();

            if (_availableNewContent.Count == 1)
            {
                IContentHandler handler = _dictionary[_availableNewContent[0]];
                var openValue = handler.NewContent(_availableNewContent[0]);
                _workspace.Documents.Add(openValue);
                _workspace.ActiveDocument = openValue;
            }
            else
            {
                NewFileWindow window = new NewFileWindow();
                Brush backup = _statusBar.Background;
                _statusBar.Background = _newBackground;
                _statusBar.Text = "Select a new file";
                if(Application.Current.MainWindow is MetroWindow)
                {
                    window.Resources = Application.Current.MainWindow.Resources;
                    Window win = Application.Current.MainWindow as MetroWindow;
                    window.Resources = win.Resources;
                    //window.GlowBrush = win.GlowBrush;
                    //window.TitleForeground = win.TitleForeground;
                }
                window.DataContext = _availableNewContent;
                if(window.ShowDialog() == true)
                {
                    NewContentAttribute newContent = window.NewContent;
                    if(newContent != null)
                    {
                        IContentHandler handler = _dictionary[newContent];
                        var openValue = handler.NewContent(newContent);
                        _workspace.Documents.Add(openValue);
                        _workspace.ActiveDocument = openValue;
                    }
                }
                _statusBar.Background = backup;
                _statusBar.Clear();
            }
        }