/// <summary> /// 关闭音视频 /// </summary> public static void Close_AV(ConversationWindow conversationWindow) { try { AVModality avModality = (AVModality)conversationWindow.Conversation.SelfParticipant.Modalities[ModalityTypes.AudioVideo]; if (avModality != null) { AudioChannel audioChannel = avModality.AudioChannel; if (audioChannel != null && audioChannel.CanInvoke(ChannelAction.Stop)) { audioChannel.BeginStop(null, null); } VideoChannel videoChannel = avModality.VideoChannel; if (videoChannel != null && videoChannel.CanInvoke(ChannelAction.Stop)) { videoChannel.BeginStop(null, null); } } } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } finally { } }
/// <summary> /// 关闭所有会话 /// </summary> public static void CloseAllConversation(Action CallBack) { try { //离开会话 if (LyncHelper.MainConversation != null) { //关闭所有会话 //离开当前会话 //LyncHelper.MainConversation.Close(); LyncHelper.MainConversation.Close(); foreach (var conversation in ConversationCodeEnterEntity.conversationManager.Conversations) { ConversationWindow window = ConversationCodeEnterEntity.lyncAutomation.GetConversationWindow(conversation); window.Close(); } LyncHelper.MainConversation = null; } } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } finally { } }
// Get the hosting Conversation object and application data, and register for event notification // and update the user interface to "Ready". private void Initialize() { String appData; try { _conversation = (Conversation)Microsoft.Lync.Model.LyncClient.GetHostingConversation(); } catch (LyncClientException ex) { Logger("LyncClientException error: " + ex); } catch (Exception ex) { Logger("Other conversation initialization error: " + ex); } _conversation.ContextDataReceived += OnContextDataReceived; _conversation.ContextDataSent += OnContextDataSent; _conversation.InitialContextReceived += OnInitialContextReceived; _conversationWindow = _automation.GetConversationWindow(_conversation); appData = _conversation.GetApplicationData(_appId); Logger("Application data: " + appData); if (appData.Contains("open")) { channelStatus.Foreground = new SolidColorBrush(Colors.Green); channelStatus.Text = "Ready"; } }
// Callback method for the BeginSendContextData method. public void SendContextDataCallback(IAsyncResult res) { ConversationWindow _conversationWindow = ((Automation)res.AsyncState).EndStartConversation(res); InstantMessageModality instantMessage = (InstantMessageModality)_conversationWindow.Conversation.Modalities[ModalityTypes.InstantMessage]; instantMessage.BeginSendMessage("hello sdx - success!", SendCMessageCallback, null); }
/// <summary> /// 主会话关联 /// </summary> /// <param name="mainConversationWindow"></param> void MainConversationAbout(ConversationWindow mainConversationWindow) { try { if (mainConversationWindow != null) { //设置会话窗体的坐标位置和尺寸 this.ConversationM.DockConversationWindow(Constant.lyncClient, mainConversationWindow); } LyncHelper.MainConversation = mainConversationWindow; SpaceCodeEnterEntity.MainConversation = LyncHelper.MainConversation; this.SpaceView.PersonalSpace.ShareInConversationSelfNavicateCallBack = SpaceSelfNavicateCallBack; this.SpaceView.MeetingSpace.ShareInConversationSelfNavicateCallBack = SpaceSelfNavicateCallBack; this.SpaceView.PersonalSpace.ShareInConversationOtherNavicateCallBack = SpaceOtherNavicateCallBack; this.SpaceView.MeetingSpace.ShareInConversationOtherNavicateCallBack = SpaceOtherNavicateCallBack; } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
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> /// 加载会话窗体 /// </summary> /// <param name="window">指定窗体</param> public void DockConversationWindow(LyncClient lyncClient, ConversationWindow window) { try { Application.Current.MainWindow.Dispatcher.BeginInvoke(new Action(() => { try { if (!window.IsDocked) { //获取工作区域的宽度 int borWidth = MainWindow.MainPageInstance.GetWorkingArea_Width(); //获取工作区域的高度 int borHeight = Conference.MainWindow.MainPageInstance.GetWorkingArea_Height(); WindowsFormsHost host = this.conversationHost.winHost; System.Windows.Forms.Panel panel = this.conversationHost.panel; host.Width = panel.Width = borWidth - 110; host.Height = panel.Height = borHeight - 30; LyncHelper.DockToNewParentWindow(panel.Handle, this.DockInit); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); }; })); } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } }
public void run(LocalMap aMap, VoidFunction aCallback) { mJackedAi = new Dictionary <string, MapCharacter.MapCharaJackedAi>(); //AI Jack //jackできるか確認 foreach (string tName in mEvent.get <List <String> >("jack")) { if (!aMap.getCharacter(tName).canJackAi())//jack不可(イベント発火中止) { aCallback(); return; } } //jackする foreach (string tName in mEvent.get <List <String> >("jack")) { mJackedAi[tName] = aMap.getCharacter(tName).jackAi(); } //イベント発火 runEventList(() => { //jackしたAIを解放 foreach (KeyValuePair <string, MapCharacter.MapCharaJackedAi> tAi in mJackedAi) { tAi.Value.endJack(); } mJackedAi = new Dictionary <string, MapCharacter.MapCharaJackedAi>(); //会話ウィンドウを閉じる ConversationWindow.close(() => { aCallback(); }); }); }
/// <summary> /// Makes a call to the number in the parameter /// </summary> /// <param name="number">number to call</param> public void makeCall(String phoneNumber) { // Create a generic List object to contain the URI to call. // Edit this to provide a valid URI. List <string> participantUri = new List <string>(); //participantUri.Add("506 72944567"); //participantUri.Add("+972 3 5396852"); participantUri.Add(phoneNumber); // Start the conversation. LyncClient.GetAutomation().BeginStartConversation( AutomationModalities.Audio, participantUri, null, (ar) => { try { ConversationWindow newWindow = LyncClient.GetAutomation().EndStartConversation(ar); } catch (OperationException oe) { MessageBox.Show("Operation exception on start conversation " + oe.Message); }; }, null); }
/// <summary> /// 清除不在线的参会人 /// </summary> /// <param name="lyncClient"></param> /// <param name="conversationWindow"></param> public void RemoveNoAtLinePerson(ConversationWindow conversationWindow) { try { if (conversationWindow != null && conversationWindow.Conversation != null) { for (int i = conversationWindow.Conversation.Participants.Count - 1; i > -1; i--) { //获取参会人状态 double s = Convert.ToDouble(conversationWindow.Conversation.Participants[i].Contact.GetContactInformation(ContactInformationType.Availability)); //状态3500,对方在线 if (s == 18500 && conversationWindow.Conversation.CanInvoke(ConversationAction.AddParticipant)) { //邀请参会人 conversationWindow.Conversation.RemoveParticipant(conversationWindow.Conversation.Participants[i]); } } } } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } }
/// <summary> /// 邀请某人进入会话 /// </summary> public static void InviteSomeOneJoinMainConference(LyncClient lyncClient, ConversationWindow conversationWindow, string JoinPerson) { try { if (conversationWindow != null) { if (lyncClient.State == ClientState.SignedIn) { //获取参会人 Contact contact = ConversationCodeEnterEntity.contactManager.GetContactByUri(JoinPerson); //判断是否已加载 if (conversationWindow.Conversation.Participants.Where(Item => Item.Contact.Uri.Equals(contact.Uri)).Count() <= 0) { //获取参会人状态 double s = Convert.ToDouble(contact.GetContactInformation(ContactInformationType.Availability)); //状态3500,对方在线 if (s == 3500 && conversationWindow.Conversation.CanInvoke(ConversationAction.AddParticipant)) { //邀请参会人 conversationWindow.Conversation.AddParticipant(contact); } } } } } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } finally { } }
public void AddChildWindow(ConversationWindow window) { if (!Children.Contains(window)) { window.Closing += ChildWindow_Closing; Children.Add(window); } }
/// <summary> /// 启动会议 /// </summary> public void StartConferenceOnlyc(LyncClient lyncClient, string selfUri, ConversationWindow conversationWindow, string selfName) { try { try { Dictionary <AutomationModalitySettings, object> dic = new Dictionary <AutomationModalitySettings, object>(); dic.Add(AutomationModalitySettings.FirstInstantMessage, selfName + MainConversationAccrodingStr); dic.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, true); Constant.lyncAutomation.BeginStartConversation( AutomationModalities.InstantMessage, null, null, (ar) => { try { #region (会话窗体设置,参会人同步【呼叫】) //获取主会话窗 ConversationWindow window = Constant.lyncAutomation.EndStartConversation(ar); //设置会话窗体的事件 SettingConversationWindowEvent(window); ///注册会话更改事件 window.StateChanged += MainConversation_StateChanged; App.Current.Dispatcher.BeginInvoke(new Action(() => { // TimerJob.StartRun(new Action(() => // { // //启动邀请文件 // ConversationM.PPtShareHelper(Constant.PaintFileRoot + "\\" + Constant.InviteFile); // }), 1500); ShareWhiteboard(window, selfName); })); #endregion } catch (OperationException ex) { LogManage.WriteLog(typeof(LyncHelper), ex); }; }, null); } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } }
public static void InitGUI() { chapterWindow = new ChapterWindow(windowRect, new GUIContent(TC.get("Element.Name0")), "Window"); scenesWindow = new ScenesWindow(windowRect, new GUIContent(TC.get("Element.Name1")), "Window"); cutscenesWindow = new CutscenesWindow(windowRect, new GUIContent(TC.get("Element.Name9")), "Window"); booksWindow = new BooksWindow(windowRect, new GUIContent(TC.get("Element.Name11")), "Window"); itemsWindow = new ItemsWindow(windowRect, new GUIContent(TC.get("Element.Name18")), "Window"); setItemsWindow = new SetItemsWindow(windowRect, new GUIContent(TC.get("Element.Name59")), "Window"); playerWindow = new PlayerWindow(windowRect, new GUIContent(TC.get("Element.Name26")), "Window"); characterWindow = new CharactersWindow(windowRect, new GUIContent(TC.get("Element.Name27")), "Window"); conversationWindow = new ConversationWindow(windowRect, new GUIContent(TC.get("Element.Name31")), "Window"); advencedFeaturesWindow = new AdvencedFeaturesWindow(windowRect, new GUIContent(TC.get("AdvancedFeatures.Title")), "Window"); //adapatationProfileWindow = new AdaptationProfileWindow(windowRect, // new GUIContent(Language.GetText("ADAPTATION_PROFILES")), "Window"); //assesmentProfileWindow = new AssesmentProfileWindow(windowRect, // new GUIContent(Language.GetText("ASSESMENT_PROFILES")), "Window"); // Left menu buttons leftMenuContentScene = new GUIContent(); leftMenuContentScene.image = (Texture2D)sceneTexture; leftMenuContentScene.text = TC.get("Element.Name1"); leftMenuContentCutscene = new GUIContent(); leftMenuContentCutscene.image = (Texture2D)cutsceneTexture; leftMenuContentCutscene.text = TC.get("Element.Name9"); leftMenuContentBook = new GUIContent(); leftMenuContentBook.image = (Texture2D)bookTexture; leftMenuContentBook.text = TC.get("Element.Name11"); leftMenuContentItem = new GUIContent(); leftMenuContentItem.image = (Texture2D)itemTexture; leftMenuContentItem.text = TC.get("Element.Name18"); leftMenuContentSetItem = new GUIContent(); leftMenuContentSetItem.image = (Texture2D)setItemTexture; leftMenuContentSetItem.text = TC.get("Element.Name59"); leftMenuContentPlayer = new GUIContent(); leftMenuContentPlayer.image = (Texture2D)playerTexture; leftMenuContentPlayer.text = TC.get("Element.Name26"); leftMenuContentCharacter = new GUIContent(); leftMenuContentCharacter.image = (Texture2D)characterTexture; leftMenuContentCharacter.text = TC.get("Element.Name27"); leftMenuContentConversation = new GUIContent(); leftMenuContentConversation.image = (Texture2D)conversationTexture; leftMenuContentConversation.text = TC.get("Element.Name31"); leftMenuContentAdvanced = new GUIContent(); leftMenuContentAdvanced.image = (Texture2D)advancedTexture; leftMenuContentAdvanced.text = TC.get("AdvancedFeatures.Title"); }
private void MeetNow_Callback(IAsyncResult ar) { ConversationWindow cw = Automation.EndMeetNow(ar); this.Dispatcher.Invoke(new Action(() => { MeetNowStatusTextBlock.Text = cw.State.ToString(); }), null); }
//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]; }
void Init() { if (Window == null) { Window = new ConversationWindow(); Window.Activated+=Window_Activated; Window.Closing += Window_Closing; Window.message_textbox.PreviewKeyDown+=message_textbox_KeyDown; Window.DataContext = ViewModel; } }
void Init() { if (Window == null) { Window = new ConversationWindow(); Window.Activated += Window_Activated; Window.Closing += Window_Closing; Window.message_textbox.PreviewKeyDown += message_textbox_KeyDown; Window.DataContext = ViewModel; } }
/// <summary> /// 联系人同步(研讨客户端与lync同步) /// </summary> protected static void ParticalsSynchronous(LyncClient lyncClient, ConversationWindow conversationWindow, List <string> participantList) { try { if (conversationWindow != null && conversationWindow.Conversation != null) { List <string> tempList = new List <string>(); //重新填充主会话联系人列表(实际) foreach (var partical in conversationWindow.Conversation.Participants) { tempList.Add(partical.Contact.Uri); } //遍历所有参会人 foreach (var item in participantList) { //获取参会人 Contact contact = ConversationCodeEnterEntity.contactManager.GetContactByUri(item); //获取参会人状态 double s = Convert.ToDouble(contact.GetContactInformation(ContactInformationType.Availability)); //状态3500,对方不在线 if (s == 3500) { //呼叫在线参会人加入会话(添加参会人) if (conversationWindow.Conversation.CanInvoke(ConversationAction.AddParticipant)) { //添加除自己之外的参会人 if (!contact.Equals(lyncClient.Self.Contact)) { //对应实际参会人列表 if (!tempList.Contains(contact.Uri)) { //主会议关闭状态停止进行呼叫并中断 if (conversationWindow == null) { return; } //添加在线的参会人 conversationWindow.Conversation.AddParticipant(contact); } } } } } } else { } } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } }
private void buttonConversation_click(object sender, RoutedEventArgs e) { Button b = sender as Button; FriendData data = b.CommandParameter as FriendData; if (!ClientInformation.ConversationsWindows.ContainsKey(data.Username)) { ConversationWindow window = new ConversationWindow(data.Username); ClientInformation.ConversationsWindows.Add(data.Username, window); window.Show(); } }
/// <summary> /// 加载会话窗体 /// </summary> /// <param name="window">指定窗体</param> public void DockConversationWindow(LyncClient lyncClient, ConversationWindow window) { try { Application.Current.MainWindow.Dispatcher.BeginInvoke(new Action(() => { try { if (!window.IsDocked) { if (this.DockConversationWindowCallBack != null) { this.DockConversationWindowCallBack(new Action <int, int>((width, height) => { //获取工作区域的宽度 int borWidth = width; //获取工作区域的高度 int borHeight = height; WindowsFormsHost host = this.conversationHost.winHost; System.Windows.Forms.Panel panel = this.conversationHost.panel; host.Width = panel.Width = borWidth - 110; host.Height = panel.Height = borHeight - 30; //panel.MinimumSize = new System.Drawing.Size() { Height = 696 }; //if(borHeight<715) //{ // host.Height = panel.Height = borHeight - 20; //} //else //{ // host.Height = panel.Height = borHeight - 30; //} LyncHelper.DockToNewParentWindow(panel.Handle, this.DockInit); })); } } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); }; })); } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } }
private void onConversationStart(IAsyncResult result) { if (result.IsCompleted) { //get conversation window _conversationWindow = ((Automation)result.AsyncState).EndStartConversation(result); //wire up events _conversationWindow.NeedsSizeChange += _conversationWindow_NeedsSizeChange; _conversationWindow.NeedsAttention += _conversationWindow_NeedsAttention; //dock conversation window _conversationWindow.Dock(formHost.Handle); } }
public void Send(string meessage, string from) { KeyValuePair <string, ConversationWindow> item = ClientInformation.ConversationsWindows.ToList().Find(x => x.Key == from); if (item.Value == null) { ConversationWindow window = new ConversationWindow(from); ClientInformation.ConversationsWindows.Add(from, window); window.Show(); window.textBoxConversation.Text += from + " " + DateTime.Now + ": " + meessage + "\n"; } else { item.Value.textBoxConversation.Text += from + " " + DateTime.Now + ": " + meessage + "\n"; } }
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); }
/// <summary> /// 联系人同步(研讨客户端与lync同步) /// </summary> public void ParticalsSynchronous(ConversationWindow conversationWindow) { try { if (conversationWindow != null) { //清除主会话联系人列表(实际) List <string> list = new List <string>(); //重新填充主会话联系人列表(实际) foreach (var partical in conversationWindow.Conversation.Participants) { list.Add(partical.Contact.Uri); } //遍历所有参会人 foreach (var item in Constant.ParticipantList) { //获取参会人 Contact contact = Constant.lyncClient.ContactManager.GetContactByUri(item); //获取参会人状态 double s = Convert.ToDouble(contact.GetContactInformation(ContactInformationType.Availability)); //状态3500,对方不在线 if (s == 3500) { //呼叫在线参会人加入会话(添加参会人) if (conversationWindow.Conversation.CanInvoke(ConversationAction.AddParticipant)) { //添加除自己之外的参会人 if (!contact.Equals(Constant.lyncClient.Self.Contact)) { //对应实际参会人列表 if (!list.Contains(contact.Uri)) { //添加在线的参会人 conversationWindow.Conversation.AddParticipant(contact); } } } } } } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } }
private void ContactAction(string login) { if (!ConversationWindows.Any(cmv => cmv.Recipeint == login)) { var conversationWindow = new ConversationWindow(); var conversationViewModel = new ConversationViewModel(_logicClient); conversationViewModel.OnRequestClose += (s, ee) => { conversationWindow.Close(); DeleteFromConversationList(conversationViewModel.Recipeint); }; conversationViewModel.Initialize(login); conversationWindow.DataContext = conversationViewModel; conversationWindow.Show(); ConversationWindows.Add(conversationViewModel); } }
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); }
private void conversationManager_ConversationAdded(object sender, ConversationManagerEventArgs e) { e.Conversation.ParticipantAdded += new EventHandler <ParticipantCollectionChangedEventArgs> (Conversation_ParticipantAdded); e.Conversation.AddParticipant (_client.ContactManager.GetContactByUri(_remoteUri)); _conversationWindow = _automation.GetConversationWindow(e.Conversation); //wire up events _conversationWindow.NeedsSizeChange += _conversationWindow_NeedsSizeChange; _conversationWindow.NeedsAttention += _conversationWindow_NeedsAttention; //dock conversation window _conversationWindow.Dock(formHost.Handle); }
///イベントを一つ実行 private void runEvent(Arg aEvent, VoidFunction aCallback) { switch (aEvent.get <string>("event")) { case "log": //ログ出力 Debug.Log(aEvent.get <string>("value")); aCallback(); break; case "text": //会話イベント ConversationWindow.show(aEvent, () => { aCallback(); }); break; default: throw new Exception("MapEvent : 「" + aEvent.get <string>("event") + "」ってどんなイベント?"); } }
/// <summary> /// 主会话关联 /// </summary> /// <param name="mainConversationWindow"></param> void MainConversationAbout(ConversationWindow mainConversationWindow) { try { if (mainConversationWindow != null) { //设置会话窗体的坐标位置和尺寸 this.ConversationM.DockConversationWindow(Constant.lyncClient, mainConversationWindow); } LyncHelper.MainConversation = mainConversationWindow; } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 启动视频 /// </summary> /// <param name="conversationWindow"></param> public static void StartVideo(ConversationWindow conversationWindow) { try { ThreadPool.QueueUserWorkItem((o) => { AVModality avModality = (AVModality)conversationWindow.Conversation.SelfParticipant.Modalities[ModalityTypes.AudioVideo]; if (avModality != null) { VideoChannel videoChannel = avModality.VideoChannel; //object obV = videoChannel.InnerObject; if (videoChannel != null) { if (videoChannel != null && videoChannel.CanInvoke(ChannelAction.Start)) { videoChannel.BeginStart(null, null); } TimerJob.StartRun(new Action(() => { if (videoChannel.State != ChannelState.Connecting) { if (videoChannel != null && videoChannel.CanInvoke(ChannelAction.Start)) { videoChannel.BeginStart(null, null); } } }), 1500); LyncHelper.ExitFullScreen(); LyncHelper.FullScreen(); } } }); } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } finally { } }