Ejemplo n.º 1
0
 public void Call(List <string> participants, bool fullscreen = true, int display = 0)
 {
     automation.BeginStartConversation(
         AutomationModalities.Video,
         participants,
         null,
         (ar) =>
     {
         ConversationWindow window = automation.EndStartConversation(ar);
         if (fullscreen)
         {
             CallWindow.ShowFullscreen(window, display);
         }
     },
         null);
 }
Ejemplo n.º 2
0
        internal void SendMessage(string inviteeEmail, string imText)
        {
            try
            {
                // Create a generic List object to contain a contact URI.
                // Ensure that a valid URI is added.
                inviteeList = new List <string>();
                inviteeList.Add(inviteeEmail);

                if (_ModalitySettings.ContainsKey(AutomationModalitySettings.FirstInstantMessage))
                {
                    _ModalitySettings[AutomationModalitySettings.FirstInstantMessage] = subject + "! : " + imText;
                }
                else
                {
                    _ModalitySettings.Add(AutomationModalitySettings.FirstInstantMessage, subject + "! : " + imText);
                }
                // Start the conversation.
                IAsyncResult ar = _Automation.BeginStartConversation(_ChosenMode,
                                                                     inviteeList,
                                                                     _ModalitySettings,
                                                                     null,
                                                                     null);


                //Block UI thread until conversation is started
                _Automation.EndStartConversation(ar);
            }
            catch (Exception)
            {
            }
        }
        internal void SendMessage(string imText)
        {
            try
            {
                if (_ModalitySettings.ContainsKey(AutomationModalitySettings.FirstInstantMessage))
                {
                    _ModalitySettings[AutomationModalitySettings.FirstInstantMessage] = "JIRA Tool Error! : " + imText;
                }
                else
                {
                    _ModalitySettings.Add(AutomationModalitySettings.FirstInstantMessage, "JIRA Tool Error! : " + imText);
                }
                // Start the conversation.
                IAsyncResult ar = _Automation.BeginStartConversation(_ChosenMode,
                                                                     inviteeList,
                                                                     _ModalitySettings,
                                                                     null,
                                                                     null);


                //Block UI thread until conversation is started
                _Automation.EndStartConversation(ar);
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 4
0
        public void SendIM()
        {
            Console.WriteLine("exiting");

            //Get a Lync client automation object.
            LyncClient client     = LyncClient.GetClient();
            Automation automation = LyncClient.GetAutomation();

            //Add two URIs to the list of IM addresses.
            System.Collections.Generic.List <string> inviteeList = new System.Collections.Generic.List <string>();
            inviteeList.Add(ConfigurationManager.AppSettings["UserURI"]);
            //inviteeList.Add(ConfigurationManager.AppSettings["CallingUserURI"]);
            inviteeList.Add(ConfigurationManager.AppSettings["UserURI2"]);

            //Specify IM settings.
            System.Collections.Generic.Dictionary <AutomationModalitySettings, object> mSettings = new System.Collections.Generic.Dictionary <AutomationModalitySettings, object>();
            string messageText = ImMessageText();

            mSettings.Add(AutomationModalitySettings.FirstInstantMessage, messageText);
            mSettings.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, true);

            //Broadcast the IM messages.
            IAsyncResult ar = automation.BeginStartConversation(AutomationModalities.InstantMessage, inviteeList, mSettings, null, null);

            cWindow = automation.EndStartConversation(ar);
            AutoResetEvent completedEvent = new AutoResetEvent(false);

            completedEvent.WaitOne();
        }
 /// <summary>
 /// Handles callback for starting the IM conversation.
 /// </summary>
 private void StartConversationCallback(IAsyncResult ar)
 {
     try
     {
         conversation = automation.EndStartConversation(ar).Conversation;
     }
     catch (Exception ex) { MessageBox.Show("Error:    " + ex.Message); }
 }
Ejemplo n.º 6
0
        //callback method for the Automation.BeginStartConversation
        public void EndStartConversation(IAsyncResult res)
        {
            Automation automation = LyncClient.GetAutomation();

            //get the conversation object
            ConversationWindow window     = automation.EndStartConversation(res);
            Conversation       conference = window.Conversation;

            //display the conference URI
            textBox1.Text = "conference URI: " + conference.Properties[ConversationProperty.ConferencingUri] + "?" + conference.Properties[ConversationProperty.Id];
        }
        private void StartConversation_Callback(IAsyncResult ar)
        {
            ConversationWindow cw = Automation.EndStartConversation(ar);

            foreach (Participant participant in cw.Conversation.Participants)
            {
                if (participant.IsSelf)
                {
                    SelfParticipant = participant;
                    SelfParticipant.PropertyChanged += new EventHandler <ParticipantPropertyChangedEventArgs>(SelfParticipant_PropertyChanged);
                    IsInLobby = (bool)SelfParticipant.Properties[ParticipantProperty.IsInLobby];
                }
            }
            this.Dispatcher.Invoke(new Action(() =>
            {
                SelfParticipantStatus.Text = "In Lobby: " + IsInLobby.ToString();
            }), null);
        }
        //event handler sends conference invitations
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            Automation automation = LyncClient.GetAutomation();

            //add contact URIs to a List object
            List <string> inviteeList = new List <string>();

            for (int i = 0; i < listBox1.SelectedItems.Count; i++)
            {
                inviteeList.Add(listBox1.SelectedItems[i].ToString());
            }

            //create settings object
            Dictionary <AutomationModalitySettings, object> settings = new Dictionary <AutomationModalitySettings, object>();

            //specify message modality
            AutomationModalities mode = AutomationModalities.InstantMessage;

            //add settings to the settings object
            settings.Add(AutomationModalitySettings.FirstInstantMessage, "Weekly project status conference is starting...");
            settings.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, true);

            //launch the conference invite
            IAsyncResult ar = automation.BeginStartConversation(
                mode
                , inviteeList
                , settings
                , null
                , null);

            //get the conversation object
            ConversationWindow window     = automation.EndStartConversation(ar);
            Conversation       conference = window.Conversation;

            //display the conference URI
            textBox1.Text = "conference URI: " + conference.Properties[ConversationProperty.ConferencingUri] + "?" + conference.Properties[ConversationProperty.Id];
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            //check if the log file 15 exist, meaning Lync log files
            if (Directory.Exists(_logLocation_15))
            {
                //Array to hold the .uccapilog files
                string[] getLyncLogs = Directory.GetFiles(_logLocation_15, "*.uccapilog");
                //check the temp folder exist and clean
                CreateAndClean(getLyncLogs);
            }
            //check if the log file 16 exist, meaning Skype for business log files
            else if (Directory.Exists(_logLocation_16))
            {
                //Array to hold the .uccapilog files
                string[] getSkypelog = Directory.GetFiles(_logLocation_16, "*.uccapilog");
                //check if the temp folder exist and clean
                CreateAndClean(getSkypelog);
            }

            /*
             * following part was written by Christoph Weste and all credit goes to him
             * twitter account @_cweste
             */
            string s2 = null;

            if (args.Length > 0)
            {
                Console.WriteLine("User: {0}", args[0]);
            }
            if (args.Length > 1)
            {
                string s = args[1].ToString().Split(':')[1];
                int    i = s.Length;
                s2 = s.Substring(0, i - 1);
                Console.WriteLine("Contact: {0}", s2);
                Console.WriteLine("Contact: {0}", args[1]);
            }

            try
            {
                // Create the major UI Automation objects.
                Automation _Automation = LyncClient.GetAutomation();

                // Create a dictionary object to contain AutomationModalitySettings data pairs.
                Dictionary <AutomationModalitySettings, object> _ModalitySettings = new Dictionary <AutomationModalitySettings, object>();

                AutomationModalities _ChosenMode = AutomationModalities.FileTransfer | AutomationModalities.InstantMessage;
                //AutomationModalities _ChosenMode =  AutomationModalities.InstantMessage| AutomationModalities.FileTransfer;

                // Store the file path as an object using the generic List class.
                string myFileTransferPath = string.Empty;
                // Edit this to provide a valid file path.
                myFileTransferPath = @"c:\\tempSkype4b\\Skype4b_logs.zip";

                // Create a generic List object to contain a contact URI.

                String[] invitees = { s2 };
                // Adds text to toast and local user IMWindow text entry control.
                _ModalitySettings.Add(AutomationModalitySettings.FirstInstantMessage, "Hello attached you will get my Skype4B logfile");
                //_ModalitySettings.Add(AutomationModalitySettings.);
                _ModalitySettings.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, true);

                // Add file transfer conversation context type
                _ModalitySettings.Add(AutomationModalitySettings.FilePathToTransfer, myFileTransferPath);

                // Start the conversation.

                if (invitees != null)
                {
                    IAsyncResult ar = _Automation.BeginStartConversation(
                        _ChosenMode
                        , invitees
                        , _ModalitySettings
                        , null
                        , null);

                    // Block UI thread until conversation is started.
                    _Automation.EndStartConversation(ar);
                }
                //Console.ReadLine();
            }
            catch
            {
                Console.WriteLine("Error");
                Console.ReadLine();
            }
        }
Ejemplo n.º 10
0
        // notify the automation object and conversationWindow
        // that the conversation started.
        private void BeginConversationCallBack(IAsyncResult ar)
        {
            Automation _automation = ar.AsyncState as Automation;

            _conversationWindow = _automation.EndStartConversation(ar);
        }