Пример #1
0
 /// <summary>
 /// Construct a participant from a VenueService.Participant
 /// </summary>
 /// <param name="participant">VenueService.Participant</param>
 /// <param name="venue"></param>
 internal Participant(VenueService.Participant participant)
 {
     identifier = participant.Identifier;
     name       = participant.Name;
     email      = participant.Email;
     icon       = Utilities.ByteToBitmap(participant.Icon);
     role       = ParticipantRole.Other;
 }
Пример #2
0
 /// <summary>
 /// Construct a participant from a VenueService.Participant
 /// </summary>
 /// <param name="participant">VenueService.Participant</param>
 /// <param name="venue"></param>
 internal Participant(VenueService.Participant participant)
 {
     identifier         = participant.Identifier;
     name               = participant.Name;
     email              = participant.Email;
     icon               = Utilities.ByteToBitmap(participant.Icon);
     role               = ParticipantRole.Other;
     ThroughputWarnings = new List <ThroughputWarning>();
 }
Пример #3
0
        /// <summary>
        /// Gets a participant without mediating a problem, should it occur.
        /// </summary>
        public Participant GetParticipantUnmediated(string cname)
        {
            VenueService.Participant vp = this.GetParticipantData(cname);

            if (vp == null)
            {
                return(null);
            }
            else
            {
                return(new ConferenceXP.Participant(vp));
            }
        }
Пример #4
0
        public ParticipantEditor(Participant participantToEdit)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            iconInput.DefaultIcon = defaultParticipantIcon;

            // Show the venue information in the UI
            this.nameInput.Text = participantToEdit.Name;
            this.identifierInput.Text = participantToEdit.Identifier;
            this.emailInput.Text = participantToEdit.Email;
            this.iconInput.IconAsBytes = participantToEdit.Icon;

            this.original = participantToEdit;
        }
Пример #5
0
        public Participant GetParticipant(string cname, string name, string email, string phone)
        {
            VenueService.Participant vp = this.GetParticipantData(cname);

            if (vp == null)
            {
                // Create a minimal participant if venue service lookup failed
                vp            = new VenueService.Participant();
                vp.Identifier = cname;
            }

            // Pri3: Look for nulls & pick based on what's not null, instead of just using one or the other...

            vp.Name  = name;
            vp.Email = email;

            return(new Participant(vp));
        }
Пример #6
0
        private VenueService.Participant GetParticipantData(string cname)
        {
            VenueService.Participant vp = null;

            if (this.service != null && !this.venueServiceTimedOut)
            {
                try
                {
                    //Pri2: This should be an async call to the Venue Service
                    vp = service.GetParticipant(cname);

                    // Check for possible problems on the Venue Service
                    if (vp != null && vp.Identifier.ToLower() != cname.ToLower())
                    {
                        eventLog.WriteEntry(
                            "Venue Service returned a participant with an indentifier not machting "
                            + "the requested identifier.  Participant was rejected."
                            + "\n    Requested ID: " + cname
                            + "\n    Returned ID: " + vp.Identifier,
                            EventLogEntryType.Error, ConferenceEventLog.ID.Error);

                        return(null);
                    }
                }
                catch (Exception e)
                {
                    if (this.mediateTimeouts)
                    {
                        eventLog.WriteEntry("Unable to connect to Venue Service, using a generic Participant: " + e.ToString(), EventLogEntryType.Warning, 60);
                        this.venueServiceTimedOut = true;
                    }
                    else
                    {
                        throw;
                    }
                }
            }

            return(vp);
        }
Пример #7
0
        private VenueService.Participant GetParticipantData(string cname)
        {
            VenueService.Participant vp = null;

            if (this.service != null && !this.venueServiceTimedOut)
            {
                try
                {
                    //Pri2: This should be an async call to the Venue Service
                    vp = service.GetParticipant(cname);

                    // Check for possible problems on the Venue Service
                    if (vp != null && vp.Identifier.ToLower(CultureInfo.InvariantCulture) != cname.ToLower(CultureInfo.InvariantCulture))
                    {
                        eventLog.WriteEntry(string.Format(CultureInfo.CurrentCulture, Strings.IdentifierNotMatchingRequest,
                                                          cname, vp.Identifier), EventLogEntryType.Error, ConferenceEventLog.ID.Error);

                        return(null);
                    }
                }
                catch (Exception e)
                {
                    if (this.mediateTimeouts)
                    {
                        eventLog.WriteEntry(string.Format(CultureInfo.CurrentCulture, Strings.UnableToConnectUsingGenericParticipant,
                                                          e.ToString()), EventLogEntryType.Warning, 60);
                        this.venueServiceTimedOut = true;
                    }
                    else
                    {
                        throw;
                    }
                }
            }

            return(vp);
        }
Пример #8
0
 /// <remarks/>
 public void UpdateParticipantAsync(Participant p, object userState) {
     if ((this.UpdateParticipantOperationCompleted == null)) {
         this.UpdateParticipantOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateParticipantOperationCompleted);
     }
     this.InvokeAsync("UpdateParticipant", new object[] {
                 p}, this.UpdateParticipantOperationCompleted, userState);
 }
Пример #9
0
 /// <remarks/>
 public void UpdateParticipantAsync(Participant p) {
     this.UpdateParticipantAsync(p, null);
 }
Пример #10
0
 /// <remarks/>
 public System.IAsyncResult BeginUpdateParticipant(Participant p, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("UpdateParticipant", new object[] {
                 p}, callback, asyncState);
 }
Пример #11
0
 public void UpdateParticipant(Participant p) {
     this.Invoke("UpdateParticipant", new object[] {
                 p});
 }
Пример #12
0
 /// <remarks/>
 public void AddParticipantAsync(Participant p) {
     this.AddParticipantAsync(p, null);
 }
Пример #13
0
 public void AddParticipant(Participant p) {
     this.Invoke("AddParticipant", new object[] {
                 p});
 }
Пример #14
0
 /// <summary>
 /// Compiles all of the data on the screen and returns it as a venue.
 /// </summary>
 public Participant GetParticipant()
 {
     Participant part = new Participant(this.identifierInput.Text, this.nameInput.Text, 
         this.emailInput.Text, this.iconInput.IconAsBytes);
     return part;
 }
Пример #15
0
        public Participant[] GetParticipants()
        {
            this.UpdateFromFile();

            ICollection vals = participants.Values;
            Participant[] partArray = new Participant[vals.Count];
            vals.CopyTo(partArray, 0);
            return partArray;
        }
Пример #16
0
        /// <summary>
        /// Private: Validates that the specified participant's properties are valid
        /// </summary>
        /// <param name="p">the participant to validate</param>
        private static void ValidateParticipant(Participant p)
        {
            ValidateEmail(p.Identifier);

            if (p.Name != null && p.Name.Length > 255)
                 throw new SoapException("VenueServiceException",
                    new XmlQualifiedName("VSNameLengthException"));

            if ( p.Email != null && p.Email.Length > 0 )
                ValidateEmail(p.Email);

            // Check that the max image size does not exceed 96x96 pixels at 32-bit color depth
            if (p.Icon != null && p.Icon.Length > 36864)
                throw new SoapException("VenueServiceException",
                    new XmlQualifiedName("VSParticipantIconSizeException"));
        }
Пример #17
0
        /// <summary>
        /// Private: Validates that the specified participant's properties are valid
        /// </summary>
        /// <param name="p">the participant to validate</param>
        private static void ValidateParticipant( Participant p )
        {
            ValidateEmail( p.Identifier);

            if ( p.Name != null && p.Name.Length > 255 )
                throw new ArgumentException("Name must be between 1 and 255 characters long", p.Name );

            if ( p.Email != null && p.Email.Length > 0 )
                ValidateEmail(p.Email);

            // Set the max image size to 96x96 pixels at 32-bit color depth
            if ( p.Icon != null && p.Icon.Length > 36864 )
                throw new ArgumentException("Participant icon must be less than 36 KB (a 96x96 pixel image).");
        }
Пример #18
0
 public void AddParticipant(Participant p)
 {
     ValidateParticipant(p);
     storage.AddParticipant(p);
 }
Пример #19
0
 public void UpdateParticipant(Participant p)
 {
     ValidateParticipant(p);
     storage.UpdateParticipant(p);
 }
Пример #20
0
        public Participant[] GetParticipants()
        {
            SqlConnection conn = new SqlConnection( SQL_CONNECTION_STRING);
            SqlCommand cmd = new SqlCommand( "GetParticipants", conn );
            cmd.CommandType = CommandType.StoredProcedure;

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

            ArrayList participantsArray = new ArrayList();
            while ( r.Read() )
            {
                byte[] icon = null;
                if ( !r.IsDBNull(pICONLENGTH) )
                {
                    icon = new Byte[r.GetInt32(pICONLENGTH)];
                    r.GetBytes(pICON, 0,icon, 0, icon.Length);
                }

                Participant p = new Participant(
                    r.GetString(pIDENTIFIER),
                    r.GetString(pNAME),
                    r.IsDBNull(pEMAIL) ? null : r.GetString(pEMAIL),
                    icon );

                participantsArray.Add( p);
            }
            r.Close();
            conn.Close();

            return (Participant[])participantsArray.ToArray(typeof( Participant));
        }
Пример #21
0
        public void AddParticipant( Participant p )
        {
            ValidateParticipant(p);

            storage.AddParticipant(p);
        }
Пример #22
0
        /// <summary>
        /// Helper function to allow the profile on the Venue Service to be updated programmatically
        /// by a client UI without it needing to connect to the Venue Service via Web Services itself.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="phone"></param>
        /// <param name="email"></param>
        /// <param name="icon"></param>
        /// <param name="notify"></param>
        public static void UpdateProfileOnServer(string name, string phone, string email, Bitmap icon, bool notify)
        {
            if (venues.VenueService != null)
            {
                VenueService.Participant p = new VenueService.Participant();

                p.Identifier = Identity.Identifier;
                p.Name = name;
                p.Email = email;

                if (icon == null)
                {
                    p.Icon = null;
                }
                else
                {
                    p.Icon = Utilities.BitmapToByte(Utilities.GenerateThumbnail(icon));
                }

                venues.VenueService.UpdateParticipant(p);

                GetLocalParticipant();
            }
            else
            {
                MessageBox.Show("The application is not configured to talk to a Venue Service.  Profile Update was discarded.");
            }
        }
Пример #23
0
        public void UpdateParticipant( Participant p )
        {
            ValidateParticipant(p);

            storage.UpdateParticipant(p);
        }
Пример #24
0
        private ListViewItem CreateLvi(Participant part, int imageIndex)
        {
            // If the participant's name is null, show the identifier as the name
            string name = (part.Name == null || part.Name == String.Empty) ? part.Identifier : part.Name;
            string[] columns = new string[]{name, part.Identifier, part.Email};
            ListViewItem item = new ListViewItem(columns);
            item.ImageIndex = imageIndex;
            item.Tag = part;

            return item;
        }
Пример #25
0
        public void AddParticipant(Participant part)
        {
            this.UpdateFromFile();

            participants.Add(part.Identifier, part);

            WriteCacheToFile();
        }
Пример #26
0
        private static void GetLocalParticipant()
        {
            Participant p = null;

            // Are we configured to use a Venue Service?
            if (venues.VenueServiceUrl != null)
            {
                p = venues.GetParticipantUnmediated(Identity.Identifier);

                if (p == null && !venues.IsUnreachable) // We talked to the Venue Server properly, but no record was found
                {
                    if (createParticipantUIShowed == false)
                    {
                        createParticipantUIShowed = true; // Allows opt out to succeed
                        RaiseCreateProfile(); // This calls us back recursively
                        return;
                    }
                }
            }

            if (p == null)
            {
                // We're explicitly configured *not* to use a Venue Service, so use a default participant.
                // Create a minimal participant
                VenueService.Participant vp = new VenueService.Participant();
                vp.Identifier = Identity.Identifier;
                vp.Name = vp.Identifier;

                p = new Participant(vp);
            }

            localParticipant = p;

            // We may be refreshing the Local Participant after edits
            participants[localParticipant.Identifier] = localParticipant;
        }
Пример #27
0
        public void UpdateParticipant(Participant part)
        {
            this.UpdateFromFile();

            participants[part.Identifier] = part;

            WriteCacheToFile();
        }
Пример #28
0
        /// <summary>
        /// Helper function to allow the profile on the Venue Service to be added programmatically
        /// by a client UI without it needing to connect to the Venue Service via Web Services itself.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="phone"></param>
        /// <param name="email"></param>
        /// <param name="icon"></param>
        /// <param name="notify"></param>
        public static void AddProfileOnServer(string name, string phone, string email, Bitmap icon, bool notify)
        {
            if (ConfigurationManager.AppSettings[AppConfig.CXP_VenueService] != null)
            {
                VenueService.Participant p = new VenueService.Participant();

                p.Identifier = Identity.Identifier;
                p.Name = name;
                p.Email = email;

                if (icon == null)
                    p.Icon = null;
                else
                    p.Icon = Utilities.BitmapToByte(Utilities.GenerateThumbnail(icon));

                venues.VenueService.AddParticipant(p);

                GetLocalParticipant();
            }
            else
            {
                RtlAwareMessageBox.Show(null, Strings.ApplicationIsNotConfigured, string.Empty, MessageBoxButtons.OK, 
                    MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
            }
        }