Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            LoadCallIcons();
            callTimer = new Timer();
            callTimer.Interval = 1000;
            callTimer.Tick += OnCallDurationUpdate;
            participants = new SktParticipant.List();
            UiToWaitingMode();

            if (!System.IO.File.Exists(tutorials.path + tutorials.keyfilename))
            {
                throw new Exception(String.Format(
                    "The keyfile (.pfx) path or filename {0} is incorrect?", tutorials.path + tutorials.keyfilename));
            }
            X509Certificate2 cert = new X509Certificate2(tutorials.path + tutorials.keyfilename, tutorials.keypassword);

            skype = new SktSkype(this, cert, false, false, 8963);

            skype.events.OnParticipantSoundLevel        += OnParticipantSoundLevel;
            skype.events.OnParticipantVoiceStatus       += OnParticipantVoiceStatus;
            skype.events.OnSkypeMessage                 += OnSkypeMessage;
            skype.events.OnConversationLocalLivestatus  += OnConversationLocalLiveStatus;
            skype.events.OnConversationSpawnConference  += OnConversationSpawnConference;

            skype.events.OnConnect                      += OnConnect;
            skype.events.OnAccountStatus                += OnAccountStatus;

            skype.NewParticipant = (oid, skp) => { return new Participant(oid, skp); };

            this.FormClosing += Form1_FormClosing;
            skype.LaunchRuntime(tutorials.path + tutorials.runtime, true);
            skype.Connect();
        }
Ejemplo n.º 2
0
 /**  Retrieves the list of this conversation's current participants, which you can optionally request to be
   filtered. If no Participants pass the filter, an empty list will be returned (the method itself still
   returns true).
 @returns participants List of conversation Participant objects that passed the filter.
 @param [in] filter - SktConversation.PARTICIPANTFILTER - defaults to SktConversation.ALL Default value is SktConversation.PARTICIPANTFILTER.ALL
  */
 public SktParticipant.List GetParticipants(SktConversation.PARTICIPANTFILTER filter=SktConversation.PARTICIPANTFILTER.ALL)
 {
     if (skypeRef.logging) skypeRef.Log("Executing Conversation.GetParticipants");
     uint RequestId = skypeRef.encoder.AddMethodHeader(ClassId, 38, OID);
     skypeRef.encoder.AddEnumParam(1, (uint)filter);
     SktParticipant.List participants = new SktParticipant.List(); // We always guarantee non-null list is returned
     skypeRef.transport.SubmitMethodRequest (RequestId);
     int argNr, marker;
     do
     {
     marker = (char)skypeRef.transport.ReadByte();
     if (marker != 'z')
     {
         if (marker == 'N') skypeRef.Error("SktConversation.GetParticipants failed.");
         argNr = (char)skypeRef.transport.ReadByte();
         switch (argNr)
         {
             case 1:
                 participants = (SktParticipant.List)skypeRef.decoder.DecodeObjectList(19);
                 break;
             case 'z': marker = argNr; break; // exiting the arg loop if the method failed
             default:
                 skypeRef.Error(String.Format("Got unexpected response argument {0} from runtime in SktConversation.GetParticipants", argNr));
                 break;
         }
     }
     } while (marker != 'z');
     skypeRef.transport.ResumeSocketReaderFromMethod();
     return participants;
 }
Ejemplo n.º 3
0
 internal override SktObjectList CreateObjectList(uint classId)
 {
     SktObjectList newList;
     switch (classId)
     {
     case  19 : newList = new SktParticipant.List(); break;
     case  10 : newList = new SktContactGroup.List(); break;
     case  11 : newList = new SktVideo.List(); break;
     case   9 : newList = new SktMessage.List(); break;
     case   7 : newList = new SktVoicemail.List(); break;
     case   6 : newList = new SktTransfer.List(); break;
     case   2 : newList = new SktContact.List(); break;
     case  18 : newList = new SktConversation.List(); break;
     case   1 : newList = new SktContactSearch.List(); break;
     case  12 : newList = new SktSms.List(); break;
     case   5 : newList = new SktAccount.List(); break;
     default: skypeRef.Error(String.Format("Attempt to construct a list object with invalid class ID {0}", classId)); return null;
     }
     return newList;
 }
Ejemplo n.º 4
0
 public void AddCurrentParticipantsToNewConv(SktConversation conv)
 {
     participants = conv.GetParticipants(SktConversation.PARTICIPANTFILTER.ALL);
     foreach (Participant person in participants) AddParticipantToConversation(person);
 }
Ejemplo n.º 5
0
        // Now, this is the tricky bit! What happens when you first start out with an 1-on-1 call,
        // and then someone adds more people, making it into a conference call? Well, what happens is this:
        // 1. a new conversation is created, both people from old 1-on-1 call and the new ones get added in;
        // 2. the new conversation goes live;
        // 3. the old 1-on-1 conversation goes OFF live;
        // 4. in the old 1-on-1, a message gets posted with type SktMessage.TYPE.SPAWNED_CONFERENCE
        //    and this event will fire with new conversation in the e.spawned field.
        // At that point, what we need to do is to switcheverything over to that one.
        void OnConversationSpawnConference(SktConversation sender, SktEvents.OnConversationSpawnConferenceArgs e)
        {
            if (sender == liveSession)
            {
                // As participants are conversation-specific, our participants list is now invalid as well.
                // At this point we will need to do a *complete* re-load of both participants and the UI!
                participants.Clear();
                while (participantPanel.Controls.Count > 0) participantPanel.Controls.RemoveAt(0);

                liveSession = e.spawned;
                participants = liveSession.GetParticipants(SktConversation.PARTICIPANTFILTER.ALL);
                int participantsInNewConv = participants.Count;
                for (int i = 0; i < participantsInNewConv; i++)
                    AddParticipantToLiveSession((Participant)participants[i]);
            }
        }