public void ElementList_ThreeLayerAndChangeSize_FreeOpacityMask()
        {
            var factories = new IElementFactoryViewModel<IElementViewModel>[]
            {
                new PortiereFactoryViewModel(), 
                new PleatFactoryViewModel(), 
                new TulleFactoryViewModel()
            };
            var screen = new ScreenViewModel()
            {
                Width = 4,
                Height = 2
            };
            
            var workspace = new WorkspaceViewModel()
            {
                Factories = factories,
                Screen = screen,
                CommandFactory = MockRepository.GenerateStub<ICommandFactory>(),
                SettingProvider = MockRepository.GenerateStub<ISettingProvider>()
            };

            var elementList = workspace.ElementList;
            elementList.AppendElement(factories[0]);
            elementList.AppendElement(factories[1]);
            elementList.AppendElement(factories[2]);

            Assert.That(elementList.Count(), Is.EqualTo(3));
            Assert.That(elementList.Collection.Last().Layout.OpacityMask, Is.Null);
            screen.Width = 5;
            Assert.That(elementList.Collection.Last().Layout.OpacityMask, Is.Null);
        }
 public WorkspaceNavigationViewModel(WorkspaceViewModel startWorkspace, bool showNavButtons = true)
 {
     _showNavButtons = showNavButtons;
     Workspaces = new List<WorkspaceViewModel>();
     Workspaces.Add(startWorkspace);
     _currentWorkspace = Workspaces.First();
 }
        public WorkModeListViewModel(WorkspaceViewModel workspace)
        {
            Editor = new EditorWorkModeViewModel(workspace);
            Report = new ReportWorkModeViewModel(workspace);

            Items = new[]
            {
                new ContainerRecord<IWorkModeViewModel>("Editor", Editor),
                new ContainerRecord<IWorkModeViewModel>("Report", Report)
            };
        }
        public WorkspaceWindow()
        {
            vm = new WorkspaceViewModel(this);
            this.DataContext = vm;

            InitializeComponent();

            this.Title = "Workspace: " + Workspace.Current.Path;

            //TODO: Need to do a query when load db, in loader
            /*
            var db = Workspace.Current.DB;

            db.Books.Add(new Models.Book() {
                Created = DateTime.Now, //Move to constructor
                Title = "Test"
            });

            db.SaveChanges();
            */
        }
Example #5
0
        public JadeViewModel(DockingGui.MainWindow view)
        {
            _workspaceController = JadeCore.Services.Provider.WorkspaceController;
            //Todo - Workspace viewmodel to track WorkspaceController changes
            _workspaceController.WorkspaceChanged += delegate { OnWorkspaceChanged(); };
            _currentWorkspace = new WorkspaceViewModel();
            
            _editorController = JadeCore.Services.Provider.EditorController;
            _editorController.ActiveDocumentChanged += OnEditorControllerActiveDocumentChanged;
            _editorViewModel = new JadeControls.EditorControl.ViewModel.EditorControlViewModel(_editorController, new JadeControls.EditorControl.ViewModel.DocumentViewModelFactory());

            _outputViewModel = new OutputViewModel(JadeCore.Services.Provider.OutputController);

            _searchController = JadeCore.Services.Provider.SearchController;
            _seachResultsViewModel = new SearchResultsPaneViewModel(_searchController);

            _symbolInspectorViewModel = new SymbolInspectorPaneViewModel(_editorController);

            _cursorInspectorViewModel = new CursorInspectorPaneViewModel();

            _contextPaneViewModel = new ContextPaneViewModel(_editorController);

            _commands = new JadeCommandAdaptor(this);
            _view = view;

            _toolWindows = new ObservableCollection<JadeControls.Docking.ToolPaneViewModel>();                        
            _toolWindows.Add(_seachResultsViewModel);
            _toolWindows.Add(_outputViewModel);
            _toolWindows.Add(_currentWorkspace);
            _toolWindows.Add(_symbolInspectorViewModel);
            _toolWindows.Add(_cursorInspectorViewModel);
            _toolWindows.Add(_contextPaneViewModel);
            OnViewWorkspaceWindow();

            UpdateWindowTitle();
        }
 public ShellViewModel(IWindowManager windowManager,WorkspaceViewModel workspace)
 {
     _windowManager = windowManager;
     _workspace = workspace;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorkspaceWindow"/> class.
 /// </summary>
 /// <param name="viewModel">The view model to inject.</param>
 /// <remarks>
 /// This constructor can be used to use view-model injection.
 /// </remarks>
 public WorkspaceWindow(WorkspaceViewModel viewModel)
     : base(viewModel)
 {
     InitializeComponent();
 }
 public Watch3DFullscreenViewModel(WorkspaceViewModel parentWorkspace)
 {
     ParentWorkspace = parentWorkspace;
 }
        public void ElementList_AddAllElement_NoError()
        {
            var factories = new IElementFactoryViewModel<IElementViewModel>[]
            {
                new PortiereFactoryViewModel(),
                new PleatFactoryViewModel(),
                new TulleFactoryViewModel(),
                new TieBackFactoryViewModel(), 
                new PanelFactoryViewModel(), 
                new HardPelmetFactoryViewModel(), 
                new ApplicationFactoryViewModel(), 
                new ScanFactoryViewModel(), 
                new OverlayFactoryViewModel(), 
                new FilletFactoryViewModel(), 
                new EqualSwagFactoryViewModel(), 
                new EqualTailFactoryViewModel(), 
                new ScaleneSwagFactoryViewModel(), 
                new ScaleneTailFactoryViewModel(),
                new DeJabotFactoryViewModel(), 
                new LatticeFactoryViewModel(), 
                new RomanBlindFactoryViewModel()
            };
            var screen = new ScreenViewModel()
            {
                Width = 4,
                Height = 2
            };

            var settingData = MockRepository.GenerateStub<ISettingData>();
            settingData.Stub(sd => sd.ProgramName).Return("MyName");
            settingData.Stub(sd => sd.Version).Return("1.0.0.0");

            var settingProvider = MockRepository.GenerateStub<ISettingProvider>();
            settingProvider.Stub(sp => settingProvider.GetSettingData()).Return(settingData);

            var workspace = new WorkspaceViewModel()
            {
                Factories = factories,
                Screen = screen,
                CommandFactory = MockRepository.GenerateStub<ICommandFactory>(),
                SettingProvider = settingProvider
            };

            var elementList = workspace.ElementList;
            factories.ToList()
                .ForEach(factory => elementList.AppendElement(factory));

            Assert.That(elementList.Count(), Is.EqualTo(factories.Length));

            var dataTransfer = workspace.Save();

            Assert.DoesNotThrow(() =>
            {
                var serializer = new XmlSerializer(StandardXmlPrimitive.Primitives, dataTransfer);
                serializer.Serialize();
            });
            workspace.Restore(dataTransfer);
            Assert.That(elementList.Count(), Is.EqualTo(factories.Length));
        }