Beispiel #1
0
        private void databaseConnect()
        {
            Action EmptyDelegate = delegate() { };

            control.ShadowBoxText.Text   = "Connecting to Database...";
            control.ShadowBox.Visibility = Visibility.Visible;
            control.UpdateLayout();
            control.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate);

            bool isConnected = DatabaseHandler.Connect();

            if (isConnected)
            {
                if (!DatabaseHandler.ChangeDatabase(Properties.Settings.Default.DatabaseName))
                {
                    Properties.Settings.Default.DatabaseName = null;
                    Properties.Settings.Default.Save();
                }
            }
            else
            {
                MessageTools.Warning("Unable to connect to database, please check your settings");
                Properties.Settings.Default.DatabaseAutoLogin = false;
                Properties.Settings.Default.Save();
            }

            updateNavigator();

            control.ShadowBox.Visibility = Visibility.Collapsed;
            control.ShadowBoxText.Text   = "Loading Data...";
        }
 private void DataBaseResultsBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (DatabaseBox.SelectedItem != null)
     {
         string name = DatabaseBox.SelectedItem.ToString();
         DatabaseHandler.ChangeDatabase(name);
         GetSessions();
     }
 }
Beispiel #3
0
        private void DatabasesBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (DatabasesBox.SelectedItem != null)
            {
                string name = DatabasesBox.SelectedItem.ToString();
                DatabaseHandler.ChangeDatabase(name);
                LoadSessionSets();
            }

            Update();
        }
Beispiel #4
0
 private void DatabasesBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (DatabasesBox.SelectedItem != null)
     {
         string name = DatabasesBox.SelectedItem.ToString();
         DatabaseHandler.ChangeDatabase(name);
         GetAnnotators();
         GetRoles();
         GetSchemes();
         getBayesianNetworks();
     }
 }
Beispiel #5
0
        private void DatabaseResultsBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (DatabaseBox.SelectedItem != null)
            {
                DatabaseHandler.ChangeDatabase(DatabaseBox.SelectedItem.ToString());
                DatabaseDBMeta meta = new DatabaseDBMeta {
                    Name = DatabaseBox.SelectedItem.ToString()
                };
                if (DatabaseHandler.GetDBMeta(ref meta))
                {
                    ServerLoginPanel.Visibility = meta.ServerAuth? Visibility.Visible : Visibility.Collapsed;
                }

                GetSessions();
                GetStreams();

                AnnotationsBox.ItemsSource = null;

                DatabaseSession session = (DatabaseSession)SessionsBox.SelectedItem;
                GetAnnotations(session);
            }
        }
        private void DatabaseBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (DatabaseBox.SelectedItem != null)
            {
                string db = DatabaseBox.SelectedItem.ToString();
                DatabaseHandler.ChangeDatabase(db);

                if (DatabaseHandler.CheckAuthentication(db) > 3)
                {
                    AddAnnotator.IsEnabled    = true;
                    DeleteAnnotator.IsEnabled = true;
                    EditAnnotator.IsEnabled   = true;
                }
                else
                {
                    AddAnnotator.IsEnabled    = false;
                    DeleteAnnotator.IsEnabled = false;
                    EditAnnotator.IsEnabled   = false;
                }

                Refresh();
            }
        }
Beispiel #7
0
        public void loadProjectFile(string filepath)
        {
            clearWorkspace();

            string workdir = Path.GetDirectoryName(filepath);

            XmlDocument doc = new XmlDocument();

            try
            {
                doc.Load(filepath);

                foreach (XmlNode node in doc.SelectNodes("//media"))
                {
                    string path = FileTools.GetAbsolutePath(node.InnerText, workdir);
                    loadFile(path);
                }

                foreach (XmlNode node in doc.SelectNodes("//signal"))
                {
                    Color background = Defaults.Colors.Background;
                    Color foreground = Defaults.Colors.Foreground;
                    if (node.Attributes["bg"] != null)
                    {
                        background = (Color)ColorConverter.ConvertFromString(node.Attributes["bg"].LastChild.Value);
                    }
                    if (node.Attributes["fg"] != null)
                    {
                        foreground = (Color)ColorConverter.ConvertFromString(node.Attributes["fg"].LastChild.Value);
                    }
                    string path = FileTools.GetAbsolutePath(node.InnerText, workdir);
                    loadFile(path, foreground, background);
                }

                if (DatabaseHandler.IsConnected)
                {
                    XmlNode node = doc.SelectSingleNode("//tiers");
                    if (node != null && node.Attributes["database"] != null)
                    {
                        DatabaseHandler.ChangeDatabase(node.Attributes["database"].LastChild.Value);
                    }
                }

                foreach (XmlNode node in (doc.SelectNodes("//tier")))
                {
                    string path = node.InnerText;
                    if (!Path.HasExtension(path))
                    {
                        AnnoList annoList = DatabaseHandler.LoadAnnoList(path);
                        if (annoList != null)
                        {
                            addAnnoTier(annoList);
                        }
                        else
                        {
                            MessageTools.Warning("Could not load annotation from database with id '" + node.InnerText + "'");
                        }
                    }
                    else
                    {
                        if (path == "")
                        {
                            path = node.Attributes["filepath"].LastChild.Value;
                        }
                        path = FileTools.GetAbsolutePath(path, workdir);
                        loadFile(path);
                    }
                }
            }
            catch (Exception e)
            {
                MessageTools.Error(e.ToString());
            }
        }