Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
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();
            }
        }
Ejemplo n.º 3
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();
            }
        }
Ejemplo n.º 4
0
 private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     this.NewContent   = this.listView.SelectedItem as NewContentAttribute;
     this.DialogResult = true;
 }
Ejemplo n.º 5
0
 private void Button_Click(Object sender, RoutedEventArgs e)
 {
     NewContent   = listView.SelectedItem as NewContentAttribute;
     DialogResult = true;
 }
 //TODO : Make here MVVM compatible
 private void listBoxItem_DoubleClick(object sender, MouseButtonEventArgs e)
 {
     this.NewContent   = (sender as ListBoxItem).DataContext as NewContentAttribute;
     this.DialogResult = true;
 }