public ShellViewModel()
 {
     //IsAuthenticated = true;
     //StartUp();
     ActivateWindow.Parent = this;
     ActivateWindow.OpenItem(new AdminViewModel());
 }
        private static ActivateWindow CreateActivateWindow(
            DTE2 dte2 = null,
            IDocumentMetadataManager documentMetadataManager = null,
            IProjectItemService projectItemService           = null)
        {
            var command = new ActivateWindow(
                dte2 ?? Mock.Of <DTE2>(),
                new DocumentMetadataEqualityService(),
                documentMetadataManager ?? Mock.Of <IDocumentMetadataManager>(),
                projectItemService ?? Mock.Of <IProjectItemService>());

            return(command);
        }
        public void CanExecuteReturnsTrue()
        {
            // Arrange

            var command = new ActivateWindow(Mock.Of <DTE2>());

            // Act

            var canExecute = command.CanExecute(null);

            // Assert

            Assert.IsTrue(canExecute);
        }
        public void AllCommandsAreAssigned()
        {
            // Arrange

            var activateWindow = new ActivateWindow(
                Mock.Of <DTE2>(),
                Mock.Of <IDocumentMetadataEqualityService>(),
                Mock.Of <IDocumentMetadataManager>(),
                Mock.Of <IProjectItemService>());

            var clearFilterString = new ClearFilterString(
                Mock.Of <IDocumentMetadataManager>());

            var closeDocument = new CloseDocument(
                Mock.Of <DTE2>(),
                Mock.Of <IDocumentMetadataEqualityService>());

            var openTestFile = new OpenTestFile(
                Mock.Of <IProjectItemService>(),
                Mock.Of <ITestFileNameEvaluator>());

            var openOptionsPage = new OpenOptionsPage();
            var toggleIsPinned  = new ToggleIsPinned(Mock.Of <IDocumentMetadataManager>());

            var commandList = new List <ICommand>
            {
                activateWindow,
                clearFilterString,
                closeDocument,
                openTestFile,
                openOptionsPage,
                toggleIsPinned
            };

            // Act

            var commands = new ToolWindowCommands(commandList);

            // Assert

            Assert.That(commands.ActivateWindow, Is.EqualTo(activateWindow));
            Assert.That(commands.ClearFilterString, Is.EqualTo(clearFilterString));
            Assert.That(commands.CloseDocument, Is.EqualTo(closeDocument));
            Assert.That(commands.OpenOptionsPage, Is.EqualTo(openOptionsPage));
            Assert.That(commands.OpenTestFile, Is.EqualTo(openTestFile));
            Assert.That(commands.ToggleIsPinned, Is.EqualTo(toggleIsPinned));
        }
        public void ExecuteDoesNotThrowExceptionWithNullParameter()
        {
            // Arrange

            var dteMock = new Mock <DTE2>();

            dteMock.Setup(d => d.Documents).Returns <Documents>(null);

            var command = new ActivateWindow(dteMock.Object);

            // Act

            Assert.DoesNotThrow(() => command.Execute(null));

            // Assert

            dteMock.Verify(d => d.Documents, Times.Never);
        }
        public VisualizerControl(IToolWindowIntegration integration, ActivateWindow activateWindow)
        {
            _context = integration.GetVisualizerContext();
            _context.PropertyChanged    += ContextPropertyChanged;
            _context.GroupFetched       += GroupFetched;
            _context.GroupFetching      += SetupDataFetch;
            _context.CellSelectionEvent += CellSelected;
            DataContext = _context;
            InitializeComponent();

            _wavemap = new WavemapImage(HeaderHost.WavemapImage, _context);
            _wavemap.NavigationRequested += NavigateToWave;
            HeaderHost.WavemapSelector.Setup(_context, _wavemap);
            _activateWindow = activateWindow;

            _integration           = integration;
            _integration.AddWatch += AddWatch;
            PropertyChangedEventManager.AddHandler(_context.Options.VisualizerOptions, OptionsChanged, "");
            PropertyChangedEventManager.AddHandler(_context.Options.DebuggerOptions, OptionsChanged, "");
            PropertyChangedEventManager.AddHandler(_context.Options.VisualizerAppearance, OptionsChanged, "");
            PropertyChangedEventManager.AddHandler(_context.Options.VisualizerColumnStyling, VisualizerColumnStylingPropertyChanged, "");

            _fontAndColorProvider = new FontAndColorProvider();
            _fontAndColorProvider.FontAndColorInfoChanged += RefreshDataStyling;
            _table = new VisualizerTable(
                _context.Options,
                _fontAndColorProvider,
                getValidWatches: () => _context?.BreakData?.Watches);
            _table.WatchStateChanged += (newWatchState, invalidatedRows) =>
            {
                _context.Options.DebuggerOptions.Watches.Clear();
                _context.Options.DebuggerOptions.Watches.AddRange(newWatchState);
                if (invalidatedRows != null)
                {
                    foreach (var row in invalidatedRows)
                    {
                        SetRowContentsFromBreakState(row);
                    }
                }
            };
            _table.SetScalingMode(_context.Options.VisualizerAppearance.ScalingMode);
            TableHost.Setup(_table);
            RestoreSavedState();
        }
        public void ExecuteActivatesFirstDocumentWindow()
        {
            // Arrange

            var info = new DocumentMetadataInfo
            {
                FullName = "DocumentName"
            };

            var windowMock = new Mock <Window>();
            var windowList = new List <Window>
            {
                windowMock.Object
            };

            var windowsMock      = CreateWindows(windowList);
            var documentMockList = new List <Document>
            {
                Mock.Of <Document>(d =>
                                   d.FullName == info.FullName &&
                                   d.Windows == windowsMock)
            };

            var documents = CreateDocuments(documentMockList);
            var dte2      = Mock.Of <DTE2>(d => d.Documents == documents);

            var builder  = new DocumentMetadataFactoryBuilder();
            var factory  = builder.CreateDocumentMetadataFactory(true);
            var metadata = factory.Create(info);

            var command = new ActivateWindow(dte2);

            // Act

            command.Execute(metadata);

            // Assert

            windowMock.Verify(w => w.Activate());
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var source = e.Source as FrameworkElement;

            Debug.Assert(source != null, "Button_Click - source != null");
            switch (source.Name)
            {
            case "Button0":
            {
                var window = new ParentChild.ParentWindow {
                    Owner = this
                };
                window.Show();
            }
            break;

            case "Button1":
            {
                var window = new ActivateWindow {
                    Owner = this, ShowActivated = false
                };
                window.Show();
            }
            break;

            case "Button2":
            {
                var window = new ClosingWindow {
                    Owner = this
                };
                window.Show();
            }
            break;

            case "Button3":
            {
                var window1 = new LocationWindowCenterOwner {
                    Owner = this
                };
                window1.Show();
                var window2 = new LocationWindowCenterScreen {
                    Owner = this
                };
                window2.Show();
                var window3 = new LocationWindowManual {
                    Owner = this
                };
                window3.Show();
            }
            break;

            case "Button4":
            {
                var window1 = new ZOrderWindowTopmost {
                    Owner = this
                };
                window1.Show();
                var window2 = new ZOrderWindow {
                    Owner = this
                };
                window2.Show();
            }
            break;

            case "Button5":
            {
                var window = new StateWindow {
                    Owner = this
                };
                window.Show();
            }
            break;

            case "Button6":
            {
                var window = new DarstellungWindow {
                    Owner = this
                };
                window.Show();
            }
            break;
            }
        }
Exemple #9
0
 public void ActivateWindowTest()
 {
     ActivateWindow request = new ActivateWindow(KodiJSON.Global.GUI.Window.home);
     var            result  = JsonConvert.DeserializeObject <KodiJSON.GUI.Response.ActivateWindowResponse>(ExecuteTest.GetResponse(request));
 }
Exemple #10
0
 public void ChangeView()
 {
     ActivateWindow.OpenItem(new WorkspaceViewModel(SelectedWorkspace.ArtifactId));
 }