public void GetAnnotators()
        {
            AnnotatorsBox.ItemsSource = DatabaseHandler.Annotators;

            if (AnnotatorsBox.Items.Count > 0)
            {
                string annotatorName = Properties.Settings.Default.CMLDefaultAnnotator;
                AnnotatorsBox.IsEnabled = mode != Mode.COMPLETE;

                if (mode == Mode.PREDICT)
                {
                    if (DatabaseHandler.CheckAuthentication() <= DatabaseAuthentication.READWRITE)
                    {
                        annotatorName           = Properties.Settings.Default.MongoDBUser;
                        AnnotatorsBox.IsEnabled = false;
                    }

                    else
                    {
                        annotatorName = Properties.Settings.Default.CMLDefaultAnnotatorPrediction;
                    }
                }

                else if (DatabaseHandler.CheckAuthentication() > DatabaseAuthentication.READWRITE)
                {
                    annotatorName = Properties.Settings.Default.CMLDefaultAnnotator;
                }

                // check for last user
                DatabaseAnnotator annotator = ((List <DatabaseAnnotator>)AnnotatorsBox.ItemsSource).Find(a => a.Name == annotatorName);
                if (annotator != null)
                {
                    AnnotatorsBox.SelectedItem = annotator;
                }

                // check for gold
                if (AnnotatorsBox.SelectedItem == null)
                {
                    annotator = ((List <DatabaseAnnotator>)AnnotatorsBox.ItemsSource).Find(a => a.Name == Defaults.CML.GoldStandardName);
                    if (annotator != null)
                    {
                        AnnotatorsBox.SelectedItem = annotator;
                    }
                }

                // select first
                if (AnnotatorsBox.SelectedItem == null)
                {
                    AnnotatorsBox.SelectedIndex = 0;
                }

                AnnotatorsBox.ScrollIntoView(AnnotatorsBox.SelectedItem);
            }
        }
Пример #2
0
        public void GetAnnotators()
        {
            AnnotatorsBox.Items.Clear();

            foreach (DatabaseAnnotator annotator in DatabaseHandler.Annotators)
            {
                AnnotatorsBox.Items.Add(annotator.FullName);
            }

            if (AnnotatorsBox.Items.Count > 0)
            {
                AnnotatorsBox.SelectedIndex = 0;
                AnnotatorsBox.SelectedItem  = Properties.Settings.Default.CMLDefaultAnnotator;
            }

            AnnotatorsBox.ScrollIntoView(AnnotatorsBox.SelectedItem);
        }
Пример #3
0
        public void GetAnnotators()
        {
            AnnotatorsBox.Items.Clear();
            AnnotatorInputBox.Items.Clear();

            foreach (DatabaseAnnotator annotator in DatabaseHandler.Annotators)
            {
                AnnotatorsBox.Items.Add(annotator.FullName);
                AnnotatorInputBox.Items.Add(annotator.FullName);
            }


            AnnotatorInputBox.SelectedItem = Properties.Settings.Default.CMLDefaultAnnotator;
            AnnotatorInputBox.ScrollIntoView(AnnotatorInputBox.SelectedItem);


            AnnotatorsBox.SelectedItem = Properties.Settings.Default.CMLDefaultAnnotatorPrediction;
            AnnotatorsBox.ScrollIntoView(AnnotatorsBox.SelectedItem);
        }
Пример #4
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;
        }