Esempio n. 1
0
        protected virtual void NewDocument()
        {
            if (_workspace == null)
            {
                _workspace = _container.Resolve <AbstractWorkspace>();
            }

            if (_availableNewContent.Count == 1)
            {
                IContentHandler handler   = _dictionary[_availableNewContent[0]];
                var             openValue = handler.NewContent(_availableNewContent[0]);

                if (openValue == null)
                {
                    return;
                }

                _workspace.Documents.Add(openValue);
                _workspace.ActiveDocument = openValue;
            }
            else
            {
                throw new NotImplementedException();
            }
        }
        protected virtual void NewDocument()
        {
            if (_workspace == null)
            {
                _workspace = VEFModule.UnityContainer.Resolve(typeof(AbstractWorkspace), "") as AbstractWorkspace;
            }

            if (_availableNewContent.Count == 1)
            {
                IContentHandler handler   = _dictionary[_availableNewContent[0]];
                var             openValue = handler.NewContent(_availableNewContent[0]);

                if (openValue == null)
                {
                    return;
                }

                _workspace.Documents.Add(openValue);
                _workspace.ActiveDocument = openValue;
            }
            else
            {
                //   throw new NotImplementedException();

                NewFileWindow window = new NewFileWindow();
                window.Owner = Application.Current.MainWindow;
                //  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);
                        if (openValue != null)
                        {
                            _workspace.Documents.Add(openValue);
                            _workspace.ActiveDocument = openValue;
                        }
                    }
                }
                // _statusBar.Background = new VEFBrush() { Brush = backup };
                _statusBar.Clear();
            }
        }
Esempio n. 3
0
        private void NewDocument()
        {
            if (_workspace == null)
            {
                _workspace = _container.Resolve <IWorkspace>();
            }

            if (_availableNewContent.Count == 1)
            {
                IContentHandler  handler   = _dictionary[_availableNewContent[0]];
                ContentViewModel openValue = handler.NewContent(_availableNewContent[0]);
                _workspace.Documents.Add(openValue);
                _workspace.ActiveDocument = openValue;
            }
            else
            {
                INewFileWindow window = _container.Resolve <INewFileWindow>();
                if (window == null)
                {
                    return;
                }
                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];
                        ContentViewModel openValue = handler.NewContent(newContent);
                        _workspace.Documents.Add(openValue);
                        _workspace.ActiveDocument = openValue;
                    }
                }
                _statusBar.Background = backup;
                _statusBar.Clear();
            }
        }
Esempio n. 4
0
        private void NewDocument()
        {
            if (_workspace == null)
            {
                _workspace = _container.Resolve <DefaultWorkspace>();
            }

            if (_availableNewContent.Count == 1)
            {
                IContentHandler handler   = _dictionary[_availableNewContent[0]];
                var             openValue = handler.NewContent(_availableNewContent[0]);
                _workspace.Documents.Add(openValue);
                _workspace.ActiveDocument = openValue;
            }
            else
            {
                //TODO : Make this overridable
                DefaultNewFileWindow window = new DefaultNewFileWindow();
                Brush backup = _statusBar.Background;
                _statusBar.Background = _newBackground;
                _statusBar.Text       = "Select a new file";
                if (System.Windows.Application.Current.MainWindow is MetroWindow)
                {
                    window.Resources = System.Windows.Application.Current.MainWindow.Resources;
                    Window win = System.Windows.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();
            }
        }
        protected override void NewDocument()
        {
            if (_workspace == null)
            {
                _workspace = _container.Resolve <AbstractWorkspace>();
            }

            if (_availableNewContent.Count == 1)
            {
                IContentHandler handler   = _dictionary[_availableNewContent[0]];
                var             openValue = handler.NewContent(_availableNewContent[0]);

                if (openValue == null)
                {
                    return;
                }

                _workspace.Documents.Add(openValue);
                _workspace.ActiveDocument = openValue;
            }
            else
            {
                // The new glow background brush

                //todo


                //SolidColorBrush _newBackground = new SolidColorBrush(Color.FromRgb(104,33,122));

                //NewFileWindow window = new NewFileWindow();
                //window.Owner = Application.Current.MainWindow;
                //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);
                //        if (openValue != null)
                //        {
                //            _workspace.Documents.Add(openValue);
                //            _workspace.ActiveDocument = openValue;
                //        }
                //    }
                //}
                //_statusBar.Background = backup;
                //_statusBar.Clear();
            }
        }