示例#1
0
        private async void shutdownButton_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new MessageDialog("Are you sure you want to shutdown the device? You can't turn it on remotely.", "IoTHelpers");

            dialog.Commands.Add(new UICommand("Yes", (cmd) => ShutdownManager.Shutdown()));
            dialog.Commands.Add(new UICommand("No"));
            dialog.CancelCommandIndex = 1;

            await dialog.ShowAsync();
        }
示例#2
0
        public void Shutdown_WhenDetailsHasUnsavedChanges_ReturnsMessage()
        {
            //Arrange
            var mainViewModelMock = Mock.Create<IShell>();
            var detailVM = Mock.Create<IDetailsViewModel>(Behavior.CallOriginal);
            Mock.Arrange(() => detailVM.NeedsExitConfirmation).Returns(true);
            mainViewModelMock.Windows.Add(detailVM);

            var commService = Mock.Create<ICommunicationService>();
            
            var shutdownManager = new ShutdownManager(true) {MainViewModel = mainViewModelMock, CommunicationService = commService};

            //Act
            var result = shutdownManager.Shutdown();

            //Assert
            Assert.IsTrue(result != "false");

        }