private void EditSession_Click(object sender, RoutedEventArgs e)
        {
            if (SessionsBox.SelectedItem != null)
            {
                DatabaseSession session = (DatabaseSession)SessionsBox.SelectedItem;
                string          name    = session.Name;

                DatabaseAdminSessionWindow dialog = new DatabaseAdminSessionWindow(ref session);
                dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                dialog.ShowDialog();

                if (dialog.DialogResult == true)
                {
                    DatabaseHandler.UpdateSession(name, session);

                    var sessions = SessionsBox.SelectedItems;
                    foreach (DatabaseSession s in sessions)
                    {
                        if (session != s)
                        {
                            session.Name = s.Name;
                            DatabaseHandler.UpdateSession(s.Name, session);
                        }
                    }

                    GetSessions(session.Name);
                }
            }
        }
        private void ImportfromFolder_Click(object sender, RoutedEventArgs e)
        {
            string path   = "";
            var    dialog = new System.Windows.Forms.FolderBrowserDialog();

            dialog.SelectedPath        = Properties.Settings.Default.DatabaseDirectory;
            dialog.ShowNewFolderButton = true;
            dialog.Description         = "Select the root folder of your sessions.";
            System.Windows.Forms.DialogResult result = System.Windows.Forms.DialogResult.None;

            try
            {
                dialog.SelectedPath = Properties.Settings.Default.DatabaseDirectory;
                result = dialog.ShowDialog();
            }

            catch
            {
                dialog.SelectedPath = "";
                result = dialog.ShowDialog();
            }


            if (result == System.Windows.Forms.DialogResult.OK)
            {
                path = dialog.SelectedPath;
                DatabaseSession            session       = new DatabaseSession();
                DatabaseAdminSessionWindow sessiondialog = new DatabaseAdminSessionWindow(ref session, false);
                sessiondialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                sessiondialog.ShowDialog();

                if (sessiondialog.DialogResult == true)
                {
                    foreach (var d in System.IO.Directory.GetDirectories(path))
                    {
                        var dir     = new DirectoryInfo(d);
                        var dirName = dir.Name;

                        DatabaseSession newSession = new DatabaseSession()
                        {
                            Name     = dirName,
                            Date     = session.Date,
                            Language = session.Language,
                            Location = session.Location
                        };
                        DatabaseHandler.AddSession(newSession);
                    }

                    GetSessions();
                }
            }
        }
        private void AddSession_Click(object sender, RoutedEventArgs e)
        {
            if (DatabaseBox.SelectedItem != null)
            {
                DatabaseSession session = new DatabaseSession()
                {
                    Date = DateTime.Today
                };

                DatabaseAdminSessionWindow dialog = new DatabaseAdminSessionWindow(ref session);
                dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                dialog.ShowDialog();

                if (dialog.DialogResult == true)
                {
                    if (DatabaseHandler.AddSession(session))
                    {
                        GetSessions(session.Name);
                    }
                }
            }
        }