コード例 #1
0
 void IContent.OnNavigatingFrom(NavigatingCancelEventArgs e)
 {
     if (InterfaceHelpers.CheckIfNavigationIsAllowed(e.Source.OriginalString) == false)
     {
         e.Cancel = true;
     }
 }
コード例 #2
0
        public void CheckIfNavigationIsAllowedTest2()
        {
            // [0] P1connection.xaml",
            // [1] P2metadata.xaml",
            // [2] P3dimensionselection.xaml",
            // [3] P4eventselection.xaml",
            // [4] P5configuration.xaml",
            // [5] P6mining.xaml",
            // [6] P8results.xaml"

            bool expected = true;
            bool actual   = true;

            DBWorker.MetaData = new MetaDataRepository();

            if (actual)
            {
                InterfaceHelpers.CurrentPage = PageList[0];
                actual = InterfaceHelpers.CheckIfNavigationIsAllowed(PageList[1]);
            }

            if (actual)
            {
                InterfaceHelpers.CurrentPage = PageList[1];
                actual = InterfaceHelpers.CheckIfNavigationIsAllowed(PageList[2]);
            }

            if (actual)
            {
                InterfaceHelpers.CurrentPage = PageList[2];
                actual = InterfaceHelpers.CheckIfNavigationIsAllowed(PageList[3]);
            }

            if (actual)
            {
                InterfaceHelpers.CurrentPage = PageList[3];
                actual = InterfaceHelpers.CheckIfNavigationIsAllowed(PageList[4]);
            }

            if (actual)
            {
                MinerSettings.IsAlgorithmSet = true;
                InterfaceHelpers.CurrentPage = PageList[4];
                actual = InterfaceHelpers.CheckIfNavigationIsAllowed(PageList[5]);
            }


            if (actual)
            {
                InterfaceHelpers.MiningIsCompleted = true;
                InterfaceHelpers.CurrentPage       = PageList[5];
                actual = InterfaceHelpers.CheckIfNavigationIsAllowed(PageList[6]);
            }

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        void IContent.OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            if (DBWorker.MetaData.EventClassifier == "")
            {
                e.Cancel = true;
                ModernDialog.ShowMessage("Please select a classifier", "Metadata", MessageBoxButton.OK);
            }

            if (InterfaceHelpers.CheckIfNavigationIsAllowed(e.Source.OriginalString) == false)
            {
                e.Cancel = true;
            }
        }
コード例 #4
0
        void IContent.OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            if (DBWorker.MetaData == null && e.Source.OriginalString == "/Pages/P2metadata.xaml")
            {
                ModernDialog.ShowMessage("You have to establish a database connection first.", "Connection", MessageBoxButton.OK);
                e.Cancel = true;
            }

            if (InterfaceHelpers.CheckIfNavigationIsAllowed(e.Source.OriginalString) == false)
            {
                e.Cancel = true;
            }
        }
コード例 #5
0
        public void CheckIfNavigationIsAllowedTest()
        {
            bool expected = true;
            bool actual;

            DBWorker.MetaData            = new MetaDataRepository();
            InterfaceHelpers.CurrentPage = PageList[6];

            foreach (String navigateToPage in PageList)
            {
                actual = InterfaceHelpers.CheckIfNavigationIsAllowed(navigateToPage);
                Assert.AreEqual(expected, actual);
            }
        }
コード例 #6
0
        public void CheckIfNavigationIsAllowedTest3()
        {
            // [0] P1connection.xaml",
            // [1] P2metadata.xaml",
            // [2] P3dimensionselection.xaml",
            // [3] P4eventselection.xaml",
            // [4] P5configuration.xaml",
            // [5] P6mining.xaml",
            // [6] P8results.xaml"

            bool expected = true;
            bool actual;

            actual = InterfaceHelpers.CheckIfNavigationIsAllowed("StringThatIsNotInPageList");
            Assert.AreEqual(expected, actual);
        }
コード例 #7
0
        public void CheckIfNavigationIsAllowedTest4()
        {
            // [0] P1connection.xaml",
            // [1] P2metadata.xaml",
            // [2] P3dimensionselection.xaml",
            // [3] P4eventselection.xaml",
            // [4] P5configuration.xaml",
            // [5] P6mining.xaml",
            // [6] P8results.xaml"

            bool expected = true;
            bool actual;

            InterfaceHelpers.CurrentPage = PageList[0];
            InterfaceHelpers.RestoreData = true;

            actual = InterfaceHelpers.CheckIfNavigationIsAllowed(PageList[6]);
            Assert.AreEqual(expected, actual);
        }
コード例 #8
0
        void IContent.OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            if (InterfaceHelpers.CheckIfNavigationIsAllowed(e.Source.OriginalString) == false)
            {
                e.Cancel = true;
            }

            if (_isMinerRunning)
            {
                MessageBoxResult doNavigateAway =
                    ModernDialog.ShowMessage("Changing the view will cancel the mining-process. Continue?", "navigate",
                                             MessageBoxButton.YesNo);
                if (doNavigateAway == MessageBoxResult.No)
                {
                    e.Cancel = true;
                    return;
                }
            }

            if (_cancellationTokenSource != null)
            {
                _cancellationTokenSource.Cancel();
            }

            Cursor                 = Cursors.Arrow;
            _isMinerRunning        = false;
            ProgressBar.Visibility = Visibility.Hidden;

            StartCalculationButton.IsEnabled  = true;
            CancelCalculationButton.IsEnabled = false;
            MiningInfo.BBCode = "Click 'Start' to start mining " +
                                MainWindow.MatrixSelection.GetFields().Count +
                                " Fields using the " +
                                MinerSettings.MinerName + ".";

            InterfaceHelpers.MiningIsCompleted = false;
        }