예제 #1
0
        public void GetSchemes()
        {
            List <DatabaseStream> streams      = DatabaseHandler.Streams;
            List <DatabaseScheme> schemesValid = new List <DatabaseScheme>();
            List <DatabaseScheme> schemes      = DatabaseHandler.Schemes;

            foreach (DatabaseScheme scheme in schemes)
            {
                foreach (DatabaseStream stream in streams)
                {
                    bool template = mode == Mode.TRAIN || mode == Mode.COMPLETE;
                    if (getTrainer(stream, scheme, template).Count > 0)
                    {
                        schemesValid.Add(scheme);
                        break;
                    }
                }
            }

            SchemesBox.ItemsSource = schemesValid;

            if (SchemesBox.Items.Count > 0)
            {
                DatabaseScheme scheme = ((List <DatabaseScheme>)SchemesBox.ItemsSource).Find(s => s.Name == Properties.Settings.Default.CMLDefaultScheme);
                if (scheme != null)
                {
                    SchemesBox.SelectedItem = scheme;
                }
                if (SchemesBox.SelectedItem == null)
                {
                    SchemesBox.SelectedIndex = 0;
                }
                SchemesBox.ScrollIntoView(SchemesBox.SelectedItem);
            }
        }
예제 #2
0
        public void GetSchemes()
        {
            SchemesBox.Items.Clear();

            List <DatabaseStream> streams      = DatabaseHandler.Streams;
            List <DatabaseScheme> schemesValid = new List <DatabaseScheme>();
            List <DatabaseScheme> schemes      = DatabaseHandler.Schemes;

            foreach (DatabaseScheme scheme in schemes)
            {
                schemesValid.Add(scheme);
            }

            foreach (DatabaseScheme item in schemesValid)
            {
                SchemesBox.Items.Add(item.Name);
            }

            if (SchemesBox.Items.Count > 0)
            {
                if (SchemesBox.SelectedIndex == -1)
                {
                    SchemesBox.SelectedIndex = 0;
                }
                SchemesBox.SelectedItem = Properties.Settings.Default.CMLDefaultScheme;
            }
            SchemesBox.ScrollIntoView(SchemesBox.SelectedItem);
        }
예제 #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            switchMode();

            GetDatabases(DatabaseHandler.DatabaseName);

            if (mode == Mode.COMPLETE)
            {
                AnnoList annoList = AnnoTierStatic.Selected.AnnoList;

                DatabaseScheme scheme = ((List <DatabaseScheme>)SchemesBox.ItemsSource).Find(s => s.Name == annoList.Scheme.Name);
                if (scheme != null)
                {
                    SchemesBox.SelectedItem = scheme;
                    SchemesBox.ScrollIntoView(scheme);
                }
                DatabaseRole role = ((List <DatabaseRole>)RolesBox.ItemsSource).Find(r => r.Name == annoList.Meta.Role);
                if (role != null)
                {
                    RolesBox.SelectedItem = role;
                    RolesBox.ScrollIntoView(role);
                }
                DatabaseAnnotator annotator = ((List <DatabaseAnnotator>)AnnotatorsBox.ItemsSource).Find(a => a.Name == Properties.Settings.Default.MongoDBUser);
                if (annotator != null)
                {
                    AnnotatorsBox.SelectedItem = annotator;
                    AnnotatorsBox.ScrollIntoView(annotator);
                }
                DatabaseSession session = ((List <DatabaseSession>)SessionsBox.ItemsSource).Find(s => s.Name == DatabaseHandler.SessionName);
                if (session != null)
                {
                    SessionsBox.SelectedItem = session;
                    SessionsBox.ScrollIntoView(session);
                }

                Update();
            }

            ApplyButton.Focus();

            handleSelectionChanged = true;
        }