コード例 #1
0
        void IContent.OnNavigatedTo(NavigationEventArgs e)
        {
            InterfaceHelpers.CurrentPage = e.Source.OriginalString;

            FillFavouriteDBConnectionsComboBox();

            // Disable "Reconnect to last used Database" if the connection cannot be found
            DBConnectionHelpers.LoadConnectionParameters();
            if (DBConnectionHelpers.LoadLastUsedDatabase() == null)
            {
                ReconnectToLastUsedConnectionButton.IsEnabled = false;
            }
            else
            {
                ReconnectToLastUsedConnectionButton.IsEnabled = true;
            }

            // Disable "Restore saved results" button if no file exists
            if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\LastMiningResults.mpm"))
            {
                RestoreSavedResultsButton.IsEnabled = false;
            }
            else
            {
                RestoreSavedResultsButton.IsEnabled = true;
            }
        }
コード例 #2
0
        public void LoadLastUsedDatabaseTest()
        {
            ConnectionParameters expected = new ConnectionParameters("TestString", "TestString", "TestString", "TestString", "TestString", "TestString", "TestString");
            ConnectionParameters actual;


            expected.IsLastUsedDatabase = true;
            DBConnectionHelpers.ConnectionParametersList = new List <ConnectionParameters>();
            DBConnectionHelpers.ConnectionParametersList.Add(expected);

            actual = DBConnectionHelpers.LoadLastUsedDatabase();

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        /// <summary>
        /// handle Shortcuts
        /// </summary>
        /// <param Name="sender"></param>
        /// <param Name="e"></param>
        /// <author>Thomas Meents, Bernd Nottbeck, Jannik Arndt</author>
        private void HandleShortcuts(object sender, KeyEventArgs e)
        {
            if (Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
            {
                switch (e.Key)
                {
                case Key.R:
                    Cursor = Cursors.Wait;
                    try
                    {
                        DBConnectionHelpers.LoadConnectionParameters();
                        DBConnectionHelpers.EstablishDatabaseConnection(DBConnectionHelpers.LoadLastUsedDatabase());
                    }
                    finally
                    {
                        Cursor = Cursors.Arrow;
                    }
                    break;
                }
            }
            else
            {
                switch (e.Key)
                {
                case Key.Enter:
                    switch (ContentSource.ToString())
                    {
                    case ("/Pages/P1connection.xaml"):
                        ContentSource = new Uri("/Pages/P2metadata.xaml", UriKind.RelativeOrAbsolute);
                        break;

                    case ("/Pages/P2metadata.xaml"):
                        ContentSource = new Uri("/Pages/P3dimensionselection.xaml", UriKind.RelativeOrAbsolute);
                        break;

                    case ("/Pages/P3dimensionselection.xaml"):
                        ContentSource = new Uri("/Pages/P4eventselection.xaml", UriKind.RelativeOrAbsolute);
                        break;

                    case ("/Pages/P4eventselection.xaml"):
                        ContentSource = new Uri("/Pages/P5configuration.xaml", UriKind.RelativeOrAbsolute);
                        break;

                    case ("/Pages/P5configuration.xaml"):
                        if (MinerSettings.IsAlgorithmSet)
                        {
                            ContentSource = new Uri("/Pages/P6mining.xaml", UriKind.RelativeOrAbsolute);
                        }
                        break;

                    case ("/Pages/P6mining.xaml"):
                        // Start / Continue
                        break;

                    case ("/Pages/P7consolidation.xaml"):
                        ContentSource = new Uri("/Pages/P8results.xaml", UriKind.RelativeOrAbsolute);
                        break;
                    }
                    break;

                case Key.F11:
                    if (WindowState.Equals(WindowState.Maximized))
                    {
                        ViewRegularscreen();
                    }
                    else
                    {
                        ViewFullscreen();
                    }
                    break;
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Reconnect to the Last used database connection
 /// </summary>
 /// <author>Bernhard Bruns</author>
 private void ReconnectToLastUsedConnectionClick(object sender, RoutedEventArgs e)
 {
     DBConnectionHelpers.LoadConnectionParameters();
     ConnectToDb(DBConnectionHelpers.LoadLastUsedDatabase());
 }