Exemplo n.º 1
0
        private void parseFiles()
        {
            try
            {
                string cmlfolderpath = Properties.Settings.Default.CMLDirectory + "\\" +
                                       Defaults.CML.FusionFolderName + "\\" +
                                       Defaults.CML.FusionBayesianNetworkFolderName + "\\";

                string       schemespath   = cmlfolderpath + "schemes.set";
                string       sessionsspath = cmlfolderpath + "sessions.set";
                StreamReader reader        = File.OpenText(schemespath);
                string       line;
                while ((line = reader.ReadLine()) != null)
                {
                    string[]            items = line.Split(':');
                    SchemeAnnotatorPair sap   = new SchemeAnnotatorPair {
                        Name = items[0], Annotator = items[1]
                    };
                    SchemeandAnnotatorBox.Items.Add(sap);
                }

                SchemeandAnnotatorBox.SelectAll();

                StreamReader reader2 = File.OpenText(sessionsspath);

                while ((line = reader2.ReadLine()) != null)
                {
                    DatabaseSession session = ((List <DatabaseSession>)SessionsBox.ItemsSource).Find(a => a.Name == line);
                    SessionsBox.SelectedItems.Add(session);
                }
                SessionsBox.ScrollIntoView(SessionsBox.SelectedItem);
            }
            catch { }
        }
Exemplo n.º 2
0
        private void ApplySessionSet()
        {
            if (mode == Mode.COMPLETE)
            {
                return;
            }

            handleSelectionChanged = false;

            SessionSet set = (SessionSet)SelectSessionSetComboBox.SelectedItem;

            if (set != null)
            {
                SessionsBox.SelectedItems.Clear();

                switch (set.Set)
                {
                case SessionSet.Type.ALL:

                    SessionsBox.SelectAll();
                    break;

                case SessionSet.Type.MISSING:

                    SelectMissingSessions();
                    break;

                case SessionSet.Type.FINISHED:

                    SelectFinishedSessions();
                    break;

                case SessionSet.Type.FILE:

                    SelectSessionsFromFile(set);
                    break;
                }
            }

            if (SessionsBox.SelectedItems != null)
            {
                SessionsBox.ScrollIntoView(SessionsBox.SelectedItem);
            }

            handleSelectionChanged = true;
        }
Exemplo n.º 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;
        }