public void clearButton_Click(object sender, EventArgs e)
 {
     List<Session> sl = new List<Session>();
     outputTextBox.Text = "";
     SyncSessionsLoadedEventArgs ea = new SyncSessionsLoadedEventArgs(sl, null, true);
     OnSyncSessionsLoaded(this, ea);
     setSessionsLoaded(false);
 }
        /// <summary>
        /// Load sessions into the table
        /// </summary>
        /// <param name="ea"></param>
        public void LoadSessions(SyncSessionsLoadedEventArgs ea)
        {
            DataGridViewRow dgvr = null;

            sessionList = ea.SessionList;
            templateSession = ea.SessionTemplate;
            ignoreExistingSessions = ea.IgnoreExistingSessions;

            Dictionary<String,Session> sessionsDictionary = new Dictionary<string,Session>();

            dataGridView1.SuspendLayout();
            dataGridView1.Rows.Clear();

            foreach (Session newSession in sessionList)
            {
                Session existingSession = sc.findSession(newSession);
                SessionAction action = new SessionAction(existingSession, newSession);

                // Make sure we skip over duplicate sessions
                if (!sessionsDictionary.ContainsKey(newSession.SessionKey))
                {
                    sessionsDictionary.Add(newSession.SessionKey, newSession);

                    dgvr = new DataGridViewRow();
                    dgvr.CreateCells(dataGridView1, getCellValues(action));
                    dgvr.Tag = action;
                    dataGridView1.Rows.Add(dgvr);
                }
            }

            if (ea.IgnoreExistingSessions == false)
            {
                foreach (Session existingSession in sc.getSessionList())
                {
                    if (!sessionsDictionary.ContainsKey(existingSession.SessionKey))
                    {
                        SessionAction action = new SessionAction(existingSession, null);

                        dgvr = new DataGridViewRow();
                        dgvr.CreateCells(dataGridView1, getCellValues(action));
                        dgvr.Tag = action;
                        dataGridView1.Rows.Add(dgvr);
                    }
                }
            }

            dataGridView1.ResumeLayout();
        }
 private void optionsControl1_SyncSessionsLoaded(object sender, SyncSessionsLoadedEventArgs e)
 {
     tableControl1.LoadSessions(e);
     if ( e.SessionList.Count > 0 )
         tabControl1.SelectTab(1);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void validateButton_Click(object sender, EventArgs e)
        {
            List<Session> sl = null;

            Session sessionTemplate = (Session)sessionComboBox.SelectedItem;
            if (sessionTemplate == null)
            {
                outputTextBox.Text = "You must have at least " +
                                     "one template session to choose from";
                return;
            }

            try
            {
                String url = "";
                if (fileRadioButton.Checked == true)
                {
                    url = fileTextBox.Text;
                }
                else if (urlRadioButton.Checked == true)
                {
                    url = urlTextBox.Text;
                }

                sl = csvImporter.loadSessions(url);
            }
            catch (Exception ex)
            {
                outputTextBox.Text = ex.Message;
                return;
            }

            int count = 0;
            if (sl != null)
            {
                count = sl.Count;
                outputTextBox.Text = count + " sessions loaded...";
                SyncSessionsLoadedEventArgs ea = new SyncSessionsLoadedEventArgs(sl, sessionTemplate,ignoreCheckBox.Checked);
                OnSyncSessionsLoaded (this, ea);
                setSessionsLoaded(true);
            }
        }
 /// <summary>
 /// Fire the SyncSessionsLoaded event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void OnSyncSessionsLoaded(Object sender, SyncSessionsLoadedEventArgs e)
 {
     if (SyncSessionsLoaded != null)
         SyncSessionsLoaded(sender, e);
 }