示例#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 { }
        }
示例#2
0
        private void SelectMissingSessions()
        {
            List <DatabaseSession> sessions = (List <DatabaseSession>)SessionsBox.ItemsSource;

            if (sessions == null)
            {
                return;
            }

            SessionsBox.SelectAll();

            DatabaseScheme    scheme    = (DatabaseScheme)SchemesBox.SelectedItem;
            DatabaseAnnotator annotator = (DatabaseAnnotator)AnnotatorsBox.SelectedItem;

            foreach (DatabaseRole role in RolesBox.SelectedItems)
            {
                List <DatabaseAnnotation> annotations = DatabaseHandler.GetAnnotations(scheme, role, annotator);
                foreach (DatabaseAnnotation annotation in annotations)
                {
                    DatabaseSession session = sessions.Find(s => s.Name == annotation.Session);
                    if (session != null)
                    {
                        SessionsBox.SelectedItems.Remove(session);
                    }
                }
            }
        }
示例#3
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;
        }
示例#4
0
 private async void LoadSessions()
 {
     SessionsBox.ClearValue(ItemsControl.ItemsSourceProperty);
     if (!SpecialCheck.IsChecked.Value)
     {
         SessionsBox.DisplayMemberPath = "SessionDesc";
         SessionsBox.SelectedValuePath = "SessionId";
         SessionsBox.ItemsSource       = (await core.GetSessionsAsync(UserCredentials.Conference.ConferenceId))
                                         .Where(s => s.ChairId == UserCredentials.Account.AccountId);
     }
     else
     {
         SessionsBox.DisplayMemberPath = "SpecialSessionDesc";
         SessionsBox.SelectedValuePath = "SpecialSessionId";
         SessionsBox.ItemsSource       = (await core.GetSpecialSessionsAsync(UserCredentials.Conference.ConferenceId))
                                         .Where(s => s.ChairId == UserCredentials.Account.AccountId);
     }
 }
示例#5
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;
        }