Ejemplo n.º 1
0
        /// <summary>
        /// lvwConferences_Click get the streams information of the selected conference and
        /// display it in the lvwStreams list view.
        /// </summary>
        /// <param name="sender">The event sender object</param>
        /// <param name="e">The event arguments</param>
        private void lvwConferences_Click(object sender, System.EventArgs e)
        {
            try
            {
                ArchiveService.Conference conf = (ArchiveService.Conference)lvwConferences.SelectedItems[0].Tag;
                Debug.Assert(conf != null);

                if (conf != null)
                {
                    ArchiveService.Participant[] participants = archiver.GetParticipants(conf.ConferenceID);
                    lvwStreams.Items.Clear();
                    foreach (ArchiveService.Participant participant in participants)
                    {
                        ArchiveService.Stream[] streams = archiver.GetStreams(participant.ParticipantID);

                        foreach (ArchiveService.Stream s in streams)
                        {
                            // TODO: Create the string array with enum (same as frmArchiveConf)
                            // TODO: Eventually use Tag to set to the stream
                            ListViewItem stream = new ListViewItem(
                                new string[] { participant.Name, s.Name, s.Payload, s.Frames.ToString(), s.StreamID.ToString() });
                            stream.Checked = true;
                            lvwStreams.Items.Add(stream);
                        }
                    }
                }

                UpdateSelectButtonState();
            }
            catch (System.Net.Sockets.SocketException ex)
            {
                MessageBox.Show(this,
                                "The Archive Service did not respond. Make sure the Archive Service you \n" +
                                "specified in ConferenceXP is correct and that server is online. \n" +
                                "For further assistance, contact your server's administrator. \n" +
                                "\nException Message: " + ex.Message,
                                "Archive Service Unavailable", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this,
                                "The Archive Service is currently unavailable or may have encountered an \n" +
                                "unexpected error. For further assistance contact your server's administrator. \n" +
                                "\nException:\n" + ex.ToString(), "Archive Service Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        public frmArchiveClient(IArchiveServer archiver, ArchiveService.Conference conference, int[] streams, FMain refFMain, frmArchiveConf refFrmArchiveConf)
        {
            InitializeComponent();

            // Duration of the current conference
            totalDuration = conference.End - conference.Start;

            sliderRange       = tbPlayBack.Maximum - tbPlayBack.Minimum;
            ratioTickBySlider = totalDuration.Ticks / sliderRange;

            Streams = streams;

            this.archiver          = archiver;
            this.conference        = conference;
            this.refFMain          = refFMain;
            this.refFrmArchiveConf = refFrmArchiveConf;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// lvwConferences_Click get the streams information of the selected conference and
        /// display it in the lvwStreams list view.
        /// </summary>
        /// <param name="sender">The event sender object</param>
        /// <param name="e">The event arguments</param>
        private void lvwConferences_Click(object sender, System.EventArgs e)
        {
            try
            {
                ArchiveService.Conference conf = (ArchiveService.Conference)lvwConferences.SelectedItems[0].Tag;
                Debug.Assert(conf != null);

                if (conf != null)
                {
                    ArchiveService.Participant[] participants = archiver.GetParticipants(conf.ConferenceID);
                    lvwStreams.Items.Clear();
                    foreach (ArchiveService.Participant participant in participants)
                    {
                        ArchiveService.Stream[] streams = archiver.GetStreams(participant.ParticipantID);

                        foreach (ArchiveService.Stream s in streams)
                        {
                            // TODO: Create the string array with enum (same as frmArchiveConf)
                            // TODO: Eventually use Tag to set to the stream
                            ListViewItem stream = new ListViewItem(new string[] { participant.Name, s.Name, s.Payload,
                                                                                  s.Frames.ToString(CultureInfo.CurrentCulture), s.StreamID.ToString(CultureInfo.CurrentCulture) });
                            stream.Checked = true;
                            lvwStreams.Items.Add(stream);
                        }
                    }
                }

                UpdateSelectButtonState();
            }
            catch (System.Net.Sockets.SocketException ex)
            {
                RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture,
                                                            Strings.ArchiveServiceUnavailableText, ex.Message), Strings.ArchiveServiceUnavailableTitle,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1,
                                        (MessageBoxOptions)0);
            }
            catch (Exception ex)
            {
                RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture,
                                                            Strings.ArchiveServiceErrorText, ex.ToString()), Strings.ArchiveServiceErrorTitle,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1,
                                        (MessageBoxOptions)0);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get the selected conference and open the dialog box that allows to
        /// select the streams to play for this conference
        /// </summary>
        /// <param name="sender">The event sender object</param>
        /// <param name="e">The event arguments</param>
        private void btnSelect_Click(object sender, System.EventArgs e)
        {
            // Ensure there is an item selected (the listview is configured for single row select)
            Debug.Assert(lvwConferences.SelectedItems.Count == 1);

            // Get the conference ID of the selected item in the listview
            ArchiveService.Conference conf = (ArchiveService.Conference)lvwConferences.SelectedItems[0].Tag;

            this.Hide();

            // Note: we pass a reference to FMain form and this form in the ctor so the created form
            //       can communicate with FMain and this form
            frmArchiveClient client = new frmArchiveClient(this.archiver, conf, Streams, this.refFMain, this);

            client.Show();
            client.Location = new Point(
                SystemInformation.WorkingArea.Right - client.Width,
                SystemInformation.WorkingArea.Bottom - client.Height);
        }
Ejemplo n.º 5
0
        static public Conference[] GetConferences()
        {
            try
            {
                SqlConnection conn = new SqlConnection( Constants.SQLConnectionString);
                SqlCommand cmd = new SqlCommand("GetConferences", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                conn.Open();
                SqlDataReader r = cmd.ExecuteReader(CommandBehavior.SingleResult);

                ArrayList conList = new ArrayList(10);
                while( r.Read())
                {
                    Conference conf = new Conference(   
                        r.GetInt32(0),      // conference id
                        r.GetString(1),     // conference description
                        r.GetString(2),     // venue name
                        r.GetDateTime(3),   // start date time
                        r.IsDBNull(4) ? DateTime.MinValue : r.GetDateTime(4) ); // end date time
                    conList.Add(conf);
                }

                r.Close();
                conn.Close();

                return ( Conference[]) conList.ToArray( typeof(Conference));
            }
            catch( SqlException ex )
            {
                eventLog.WriteEntry(string.Format(CultureInfo.CurrentCulture, Strings.DatabaseOperationFailedError, 
                    ex.ToString()), EventLogEntryType.Error, ArchiveServiceEventLog.ID.DBOpFailed );
                throw;
            }
        }
Ejemplo n.º 6
0
        public frmArchiveClient(IArchiveServer archiver, ArchiveService.Conference conference, int[] streams, FMain refFMain, frmArchiveConf refFrmArchiveConf)
        {
            InitializeComponent();

            // Duration of the current conference
            totalDuration = conference.End - conference.Start;

            sliderRange = tbPlayBack.Maximum - tbPlayBack.Minimum;
            ratioTickBySlider = totalDuration.Ticks / sliderRange;

            Streams = streams;

            this.archiver = archiver;
            this.conference = conference;
            this.refFMain = refFMain;
            this.refFrmArchiveConf = refFrmArchiveConf;
        }
Ejemplo n.º 7
0
        public void Connect()
        {
            try
            {
                // - Display wait message
                Cursor.Current = Cursors.WaitCursor;

                // - Get conferences ordered by start time
                Conference[] confs = DBHelper.GetConferences();

                // - Add items with parents: year, month, date
                TreeNode   lastNode = null;
                Conference lastConf = null;

                if (confs != null && confs.Length > 0)
                {
                    this.Nodes.Clear();
                }
                foreach (Conference conf in confs)
                {
                    TreeNode newNode = new TreeNode(string.Format(CultureInfo.CurrentCulture, Strings.Conference,
                                                                  conf.Start.ToShortTimeString(), conf.Description));
                    newNode.Tag                = conf;
                    newNode.ImageIndex         = conferenceImageIndex;
                    newNode.SelectedImageIndex = conferenceImageIndex;

                    TreeNode parent     = null;
                    bool     tripSwitch = (lastNode == null);

                    #region Add parents for this node
                    // Optimize creation of parents by tracking the last node & using the knowledge
                    //  that confs is organized by startTime (thank you, Mr. SQL, for the "order by" command.)

                    // My apologies for the lack of readability of this code.  It _was_ worse...
                    if (tripSwitch || conf.Start.Year != lastConf.Start.Year)
                    {
                        parent                    = this.Nodes.Add(conf.Start.Year.ToString(CultureInfo.InvariantCulture));
                        parent.Tag                = ParentNode.Year;
                        parent.ImageIndex         = folderImageIndex;
                        parent.SelectedImageIndex = parent.ImageIndex;

                        if (tripSwitch != true)
                        {
                            tripSwitch = true;
                        }
                    }
                    if (tripSwitch || conf.Start.Month != lastConf.Start.Month)
                    {
                        if (!tripSwitch)
                        {
                            parent = lastNode.Parent.Parent.Parent;
                        }

                        parent                    = parent.Nodes.Add(conf.Start.ToString("MMMM", CultureInfo.InvariantCulture));
                        parent.Tag                = ParentNode.Month;
                        parent.ImageIndex         = folderImageIndex;
                        parent.SelectedImageIndex = parent.ImageIndex;

                        if (tripSwitch != true)
                        {
                            tripSwitch = true;
                        }
                    }
                    if (tripSwitch || conf.Start.Day != lastConf.Start.Day)
                    {
                        if (!tripSwitch)
                        {
                            parent = lastNode.Parent.Parent;
                        }

                        parent                    = parent.Nodes.Add(conf.Start.ToLongDateString());
                        parent.Tag                = ParentNode.Date;
                        parent.ImageIndex         = folderImageIndex;
                        parent.SelectedImageIndex = parent.ImageIndex;
                    }
                    else
                    {
                        parent = lastNode.Parent;
                    }
                    #endregion

                    // Pri3: Optimize getting of participants/streams.  Try to find a way to do it only after
                    //  each conference is expanded (note that a conference can't be "expanded" if it doesn't
                    //  have any children yet.  consider using a placeholder)
                    #region Get participants / streams
                    Participant[] participants = DBHelper.GetParticipants(conf.ConferenceID);
                    foreach (Participant part in participants)
                    {
                        // Create Participant node
                        TreeNode partNode = new TreeNode(string.Format(CultureInfo.CurrentCulture,
                                                                       Strings.Participant, part.CName));
                        partNode.Tag                = part;
                        partNode.ImageIndex         = participantImageIndex;
                        partNode.SelectedImageIndex = partNode.ImageIndex;

                        // Add all of the streams for this participant
                        Stream[] streams = DBHelper.GetStreams(part.ParticipantID);
                        foreach (Stream str in streams)
                        {
                            TreeNode streamNode = partNode.Nodes.Add(string.Format(CultureInfo.CurrentCulture,
                                                                                   Strings.Stream, str.Name));
                            streamNode.Tag = str;

                            // Set the payload type icon
                            MSR.LST.Net.Rtp.PayloadType payload = (MSR.LST.Net.Rtp.PayloadType)Enum.Parse(typeof(MSR.LST.Net.Rtp.PayloadType), str.Payload);
                            if (payload == MSR.LST.Net.Rtp.PayloadType.dynamicVideo)
                            {
                                streamNode.ImageIndex = videoImageIndex;
                            }
                            else if (payload == MSR.LST.Net.Rtp.PayloadType.dynamicAudio)
                            {
                                streamNode.ImageIndex = soundImageIndex;
                            }
                            else //if( payload == MSR.LST.Net.Rtp.PayloadType.dynamicPresentation )
                            {
                                streamNode.ImageIndex = presentationImageIndex;
                            }

                            streamNode.SelectedImageIndex = streamNode.ImageIndex;
                        }

                        newNode.Nodes.Add(partNode);
                    }
                    #endregion

                    parent.Nodes.Add(newNode);
                    lastNode = newNode;
                    lastConf = conf;
                }

                foreach (TreeNode rootNode in base.Nodes)
                {
                    rootNode.Expand();
                }

                this.canConnect = true;

                // - Remove wait message
                Cursor.Current = Cursors.Default;
            }
            catch
            {
                this.canConnect = false;
            }
        }