/// <summary> /// 会议通讯节点信息发送管理中心 /// </summary> /// <param name="conferenceName">会议名称</param> /// <param name="pack">数据包</param> public static void SendClientCenterManage(Dictionary <string, MeetServerSocket> dicMeetServerSocket, string conferenceName, PackageBase pack) { try { //会议通讯节点字典集合是否包含此项 if (dicMeetServerSocket.ContainsKey(conferenceName)) { MeetServerSocket meetServerSocket = dicMeetServerSocket[conferenceName]; //获取会议通讯节点 ServerSocket ServerSocket = meetServerSocket.ServerSocket; //获取客户端通讯节点字典集合 Dictionary <string, SocketModel> dicSocket = meetServerSocket.DicClientSocket; //Thread.Sleep(100); //遍历客户端通讯节点字典集合 for (int i = dicSocket.Count - 1; i > -1; i--) { SocketModel socketModel = dicSocket.Values.ElementAt(i); switch (socketModel.SocketClientType) { case SocketClientType.PC: //会议通讯节点给客户端发送信息 ServerSocket.ServerSendData(socketModel.Socket, pack, new Action <bool>((successed) => { //socket.Poll(10, SelectMode.SelectRead) || !socket.Connected) Socket socket = socketModel.Socket; if (!successed || ServerSendData(socket, 10)) { //错误返回标示,异常废弃的客户端通讯节点 dicSocket.Remove(dicSocket.Keys.ElementAt(i)); } })); break; case SocketClientType.Android: if (pack.ConferenceAudioItemTransferEntity != null && pack.ConferenceAudioItemTransferEntity.Operation == ConferenceWebCommon.EntityHelper.ConferenceDiscuss.ConferenceAudioOperationType.AddType) { //传输json string json = CommonMethod.Serialize(pack); //会议通讯节点给手机端发送信息 ServerSocket.ServerSendData(socketModel.Socket, json, new Action <bool>((successed) => { Socket socket = socketModel.Socket; if (!successed || ServerSendData(socket, 10)) { //错误返回标示,异常废弃的客户端通讯节点 dicSocket.Remove(dicSocket.Keys.ElementAt(i)); //LogManage.WriteLog(typeof(Constant), "已作废一个节点,该节点为" + dicSocket.Keys.ElementAt(i)); } })); } break; default: break; } } } } catch (Exception ex) { LogManage.WriteLog(typeof(Constant), ex); } finally { } }
public static bool SetRefreshRate(uint displayIndex, double refreshRate) { try { uint uNumPathArrayElements = 0; uint uNumModeArrayElements = 0; IntPtr pPathArray = IntPtr.Zero; IntPtr pModeArray = IntPtr.Zero; IntPtr pCurrentTopologyId = IntPtr.Zero; long result; UInt32 numerator; UInt32 denominator; UInt32 scanLineOrdering; UInt32 flags; // get size of buffers for QueryDisplayConfig result = GetDisplayConfigBufferSizes(QDC_ALL_PATHS, out uNumPathArrayElements, out uNumModeArrayElements); if (result != 0) { // Log.Error("W7RefreshRateHelper.GetRefreshRate: GetDisplayConfigBufferSizes(...) returned {0}", result); return(false); } // allocate memory or QueryDisplayConfig buffers pPathArray = Marshal.AllocHGlobal((Int32)(uNumPathArrayElements * SIZE_OF_DISPLAYCONFIG_PATH_INFO)); pModeArray = Marshal.AllocHGlobal((Int32)(uNumModeArrayElements * SIZE_OF_DISPLAYCONFIG_MODE_INFO)); // get display configuration result = QueryDisplayConfig(QDC_ALL_PATHS, ref uNumPathArrayElements, pPathArray, ref uNumModeArrayElements, pModeArray, pCurrentTopologyId); // if failed log error message and free memory if (result != 0) { // Log.Error("W7RefreshRateHelper.GetRefreshRate: QueryDisplayConfig(...) returned {0}", result); Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return(false); } // get offset for a display's target mode info int offset = GetModeInfoOffsetForDisplayId(displayIndex, pModeArray, uNumModeArrayElements); // if failed log error message and free memory if (offset == -1) { //Log.Error("W7RefreshRateHelper.GetRefreshRate: Couldn't find a target mode info for display {0}", displayIndex); Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return(false); } // TODO: refactor to private method // set proper numerator and denominator for refresh rate UInt32 newRefreshRate = (uint)(refreshRate * 1000); switch (newRefreshRate) { case 23976: numerator = 24000; denominator = 1001; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 24000: numerator = 24000; denominator = 1000; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 25000: numerator = 25000; denominator = 1000; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 30000: numerator = 30000; denominator = 1000; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 50000: numerator = 50000; denominator = 1000; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 59940: numerator = 60000; denominator = 1001; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 60000: numerator = 60000; denominator = 1000; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; default: numerator = (uint)(newRefreshRate / 1000); denominator = 1; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; } // set refresh rate parameters in display config Marshal.WriteInt32(pModeArray, offset + 32, (int)numerator); Marshal.WriteInt32(pModeArray, offset + 36, (int)denominator); Marshal.WriteInt32(pModeArray, offset + 56, (int)scanLineOrdering); // validate new refresh rate flags = SDC_VALIDATE | SDC_USE_SUPPLIED_DISPLAY_CONFIG; result = SetDisplayConfig(uNumPathArrayElements, pPathArray, uNumModeArrayElements, pModeArray, flags); // adding SDC_ALLOW_CHANGES to flags if validation failed if (result != 0) { //Log.Debug("W7RefreshRateHelper.SetDisplayConfig(...): SDC_VALIDATE of {0}/{1} failed", numerator, denominator); flags = SDC_APPLY | SDC_USE_SUPPLIED_DISPLAY_CONFIG | SDC_ALLOW_CHANGES; } else { //Log.Debug("W7RefreshRateHelper.SetDisplayConfig(...): SDC_VALIDATE of {0}/{1} succesful", numerator, denominator); flags = SDC_APPLY | SDC_USE_SUPPLIED_DISPLAY_CONFIG; } // configuring display result = SetDisplayConfig(uNumPathArrayElements, pPathArray, uNumModeArrayElements, pModeArray, flags); // if failed log error message and free memory if (result != 0) { //Log.Error("W7RefreshRateHelper.SetDisplayConfig(...): SDC_APPLY returned {0}", result); Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return(false); } // refresh rate change successful Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); } catch (Exception ex) { LogManage.WriteLog(typeof(WindowExtentionManage), ex); } return(true); }
public MeetingSpace() { try { //UI加载 InitializeComponent(); #region 书架映射区域 //书架 base.GridBook = this.gridBook; //面包屑 base.BreadLineRoot = this.breadLineRoot; //书架主题 base.GridBookParent = this.gridParent; //左箭头 base.BtnArrowLeft = this.btnArrowLeft; //右箭头 base.BtnArrowRight = this.btnArrowRight; //资源推送 base.BtnResourceSend = this.btnResourceSend; //资源演示 base.BtnResourceShare = this.btnResourceShare; //资源下载 base.BtnResourceDownLoad = this.btnResourceDownLoad; //资源删除 base.BtnResourceDelete = this.btnResourceDelete; //资源移动 base.BtnResourceMove = this.btnResourceMove; //资源重命名 base.BtnResourceReName = this.btnResourceReName; //文件上传 base.BtnResourceUpload = this.btnResourceUpload; #endregion //加载提示 base.Loading = this.loading; //面板(存储本地应用) base.Panel = this.panel; //winform控件的宿主 base.Host = this.host; //装饰 base.BorDecorate = this.borDecorate; //视频 base.BorContent = this.borContent; //列表名称 base.listName = SpaceCodeEnterEntity.MeetingFolderName; //文件夹名称 base.folderName = SpaceCodeEnterEntity.ConferenceName; //根目录名称 base.root1 = SpaceCodeEnterEntity.ConferenceName; //智存空间入口点 base.SpaceBaseMainStart(); } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } }
/// <summary> /// 设置会话区域显示内容 /// </summary> /// <param name="showType"></param> public void SetConversationAreaShow(ShowType showType, bool forceChange) { try { bool isChanged = false; switch (showType) { case ShowType.ConversationView: if (forceChange) { isChanged = this.SetConversationArea_Conversation(); } else if (this.CurrentShowType != ShowType.SelfDeskTopShowView) { isChanged = this.SetConversationArea_Conversation(); } else if (this.CurrentShowType == ShowType.SelfDeskTopShowView) { isChanged = false; return; } break; case ShowType.SelfDeskTopShowView: if (forceChange) { isChanged = this.SetConversationArea_SelfDeskTopShowView(); } break; case ShowType.HidenView: if (forceChange) { isChanged = this.SetConversationArea_HidenView(); } else if (this.CurrentShowType != ShowType.SelfDeskTopShowView) { isChanged = this.SetConversationArea_HidenView(); } else if (this.CurrentShowType == ShowType.SelfDeskTopShowView) { isChanged = false; return; } break; default: break; } if (isChanged) { //设置当前选择视图类型 this.CurrentShowType = showType; } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 构造函数 /// </summary> public MainPage() { try { //UI加载 InitializeComponent(); #region 事件注册 //会议信息 this.btnMeet.Click += Navacite; //信息交流 this.btnIMM.Click += Navacite; //共享资源 this.btnResource.Click += Navacite; //智存空间 this.btnSpace.Click += Navacite; //知识树 this.btnTree.Click += Navacite; //会议投票 this.btnVote.Click += Navacite; //个人笔记 this.btnNote.Click += Navacite; //工具应用 this.btnTool.Click += Navacite; //主页面点击事件 this.PreviewMouseLeftButtonDown += MainPage_PreviewMouseLeftButtonDown; //会议室图例点击事件 this.ConferenceRoom_View.ItemClickCallBackToMainPage += conferenceRoom_View_ItemClick; //lync会话事件注册 LyncHelper.LyncConversationEventRegedit(HasConferenceEvent, MainConversationAbout, ConversationAddCompleateEvent, MainConversationInEvent, ContentAddCompleateEvent, //更改状态 ChangSharePanelState, GetPresenterCallBack); //工具箱子项更改事件 this.ToolCmWindow.SelectItemChanged += ToolCmWindow_SelectItemChanged; #endregion #region 事件注册(精简模式) //会议信息(精简模式) this.btnMeet2.Click += Navacite; //信息交流 this.btnIMM2.Click += Navacite; //共享资源 this.btnResource2.Click += Navacite; //智存空间 this.btnSpace2.Click += Navacite; //系统设置(精简模式有) this.btnSetting.Click += Navacite; #endregion #region 事件注册(教学模式) //我的课堂 this.btnMeetEducation.Click += Navacite; //互动课堂 this.btnResourceEducation.Click += Navacite; //教学资料 this.btnSpaceEducation.Click += Navacite; //课程大纲 this.btnTreeEducation.Click += Navacite; //系统设置(教学模式) this.btnSettingEducation.Click += Navacite; #endregion #region 加入会议并处理资源共享 //加入当前参与的一个会议 this.JoinConfereince(new Action(() => { //加载共享面板 //this.ConversationM.IsStart = true; //会话初始化 //this.LyncConversationInit(); })); #endregion #region 检测通讯是否正常(知识树) //检测通讯(知识树) base.CheckAndRepairClientSocekt(this.CheckNetWorkCallBack); #endregion #region 注册父类事件 //教育模式 base.ViewModelChangedEducationEvent += MainPage_ViewModelChangedEducationEvent; //精简模式 base.ViewModelChangedSimpleEvent += MainPage_ViewModelChangedSimpleEvent; //页面切换 base.ForceToNavicateEvent += MainPage_ForceToNavicateEvent; #endregion #region (lync应用校验)检测大屏投影是否同步 //this.lyncBigScreenConversationTimer = new DispatcherTimer(); //this.lyncBigScreenConversationTimer.Tick += lyncBigScreenConversationTimer_Tick; //this.lyncBigScreenConversationTimer.Interval = TimeSpan.FromSeconds(2); //this.lyncBigScreenConversationTimer.Start(); #endregion } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 会议开启通用方法 /// </summary> /// <param name="participantList">参会人</param> /// <param name="automationModeality">会话类型</param> protected static void StartConference_H(LyncClient lyncClient, string ConferenceName, string selfName, string mainConversationAccrodingStr, List <string> participantList, AutomationModalities automationModeality) { try { //在线联系人列表 List <string> OnlineParticpantList = new List <string>(); //遍历所有参会人并筛选在线参会人 foreach (var item in participantList) { //获取联系人 Contact contact = ConversationCodeEnterEntity.contactManager.GetContactByUri(item); //获取参会人状态 double s = Convert.ToDouble(contact.GetContactInformation(ContactInformationType.Availability)); //状态3500,对方不在线(s == 3500 && ) if (contact != lyncClient.Self.Contact) { OnlineParticpantList.Add(item); } } //Dictionary<AutomationModalitySettings, object> dic = new Dictionary<AutomationModalitySettings, object>(); //dic.Add(AutomationModalitySettings.FirstInstantMessage, ConferenceName + mainConversationAccrodingStr); //dic.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, true); ConversationCodeEnterEntity.lyncAutomation.BeginStartConversation( automationModeality, OnlineParticpantList, null, (ar) => { try { #region (会话窗体设置,参会人同步【呼叫】) //获取主会话窗 ConversationWindow conversationWindow = ConversationCodeEnterEntity.lyncAutomation.EndStartConversation(ar); //设置会话窗体的事件 SettingConversationWindowEvent(conversationWindow); ///注册会话更改事件 conversationWindow.StateChanged -= MainConversation_StateChanged; ///注册会话更改事件 conversationWindow.StateChanged += MainConversation_StateChanged; Application.Current.Dispatcher.BeginInvoke(new Action(() => { ShareWhiteboard(conversationWindow, selfName, new Action(() => { //LyncHelper.AvConnect(conversationWindow); //TimerJob.StartRun(new Action(() => // { // Close_AV(conversationWindow); // }), 800); })); })); #endregion } catch (OperationException ex) { LogManage.WriteLog(typeof(LyncHelper), ex); }; }, null); } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } }
/// <summary> /// 样式收集 /// </summary> public void StyleCollection() { try { if (this.Resources.Contains("btnSyle1_Selected")) { //按钮样式选择1 this.btnSyle1_Selected = this.Resources["btnSyle1_Selected"] as Style; } if (this.Resources.Contains("btnSyle2_Selected")) { //按钮样式选择2 this.btnSyle2_Selected = this.Resources["btnSyle2_Selected"] as Style; } if (this.Resources.Contains("btnSyle1")) { //按钮样式1 this.btnSyle1 = this.Resources["btnSyle1"] as Style; } if (this.Resources.Contains("btnSyle2")) { //按钮样式2 this.btnSyle2 = this.Resources["btnSyle2"] as Style; } //当前应该程序资源 ResourceDictionary resource = Application.Current.Resources; if (resource.Contains("brush_Tool2")) { //工具画刷2 this.brush_Tool2 = resource["brush_Tool2"] as ImageBrush; } if (resource.Contains("brush_U_Disk1")) { // u盘传输画刷 this.brush_U_Disk1 = resource["brush_U_Disk1"] as ImageBrush; } if (resource.Contains("brush_Meet_Change1")) { //会议切换画刷 this.brush_Meet_Change1 = resource["brush_Meet_Change1"] as ImageBrush; } if (resource.Contains("brush_Chair1")) { //主持人画刷 this.brush_Chair1 = resource["brush_Chair1"] as ImageBrush; } if (resource.Contains("brush_Studiom1")) { //中控画刷 this.brush_Studiom1 = resource["brush_Studiom1"] as ImageBrush; } if (resource.Contains("brush_Setting1")) { //系统设置画刷 this.brush_Setting1 = resource["brush_Setting1"] as ImageBrush; } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 知识树模块数据准备 /// </summary> public void TreeDataInitPrepare() { try { //客户端上下文管理 TreeCodeEnterEntity.ClientContextManage = Constant.clientContextManage; //会议纪要模板名称 TreeCodeEnterEntity.ConferenceCommentHtmlTemp = Constant.ConferenceCommentHtmlTemp; //会议名称 TreeCodeEnterEntity.ConferenceName = Constant.ConferenceName; //是否为会议主持人 TreeCodeEnterEntity.IsMeetPresenter = Constant.IsMeetingPresenter; //PaintFileRoot路径 TreeCodeEnterEntity.LocalTempRoot = Constant.LocalTempRoot; //用户登录名 TreeCodeEnterEntity.LoginUserName = Constant.LoginUserName; //主窗体引用 TreeCodeEnterEntity.MainWindow = MainWindow.mainWindow; //会议根目录 TreeCodeEnterEntity.MeetingFolderName = Constant.MeetingFolderName; //PaintFileRoot路径 TreeCodeEnterEntity.FileRoot = Constant.FileRoot; //参会人列表 TreeCodeEnterEntity.ParticipantList = Constant.ParticipantList; //上传的录制视频名称 TreeCodeEnterEntity.ReacordUploadFileName = Constant.ReacordUploadFileName; //录制视频格式 TreeCodeEnterEntity.RecordExtention = Constant.RecordExtention; //录制文件夹名称 TreeCodeEnterEntity.RecordFolderName = Constant.RecordFolderName; //用户名称 TreeCodeEnterEntity.SelfName = Constant.SelfName; //当前用户的uri地址 TreeCodeEnterEntity.SelfUri = Constant.SelfUri; //SharePoint服务IP地址 TreeCodeEnterEntity.SPSiteAddressFront = Constant.SPSiteAddressFront; //临时存储的会议信息 TreeCodeEnterEntity.TempConferenceInformationEntity = Constant.TempConferenceInformationEntity; //节点默认名称 TreeCodeEnterEntity.TreeItemEmptyName = Constant.TreeItemEmptyName; //知识树xml文件名称 TreeCodeEnterEntity.TreeXmlFileName = Constant.TreeXmlFileName; //域名 TreeCodeEnterEntity.UserDomain = Constant.UserDomain; //投票标题集合 TreeCodeEnterEntity.VoteChatTittleList = Constant.VoteChatTittleList; //智存空间登陆密码 TreeCodeEnterEntity.WebLoginPassword = Constant.WebLoginPassword; //智存空间登陆用户名 TreeCodeEnterEntity.WebLoginUserName = Constant.WebLoginUserName; //智存空间地址 TreeCodeEnterEntity.SpaceWebSiteUri = Constant.SpaceWebSiteUri; //pdf转换器 TreeCodeEnterEntity.PdfTransferAppName = Constant.PdfTransferAppName; } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 显示操作提示 /// </summary> /// <param name="item"></param> public static void ShowOperationTip(ConferenceTreeItem item, string operater) { try { if (!operater.Equals(TreeCodeEnterEntity.SelfName)) { #region 显示操作提示 if (!string.IsNullOrEmpty(item.TitleOperationer) && item.TitleOperationer.Equals(operater)) { if (item.OperationVisibilityTimer != null) { item.CanSettingEditCollpased = false; item.OperationVisibilityTimer.Stop(); item.OperationVisibilityTimer = null; TimerJob.StartRun(new Action(() => { item.OperationVisibility = Visibility.Collapsed; item.IsLocked = true; item.CanSettingEditCollpased = true; if (item.OperationVisibilityTimer != null) { item.OperationVisibilityTimer.Stop(); item.OperationVisibilityTimer = null; } }), 3000, out item.OperationVisibilityTimer); } else { TimerJob.StartRun(new Action(() => { if (item.CanSettingEditCollpased) { item.OperationVisibility = Visibility.Collapsed; item.IsLocked = true; if (item.OperationVisibilityTimer != null) { item.OperationVisibilityTimer.Stop(); } } }), 3000, out item.OperationVisibilityTimer); } } else { TimerJob.StartRun(new Action(() => { if (item.CanSettingEditCollpased) { item.OperationVisibility = Visibility.Collapsed; item.IsLocked = true; if (item.OperationVisibilityTimer != null) { item.OperationVisibilityTimer.Stop(); } } }), 3000, out item.OperationVisibilityTimer); } item.OperationVisibility = Visibility.Visible; //操作人 item.TitleOperationer = operater; //只读 item.IsLocked = false; //item.txtHelper.Focus(); #endregion } } catch (Exception ex) { LogManage.WriteLog(typeof(ConferenceTreeItem), ex); } }
/// <summary> /// 登陆 /// </summary> private void Login() { try { if (string.IsNullOrEmpty(this.txtUserName.Text)) { this.CodeOrUserIsNull("*请输入用户名"); return; } if (string.IsNullOrEmpty(this.txtPassword.Password)) { this.CodeOrUserIsNull("*请输入密码"); return; } TimerJob.StartRun(new Action(() => { //显示登陆提示(旋转) this.IsLogining = vy.Visible; //登陆编辑区域设置为不可用 this.LoginPanelIsEnable = false; }), 100); //验证某个IP是否可ping通 if (!DetectionManage.TestNetConnectity(SpaceCodeEnterEntity.SPS_IP)) { this.NetWorkTip = "服务器访问失败,请及时联系管理员"; //this.NetWorkTipVisibility = vy.Visible; //this.NetWorkTipOpacity = 1.0; //this.gridWarning.Opacity = 1.0; WarningGridVisibilityStoryboard.Begin(); return; } else { //this.NetWorkTipVisibility = vy.Collapsed; //this.NetWorkTipOpacity = 0; WarningGridHiddenStoryboard.Begin(); } // 登陆前先进行判断(是否连接网络,是否能够连接服务器) bool networkIsOk = this.Check_NetWorkEnviroment(); if (!networkIsOk) { TimerJob.StartRun(new Action(() => { //显示登陆提示(旋转) this.IsLogining = vy.Hidden; //登陆编辑区域设置为不可用 this.LoginPanelIsEnable = true; }), 100); return; } //判断用户是否在线 this.Check_UserIsOnline(); } catch (Exception ex) { //出现异常,关闭登陆提示 this.IsLogining = vy.Collapsed; //将登陆编辑区域恢复为可用状态 this.LoginPanelIsEnable = true; LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 设置IP 子网掩码、默认网关和DNS /// </summary> /// <param name="ip">IP</param> /// <param name="subnetmask">子网掩码</param> /// <param name="gateway">默认网关</param> /// <param name="dns">DNS</param> public static bool SetNetworkAdapter(string ip, string subnetmask, string gateway, string dns, string mode) { bool isSuccess = true; ManagementBaseObject inPar = null; ManagementBaseObject outPar = null; ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc = mc.GetInstances(); foreach (ManagementObject mo in moc) { #region 消息反馈(旧方案) //if (!(bool)mo["IPEnabled"]) //{ // MessageBox.Show("已检测到网卡,但无法设置。请检查网卡优先性并确认是否已被禁用或已插网线。"); // Process.Start("ncpa.cpl");//网络连接 // break; //} //else //{ #endregion try { if (mode == "auto") { //重置DNS为空 mo.InvokeMethod("SetDNSServerSearchOrder", null); //开启DHCP mo.InvokeMethod("EnableDHCP", null); isSuccess = true; break; } else if (mode == "hand") { //设置ip地址和子网掩码 inPar = mo.GetMethodParameters("EnableStatic"); inPar["IPAddress"] = new string[] { ip };// 1.备用 2.IP inPar["SubnetMask"] = new string[] { subnetmask }; outPar = mo.InvokeMethod("EnableStatic", inPar, null); //设置网关地址 if (gateway.Equals(String.Empty)) { mo.InvokeMethod("SetGateways", null); } else { inPar = mo.GetMethodParameters("SetGateways"); inPar["DefaultIPGateway"] = new string[] { gateway }; // 1.网关;2.备用网关 outPar = mo.InvokeMethod("SetGateways", inPar, null); } //设置DNS if (dns.Equals(String.Empty)) { mo.InvokeMethod("SetDNSServerSearchOrder", null); } else { inPar = mo.GetMethodParameters("SetDNSServerSearchOrder"); inPar["DNSServerSearchOrder"] = new string[] { dns }; // 1.DNS 2.备用DNS outPar = mo.InvokeMethod("SetDNSServerSearchOrder", inPar, null); } isSuccess = true; break; } } catch (Exception ex) { isSuccess = false; LogManage.WriteLog(typeof(NetWorkAdapter), ex); } //} } return(isSuccess); }
/// <summary> /// 可登录处理 /// </summary> /// <param name="userName">用户名</param> /// <param name="pwd">密码</param> /// <param name="email">邮箱地址</param> public void SignedInDealWidth(string userName, string pwd, string email) { try { ThreadPool.QueueUserWorkItem((o) => { //创建客户端对象模型实例(并通过验证) bool result = Constant.clientContextManage.CreateClient(Constant.SpaceWebSiteUri, userName, pwd, Constant.UserDoaminPart1Name); if (result) { //lync状态设置 LyncHelper.LyncStateSetting(this.StateIndex); //lync嵌入 LyncHelper.LyncSignning(email, pwd, null); this.Dispatcher.BeginInvoke(new Action(() => { //嵌入数据准备 this.SignInDataPrepare(); TimerJob.StartRun(new Action(() => { if (this.CanThrow) { this.timerAcept.Stop(); //(登陆窗体、登陆提示、开始菜单隐藏) //登陆窗体隐藏 this.Visibility = vy.Hidden; //登陆提示隐藏 this.IsLogining = vy.Hidden; ThreadPool.QueueUserWorkItem((t) => { //会话同步服务配置 ModelManage.ClientInit(Constant.SPSiteAddressFront + Constant.SpsSearchWebName, ClientModelType.ConferenceSpSearch, Constant.LoginUserName, Constant.WebLoginPassword, Constant.UserDoaminPart1Name); }); //创建主界面 MainWindow mainWindow = new MainWindow(); //显示主界面 mainWindow.Show(); } }), 600, out timerAcept); })); } else { this.Dispatcher.BeginInvoke(new Action(() => { this.CodeOrUserIsNull("用户名密码错误"); //恢复可用 this.LoginPanelIsEnable = true; })); return; } }); } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 切换控制中心 /// </summary> public void NavicateChangeCenter(ViewSelectedItemEnum viewSelectedItemEnum) { try { //当前面板设置为隐藏 this.Visibility = System.Windows.Visibility.Collapsed; //工具箱选择项 this.ViewSelectedItemEnum = viewSelectedItemEnum; //若为第一次选择,则变换样式 if (this.firstSelected) { //面板背景色更改 this.gridMain.Background = this.Resources["bgColor2"] as SolidColorBrush; //主持人功能按钮背景更改 this.btn_Chair.Background = Application.Current.Resources["brush_Chair2"] as ImageBrush; //会议切换按钮背景更改 this.btn_Meet_Changed.Background = Application.Current.Resources["brush_Meet_Change2"] as ImageBrush; //系统设置按钮背景更改 this.btn_Setting.Background = Application.Current.Resources["brush_Setting2"] as ImageBrush; //中控功能按钮背景更改 this.btn_Studiom.Background = Application.Current.Resources["brush_Studiom2"] as ImageBrush; //U盘传输按钮背景更改 this.btn_U_Disk.Background = Application.Current.Resources["brush_U_Disk2"] as ImageBrush; //字体颜色2 SolidColorBrush txtForeColor2 = this.Resources["txtForeColor2"] as SolidColorBrush; //主持人功能按钮字体色更改 this.btn_Chair.Foreground = txtForeColor2; //会议切换按钮字体色更改 this.btn_Meet_Changed.Foreground = txtForeColor2; //系统设置按钮字体色更改 this.btn_Setting.Foreground = txtForeColor2; //中控功能按钮字体色更改 this.btn_Studiom.Foreground = txtForeColor2; //U盘传输按钮字体色更改 this.btn_U_Disk.Foreground = txtForeColor2; //更改面板边距值 this.BorderThickness = new Thickness(0, 1, 1, 1); //第一次标示改为false this.FirstSelected = false; } //子项选择更改事件执行 if (this.SelectItemChanged != null) { this.SelectItemChanged(viewSelectedItemEnum); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 客户端对象模型初始化 /// </summary> /// <param name="webUrl"></param> /// <param name="clientModelType"></param> /// <param name="domain"></param> /// <param name="userName"></param> /// <param name="pwd"></param> public static void ClientInit(string webUrl, ClientModelType clientModelType, string userName, string pwd, string domain) { try { EndpointAddress endpoint = new EndpointAddress(webUrl); switch (clientModelType) { case ClientModelType.ConferenceVersion: //客户端对象模型初始化 ConferenceVersion.ConferenceVersionInit(binding, endpoint); break; case ClientModelType.ConferenceTree: //客户端对象模型初始化 ConferenceTree.ConferenceTreeInit(binding, endpoint); break; case ClientModelType.ConferenceAudio: //客户端对象模型初始化 ConferenceAudio.ConferenceAudioInit(binding, endpoint); break; case ClientModelType.FileSync: //客户端对象模型初始化 FileSyncAppPool.FileSyncAppPoolInit(binding, endpoint); break; case ClientModelType.Spacesync: //客户端对象模型初始化 ConferenceWordAsync.ConferenceOfficeAsyncInit(binding, endpoint); break; case ClientModelType.ConferenceInfo: //客户端对象模型初始化 ConferenceInfo.ConferenceInfoInit(binding, endpoint); break; case ClientModelType.LyncConversationSync: //客户端对象模型初始化 ConferenceLyncConversation.ConferenceInfoInit(binding, endpoint); break; case ClientModelType.MaxtriSync: //客户端对象模型初始化 ConferenceMatrix.ConferenceInfoInit(binding, endpoint); break; case ClientModelType.ConferenceSpSearch: //客户端对象模型初始化(文件搜索) ConferenceSpSearch.SpSearchInit(binding, endpoint, userName, pwd, domain); break; case ClientModelType.StuiomService: //环境控制初始化 StudiomService.StudiomInit(binding, endpoint); break; case ClientModelType.Space_Service: //智存空间服务初始化 Space_Service.Space_ServiceInit(binding, endpoint); break; default: break; } } catch (Exception ex) { LogManage.WriteLog(typeof(ModelManage), ex); } }
public List <SeatEntity> InToOneSeat(string conferenceName, string seatList, string selfName, string selfIP) { lock (objInToOneSeat) { //座位信息集合 List <SeatEntity> settingList = null; try { if (!string.IsNullOrEmpty(conferenceName)) { //座位加载人 SeatEntity settingAddEntity = null; //座位信息 if (!SeatEntityList.ContainsKey(conferenceName)) { //座位信息集合 settingList = new List <SeatEntity>(); //分割获取座位IP集 string[] settingIpList = seatList.Split(new char[] { '*' }); //加载位置信息 for (int i = 0; i < settingIpList.Count(); i++) { //创建一个座位实体 SeatEntity settingEntity = new ConferenceWebCommon.EntityHelper.ConferenceMatrix.SeatEntity(); //设置座位IP settingEntity.SettingIP = settingIpList[i]; //设置座位序列号 settingEntity.SettingNummber = i + 1; //添加座位实体 settingList.Add(settingEntity); //设置当前用户名称 if (selfIP.Equals(settingIpList[i])) { settingEntity.UserName = selfName; settingAddEntity = settingEntity; } } //针对会议的座位信息 SeatEntityList.Add(conferenceName, settingList); } else { List <SeatEntity> sList = SeatEntityList[conferenceName]; //加载位置信息 for (int i = 0; i < sList.Count(); i++) { //设置当前用户名称 if (selfIP.Equals(sList[i].SettingIP)) { settingAddEntity = sList[i]; sList[i].UserName = selfName; break; } } //获取当前会议的座位信息 settingList = SeatEntityList[conferenceName]; } //实时同步(发送信息给客户端) this.InformClient(conferenceName, settingAddEntity); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } return(settingList); } }
/// <summary> /// 知识树子节点点对点进行同步 /// </summary> /// <param name="result"></param> public static void Information_Sync(ConferenceTreeItemTransferEntity result) { try { //树视图启动 ConferenceTreeView.conferenceTreeView.IsStart = true; switch (result.Operation) { //添加节点 case ConferenceTreeOperationType.AddType: Add_Item(result); ShowSummerUpdateView(); break; //删除节点 case ConferenceTreeOperationType.DeleteType: Delete_Item(result); ShowSummerUpdateView(); break; //更新节点 case ConferenceTreeOperationType.UpdateType: UpdateItem(result); ShowSummerUpdateView(); break; //刷新 case ConferenceTreeOperationType.RefleshAllType: ConferenceTreeItem.SessionClear(); //重新加载一个新实例 ConferenceTreeView.conferenceTreeView.ConferenceTreeItem.ParametersInit(); break; case ConferenceTreeOperationType.FocusType1: //剔除标题焦点 RemoveTittleFocus(result); break; case ConferenceTreeOperationType.FocusType2: //剔除评论焦点 RemoveCommentFocus(result); break; case ConferenceTreeOperationType.LinkAdd: UpdateItemLink(result); ShowSummerUpdateView(); break; case ConferenceTreeOperationType.UpdateComment: UpdateItemComment(result); ShowSummerUpdateView(); break; case ConferenceTreeOperationType.UpdateTittle: UpdateItemTittle(result); ShowSummerUpdateView(); break; default: break; } } catch (Exception ex) { LogManage.WriteLog(typeof(ConferenceTreeItem), ex); } }
/// <summary> /// 共享电子白板 /// </summary> public static void ShareWhiteboard(ConversationWindow conversationWindow, string selfName, Action callBack) { try { if (conversationWindow != null) { DispatcherTimer timer1 = null; TimerJob.StartRun(new Action(() => { if (conversationWindow.Conversation == null) { timer1.Stop(); return; } //获取电子白板启动模型实例 ContentSharingModality contentShareingModality = (ContentSharingModality)conversationWindow.Conversation.Modalities[ModalityTypes.ContentSharing]; DispatcherTimer timer2 = null; //查看是否可以共享白板 var canShareWhiteboard = contentShareingModality.CanInvoke(ModalityAction.CreateShareableWhiteboardContent); if (canShareWhiteboard) { if (contentShareingModality.CanInvoke(ModalityAction.Connect)) { contentShareingModality.BeginConnect(null, null); } //获取共享白板的名称 string whiteShareName = GetWhiteShareName(selfName, whiteBoardShareName); if (contentShareingModality.CanInvoke(ModalityAction.CreateShareableWhiteboardContent)) { //创建一个默认的电子白板 IAsyncResult result = contentShareingModality.BeginCreateContent(ShareableContentType.Whiteboard, whiteShareName, null, null); //结束提交 ShareableContent whiteBoardContent = contentShareingModality.EndCreateContent(result); TimerJob.StartRun(new Action(() => { int reason; //【在此可监控异常】 if (whiteBoardContent.CanInvoke(ShareableContentAction.Upload, out reason)) { //电子白板上传 whiteBoardContent.Upload(); } if (whiteBoardContent.State == ShareableContentState.Online) { timer2.Stop(); //当前呈现(电子白板) whiteBoardContent.Present(); if (callBack != null) { callBack(); } } }), 10, out timer2); timer1.Stop(); } } }), 400, out timer1); } else { MessageBox.Show("使用电子白板共享之前先选择一个会话", "操作提示", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } }
/// <summary> /// 服务器同步删除节点 /// </summary> public static void Delete_Item(ConferenceTreeItemTransferEntity academicReviewItemTransferEntity) { try { //声明一个知识树节点 ConferenceTreeItem academicReviewChild = null; //指定父节点,通过关联记录所有知识树的记录中获取(根据服务器传过来的知识树协议实体的父节点的GUID来判断) if (academicReviewItemTransferEntity.Guid != 0) { for (int i = 0; i < ConferenceTreeItem.AcademicReviewItemList.Count; i++) { //记录所有知识树的记录里获取同协议实体相同GUID的子节点 academicReviewChild = ConferenceTreeItem.AcademicReviewItemList[i]; //对应协议实体的GUID if (academicReviewChild.ACA_Guid.Equals(academicReviewItemTransferEntity.Guid)) { //父节点容器删除该子节点 academicReviewChild.ACA_Parent.StackPanel.Children.Remove(academicReviewChild); //父节点的子项集合删除该节点 academicReviewChild.ACA_Parent.ACA_ChildList.Remove(academicReviewChild); //清空附加数据 ConferenceTreeItem.ClearAddData(academicReviewChild); #region 相对应的子节点也得删除 //使用递归方式删除子节点 ConferenceTreeItem.ItemDeleteRecursion(academicReviewItemTransferEntity.Guid); #endregion break; } } } //该为根节点 else { for (int i = 0; i < ConferenceTreeItem.AcademicReviewItemList.Count; i++) { //记录所有知识树的记录里获取同协议实体相同GUID的子节点 academicReviewChild = ConferenceTreeItem.AcademicReviewItemList[i]; //对应协议实体的GUID if (academicReviewChild.ACA_Guid.Equals(academicReviewItemTransferEntity.Guid)) { //父节点容器删除所有子节点 academicReviewChild.StackPanel.Children.Clear(); //父节点的子项集合删除所有节点 academicReviewChild.ACA_ChildList.Clear(); //通过遍历去清空所有子节点 for (int j = ConferenceTreeItem.AcademicReviewItemList.Count - 1; j > -1; j--) { ConferenceTreeItem item = ConferenceTreeItem.AcademicReviewItemList[j]; //根节点没有父类 if (item.ACA_Parent != null) { //记录所有知识树的记录删除该节点 ConferenceTreeItem.AcademicReviewItemList.RemoveAt(j); //清空附加数据 ConferenceTreeItem.ClearAddData(item); } } break; } } } } catch (Exception ex) { LogManage.WriteLog(typeof(ConferenceTreeItem), ex); } }
/// <summary> /// 获取客户端发送过来的数据 /// </summary> /// <param name="obj"></param> private void GetRecieveData(object obj) { try { //客户端套接字 if (obj is Socket) { Socket clientSocket = obj as Socket; //连接状态 while (clientSocket != null && clientSocket.Connected) { //IPEndPoint remoteEndPoint = (IPEndPoint)client.RemoteEndPoint;//服务器对客户端操作的地址加端口 //PC客户端所传数据 ConferenceClientAccept clientIncordingEntity = null; List <byte> lists = new List <byte>(); callBack: byte[] buffer = new byte[BUFFER_SIZE]; int count = clientSocket.Receive(buffer);//挂起操作 if (count == 0) { //客户端与服务器端断开连接 break; } if (count == BUFFER_SIZE) { lists.AddRange(buffer); } else if (count < BUFFER_SIZE) { byte[] dataless = new byte[count]; Array.Copy(buffer, dataless, count); lists.AddRange(dataless); } if (clientSocket.Available != 0) { goto callBack; } byte[] data = lists.ToArray(); lists.Clear(); lists = null; if (TCPDataAccroiding != null) { string MobilePhoneIM = Encoding.UTF8.GetString(buffer, 0, count); this.TCPDataAccroiding(MobilePhoneIM, new Action <bool, string, string>((successed, conferenceName, selfUri) => { if (successed) { clientIncordingEntity = new ConferenceClientAccept() { ConferenceClientAcceptType = ConferenceClientAcceptType.ConferenceAudio, ConferenceName = conferenceName, SelfUri = "_" + selfUri }; if (this.TCPDataArrival != null) { this.TCPDataArrival(new TcpDateEvent(clientSocket, clientIncordingEntity), SocketClientType.Android); } } else { using (MemoryStream stream = new MemoryStream(data)) { stream.Position = 0; BinaryFormatter formatter = new BinaryFormatter(); formatter.Binder = new UBinder(); var result = formatter.Deserialize(stream); Type type = result.GetType(); if (type.Equals(typeof(ConferenceClientAccept))) { clientIncordingEntity = result as ConferenceClientAccept; if (this.TCPDataArrival != null) { this.TCPDataArrival(new TcpDateEvent(clientSocket, clientIncordingEntity), SocketClientType.PC); } } stream.Flush(); } } })); } else { using (MemoryStream stream = new MemoryStream(data)) { stream.Position = 0; BinaryFormatter formatter = new BinaryFormatter(); formatter.Binder = new UBinder(); var result = formatter.Deserialize(stream); Type type = result.GetType(); if (type.Equals(typeof(ConferenceClientAccept))) { clientIncordingEntity = result as ConferenceClientAccept; if (this.TCPDataArrival != null) { this.TCPDataArrival(new TcpDateEvent(clientSocket, clientIncordingEntity), SocketClientType.PC); } } stream.Flush(); } } Array.Clear(data, 0, data.Length); data = null; } try { if (clientSocket != null) { //if (this.TCPDataArrival != null) //{ // this.TCPDataArrival(new TcpDateEvent(clientSocket, new PackageBase() { head = EPackageHead.Discon })); //} //服务器端释放已经断开的客户端连接Socket对象资源 Thread.Sleep(300); if (clientSocket.Poll(10, SelectMode.SelectRead)) { clientSocket.Shutdown(SocketShutdown.Both); } clientSocket.Close(); clientSocket = null; } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } } } catch (Exception ex) { //LogManage.WriteLog(this.GetType(), ex); } }
/// <summary> /// 刷新知识树 /// </summary> /// <param name="result"></param> void Reflesh(ConferenceTreeInitRefleshEntity result) { try { //根记录同步 ConferenceTreeItem.RootCount = result.RootCount; //rootParent(只有根节点是没有的,所有可以判断该节点为根节点) if (result != null && result.RootParent_AcademicReviewItemTransferEntity != null) { //绑定根节点的协议实体 this.AcademicReviewItemTransferEntity = result.RootParent_AcademicReviewItemTransferEntity; //设置根节点的标题 this.ACA_Tittle = this.AcademicReviewItemTransferEntity.Title; //设置根节点的评论 this.ACA_Comment = this.AcademicReviewItemTransferEntity.Comment; //有备注内容 if (!string.IsNullOrEmpty(this.AcademicReviewItemTransferEntity.Comment)) { //显示备注弹出按钮 this.CommentCommandVisibility = System.Windows.Visibility.Visible; } //有附件列表 if (this.AcademicReviewItemTransferEntity.LinkList != null && this.AcademicReviewItemTransferEntity.LinkList.Count > 0) { //显示附件列表弹出按钮 this.LinkCommandVisibility = System.Windows.Visibility.Visible; } foreach (var link in AcademicReviewItemTransferEntity.LinkList) { string fileName = System.IO.Path.GetFileName(link); this.LinkListItemAdd(fileName, link); } } //根节点的衍生子节点 if (result.AcademicReviewItemTransferEntity_ObserList != null && result.AcademicReviewItemTransferEntity_ObserList.Count() > 0) { //进行后续的关联 for (int i = 0; i < ConferenceTreeItem.AcademicReviewItemList.Count; i++) { //记录所有知识树的记录 ConferenceTreeItem entityItem = ConferenceTreeItem.AcademicReviewItemList[i]; foreach (var transferItem in result.AcademicReviewItemTransferEntity_ObserList) { //映射集合GUID if (!ConferenceTreeItem.retunList.Contains(transferItem.Guid)) { //添加GUID ConferenceTreeItem.retunList.Add(transferItem.Guid); } //父节点加载子节点 if (transferItem.ParentGuid.Equals(entityItem.ACA_Guid)) { //生成子节点 ConferenceTreeItem academicReviewItem = new ConferenceTreeItem(false) { ACA_Parent = entityItem, ParentGuid = entityItem.ACA_Guid, ACA_Guid = transferItem.Guid }; //节点标题 academicReviewItem.ACA_Tittle = transferItem.Title; if (!string.IsNullOrEmpty(transferItem.Comment)) { academicReviewItem.CommentCommandVisibility = System.Windows.Visibility.Visible; } if (transferItem.LinkList != null && transferItem.LinkList.Count > 0) { academicReviewItem.LinkCommandVisibility = System.Windows.Visibility.Visible; } foreach (var link in transferItem.LinkList) { string fileName = System.IO.Path.GetFileName(link); academicReviewItem.LinkListItemAdd(fileName, link); } //评论 academicReviewItem.ACA_Comment = transferItem.Comment; //简介 entityItem.StackPanel.Children.Add(academicReviewItem); //父节点子节点集合添加该子项 entityItem.ACA_ChildList.Add(academicReviewItem); //子节点协议实体绑定 academicReviewItem.AcademicReviewItemTransferEntity = transferItem; //记录所有知识树的记录添加子节点 ConferenceTreeItem.AcademicReviewItemList.Add(academicReviewItem); } } } } ConferenceTreeView.ExpanderMethod(); } catch (Exception ex) { LogManage.WriteLog(typeof(ConferenceTreeItem), ex); } }
/// <summary> /// 根据文件的类型使用相应的方式打开 /// </summary> public void FileOpenByExtension(FileType fileType, string uri) { try { switch (fileType) { case FileType.docx: //this.OpenOfficeFile(uri, fileType); this.OpenOfficeFile(uri); break; case FileType.doc: //this.OpenOfficeFile(uri, fileType); this.OpenOfficeFile(uri); break; case FileType.xlsx: //this.OpenOfficeFile(uri, fileType); this.OpenOfficeFile(uri); break; case FileType.txt: this.OpenFileByBrowser(uri); break; case FileType.PPtx: //this.OpenOfficeFile(uri, fileType); this.OpenOfficeFile(uri); break; case FileType.PPt: //this.OpenOfficeFile(uri, fileType); this.OpenOfficeFile(uri); break; case FileType.one: this.OpenOfficeFile(uri); break; case FileType.Mp4: this.OpenVideoAudioFile(uri); break; case FileType.avi: this.OpenVideoAudioFile(uri); break; case FileType.mp3: this.OpenVideoAudioFile(uri); break; case FileType.Jpg: this.OpenPictureFile(uri); break; case FileType.Png: this.OpenPictureFile(uri); break; case FileType.Ico: this.OpenPictureFile(uri); break; case FileType.Xml: this.OpenFileByBrowser(uri); break; case FileType.record: this.OpenRecordFile(uri); break; default: break; } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } }
public void Begin_Resource_DownLoad(string root) { try { if (this.BeginDownLoadCallBack != null) { this.BeginDownLoadCallBack(); } if (this.DownLoadItemCollection.Count > 0) { this.DownLoad_AllCount = this.DownLoadItemCollection.Count; } this.DownloadWindowVisibility = vy.Visible; if (IsAllDownLoadCompleate) { this.All_DownloadMaxValue = 0; this.All_DownloadNowValue = 0; } foreach (var item in this.DownLoadItemCollection) { if (!item.IsCompleate_DownLoad && !item.IsDownLoading_Now) { this.All_DownloadMaxValue += item.Length; this.IsAllDownLoadCompleate = false; item.IsDownLoading_Now = true; item.WebClientHelper.FileDown(item.FileUri, root + "\\" + item.FileName, SpaceCodeEnterEntity.LoginUserName, SpaceCodeEnterEntity.WebLoginPassword, SpaceCodeEnterEntity.UserDomain, new Action <int, long>((intProcess, recieve_Bytes) => { this.Dispatcher.BeginInvoke(new Action(() => { item.Progress = intProcess; item.Recieve_Bytes += recieve_Bytes; //int int_process = intProcess + this.DownLoad_CompleateCount * 100; this.All_DownloadNowValue += recieve_Bytes; item.CompletePercent = string.Format(Percent_Formart, intProcess); })); }), new Action <Exception, bool>((ex, IsSuccessed) => { this.Dispatcher.BeginInvoke(new Action(() => { item.Progress = item.AllSize; item.CompletePercent = Percent_flg; item.IsDownLoading_Now = false; item.IsCompleate_DownLoad = true; this.DownLoad_CompleateCount++; if (this.DownLoad_CompleateCount == this.DownLoadItemCollection.Count) { this.DownLoad_Title_Tip = "下载完成"; this.IsAllDownLoadCompleate = true; } })); })); } } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 本地资源共享 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnLocalResource_Click(object sender, RoutedEventArgs e) { try { if (LyncHelper.MainConversation != null) { //打开选项对话框 OpenFileDialog dialog = new OpenFileDialog(); //指定显示的文件类型 //dialog.Filter = "所有文件"; //设置为多选 dialog.Multiselect = false; if (dialog.ShowDialog() == true) { //获取扩展名 string fileExtension = System.IO.Path.GetExtension(dialog.FileName); if (fileExtension.Equals(".pptx") || fileExtension.Equals(".ppt")) { //共享前释放资源 this.ShareBeforeDisposeResrouce(); //打开ppt共享辅助 PPtShareHelper(dialog.FileName); } else { //获取文件名称(不包含扩展名称) var fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(dialog.FileName); ////文件移动 //System.IO.File.Copy(dialog.FileName, Constant.LocalTempRoot + "\\" + fileNameWithoutExtension + fileExtension, true); //Thread.Sleep(1000); //通过进程打开一个文件 ProcessManage.OpenFileByLocalAddressReturnHandel(dialog.FileName, new Action <int, IntPtr>((processID, intptr) => { //获取共享模型 var shareModality = ((ApplicationSharingModality)(LyncHelper.MainConversation.Conversation.Modalities[ModalityTypes.ApplicationSharing])); //遍历可以共享的资源 foreach (var item in shareModality.ShareableResources) { //&& intptr != new IntPtr(0) //指定要共享的程序名称 if (item.Id.Equals(processID)) { //判断是否可以进行共享该程序 if (shareModality.CanShare(item.Type)) { this.ShareAndSync(intptr, shareModality, item); break; } } else if (item.Id == intptr.ToInt32()) { //判断是否可以进行共享该程序 if (shareModality.CanShare(item.Type)) { this.ShareAndSync(intptr, shareModality, item); break; } } else if (item.Name.Contains(fileNameWithoutExtension)) { //判断是否可以进行共享该程序 if (shareModality.CanShare(item.Type)) { this.ShareAndSync(intptr, shareModality, item); break; } } } })); } } } else { MessageBox.Show("使用桌面共享之前先选择一个会话", "操作提示", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 常规事件注册区域 /// </summary> public void Normal_EventRegedit() { try { //更改标题 this.txtTittle.TextChanged += txtTittle_TextChanged; //更改评论 this.txtComment.TextChanged += txtComment_TextChanged; //标题获取焦点事件 this.txtTittle.GotFocus += txtTittle_GotFocus; //评论获取焦点事件 this.txtComment.GotFocus += txtComment_GotFocus; //评论弹出事件 this.btnComment.Click += btnComment_Click; //超链接列表弹出事件 this.btnLinkList.Click += btnLinkList_Click; //尺寸更改事件 //this.borMain.SizeChanged += borMain_SizeChanged; this.btnExpander.Click += btnExpander_Click; //节点选择事件 this.borTreeMain.PreviewMouseLeftButtonDown += ConferenceTreeItem_PreviewMouseLeftButtonDown; //拖拽事件 this.borSelected.PreviewMouseLeftButtonDown += borSelected_PreviewMouseLeftButtonDown; #region old solution ////会议主持人有添加和删除节点的权限 //if (TreeCodeEnterEntity.TreeCodeEnterEntityInstance.IsMeetPresenter) //{ // //添加节点 // this.imgAdd.MouseLeftButtonDown += imgAdd_MouseLeftButtonDown; // //删除节点 // this.menuItemDelete.Click += menuItemDelete_Click; // //清除当前节点的所有投票 // //this.menuItemAllVoteClear.Click += menuItemAllVoteClear_Click; //} //投票赞成 //this.imgYesVote.MouseLeftButtonDown += imgVote_MouseLeftButtonDown; //this.txtYesVote.MouseLeftButtonDown += imgVote_MouseLeftButtonDown; //投票反对 //this.imgNoVote.MouseLeftButtonDown += imgNoVote_MouseLeftButtonDown; //this.txtNoVote.MouseLeftButtonDown += imgNoVote_MouseLeftButtonDown; //点击弹出评论窗体 //this.imgComment.PreviewMouseLeftButtonDown += imgComment_PreviewMouseLeftButtonDown; #endregion } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
public void CheckNetWorkCallBack(NetWorkErrTipType netWorkErrTipType) { try { //信息提示 string message = string.Empty; if (this.currentNetWorkState != netWorkErrTipType) { switch (netWorkErrTipType) { case NetWorkErrTipType.Normal: MainWindow.mainWindow.NetWork_ViewVisibility = System.Windows.Visibility.Collapsed; //if (LyncHelper.MainConversation != null) //{ MainWindow.MainPageInstance.SharingPanel.NetWork_ViewVisibility = System.Windows.Visibility.Collapsed; //} break; case NetWorkErrTipType.ConnectedRouteFailed: //共享面板 SharingPanel panel = MainWindow.MainPageInstance.SharingPanel; //导航到首页 MainWindow.mainWindow.IndexPageChangedToIndexPage(); message = "无法连接到当前网络"; MainWindow.mainWindow.NetWork_ViewVisibility = System.Windows.Visibility.Visible; MainWindow.mainWindow.SettingNetWorkConnectErrorTip(message); panel.NetWork_ViewVisibility = System.Windows.Visibility.Visible; panel.SettingNetWorkConnectErrorTip(message); break; case NetWorkErrTipType.ConnectedServiceFailed: //共享面板 SharingPanel panel2 = MainWindow.MainPageInstance.SharingPanel; //导航到首页 MainWindow.mainWindow.IndexPageChangedToIndexPage(); message = "无法连接到服务器"; MainWindow.mainWindow.NetWork_ViewVisibility = System.Windows.Visibility.Visible; MainWindow.mainWindow.SettingNetWorkConnectErrorTip(message); panel2.NetWork_ViewVisibility = System.Windows.Visibility.Visible; panel2.SettingNetWorkConnectErrorTip(message); break; case NetWorkErrTipType.ConnectedWebServiceFailed: //共享面板 SharingPanel panel3 = MainWindow.MainPageInstance.SharingPanel; //导航到首页 MainWindow.mainWindow.IndexPageChangedToIndexPage(); message = "无法访问web服务"; MainWindow.mainWindow.NetWork_ViewVisibility = System.Windows.Visibility.Visible; MainWindow.mainWindow.SettingNetWorkConnectErrorTip(message); panel3.NetWork_ViewVisibility = System.Windows.Visibility.Visible; panel3.SettingNetWorkConnectErrorTip(message); break; default: break; } } //当前网络状态 this.currentNetWorkState = netWorkErrTipType; } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
public void RemoveClientSocket(string conferenceName, ConferenceClientAcceptType conferenceClientAcceptType, string contactUrl) { //上锁,达到线程互斥作用 lock (objRemoveClientSocket) { try { //声明一个服务集合 Dictionary <string, MeetServerSocket> DicmeetServerSocket = null; switch (conferenceClientAcceptType) { case ConferenceClientAcceptType.ConferenceTree: //知识树服务 DicmeetServerSocket = Constant.DicTreeMeetServerSocket; break; case ConferenceClientAcceptType.ConferenceAudio: //语音服务 DicmeetServerSocket = Constant.DicAudioMeetServerSocket; break; case ConferenceClientAcceptType.ConferenceFileSync: //甩屏服务 DicmeetServerSocket = Constant.DicFileMeetServerSocket; break; case ConferenceClientAcceptType.ConferenceSpaceSync: //office服务 DicmeetServerSocket = Constant.DicSpaceMeetServerSocket; break; case ConferenceClientAcceptType.ConferenceInfoSync: //消息服务 DicmeetServerSocket = Constant.DicInfoMeetServerSocket; break; case ConferenceClientAcceptType.LyncConversationSync: //lync通讯服务 DicmeetServerSocket = Constant.DicLyncMeetServerSocket; break; case ConferenceClientAcceptType.ConferenceMatrixSync: //矩阵应用通讯服务 DicmeetServerSocket = Constant.DicMatrixMeetServerSocket; break; default: break; } //会议通讯节点集合是否包含该项 if (DicmeetServerSocket.ContainsKey(conferenceName)) { //获取客户端通讯节点字典集合 Dictionary <string, SocketModel> dicSocket = DicmeetServerSocket[conferenceName].DicClientSocket; //获取指定客户端通讯节点 if (dicSocket.ContainsKey(contactUrl)) { //移除指定客户端通讯节点 dicSocket.Remove(contactUrl); } } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } } }
public static double GetRefreshRate(uint displayIndex) { uint uNumPathArrayElements = 0; uint uNumModeArrayElements = 0; IntPtr pPathArray = IntPtr.Zero; IntPtr pModeArray = IntPtr.Zero; IntPtr pCurrentTopologyId = IntPtr.Zero; long result; UInt32 numerator; UInt32 denominator; double refreshRate = 0; try { // get size of buffers for QueryDisplayConfig result = GetDisplayConfigBufferSizes(QDC_ALL_PATHS, out uNumPathArrayElements, out uNumModeArrayElements); if (result != 0) { // Log.Error("W7RefreshRateHelper.GetRefreshRate: GetDisplayConfigBufferSizes(...) returned {0}", result); return(0); } // allocate memory or QueryDisplayConfig buffers pPathArray = Marshal.AllocHGlobal((Int32)(uNumPathArrayElements * SIZE_OF_DISPLAYCONFIG_PATH_INFO)); pModeArray = Marshal.AllocHGlobal((Int32)(uNumModeArrayElements * SIZE_OF_DISPLAYCONFIG_MODE_INFO)); // get display configuration result = QueryDisplayConfig(QDC_ALL_PATHS, ref uNumPathArrayElements, pPathArray, ref uNumModeArrayElements, pModeArray, pCurrentTopologyId); // if failed log error message and free memory if (result != 0) { // Log.Error("W7RefreshRateHelper.GetRefreshRate: QueryDisplayConfig(...) returned {0}", result); Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return(0); } // get offset for a display's target mode info int offset = GetModeInfoOffsetForDisplayId(displayIndex, pModeArray, uNumModeArrayElements); // if failed log error message and free memory if (offset == -1) { //Log.Error("W7RefreshRateHelper.GetRefreshRate: Couldn't find a target mode info for display {0}", displayIndex); Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return(0); } // get refresh rate numerator = (UInt32)Marshal.ReadInt32(pModeArray, offset + 32); denominator = (UInt32)Marshal.ReadInt32(pModeArray, offset + 36); refreshRate = (double)numerator / (double)denominator; //Log.Debug("W7RefreshRateHelper.GetRefreshRate: QueryDisplayConfig returned {0}/{1}", numerator, denominator); // free memory and return refresh rate Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); } catch (Exception ex) { LogManage.WriteLog(typeof(WindowExtentionManage), ex); } return(refreshRate); }
public string GetConferenceInfoByMobile(string loginName) { string json = string.Empty; MessageInfo mi = new MessageInfo(); mi.State = "0000"; mi.Message = ""; ConferenceInformationEntityM ConferenceInformationEntityM = new ConferenceInformationEntityM(); try { string userName = loginName + "@" + Constant.UserDomain; if (!string.IsNullOrEmpty(meetingInfo)) { List <ConferenceInformationEntity> list = JsonManage.JsonToEntity <ConferenceInformationEntity>(meetingInfo, ','); List <ConferenceInformationEntity> list2 = list.Where(Item => Item.JoinPeople.Contains(userName)).ToList <ConferenceInformationEntity>(); if (list2.Count > 0) { if (list2[0].JoinPeople.Contains(userName)) { int index = list2[0].JoinPeople.IndexOf(userName); //list2[0].JoinPeopleName ConferenceInformationEntityM.SelfRealName = list2[0].JoinPeopleName[index]; } ConferenceInformationEntityM.ConferenceInformationEntityList = list2; ConferenceInformationEntityM.SelfAddress = userName; json = CommonMethod.Serialize(ConferenceInformationEntityM); mi.Result = json; } else { mi.State = "0001"; mi.Message = "当前用户没有所有参加的会议"; } } else { mi.State = "0001"; mi.Message = "获取会议信息失败"; } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } Context.Response.ContentType = "application/json"; Context.Response.Charset = Encoding.UTF8.ToString(); //设置字符集类型 Context.Response.ContentEncoding = System.Text.Encoding.UTF8; Context.Response.Write(CommonMethod.Serialize(mi)); Context.Response.End(); return(json); }
/// <summary> /// 导航到指定视图 /// </summary> public void NavicateView(ViewSelectedItemEnum viewSelectedItemEnum) { try { //前期处理 this.DealWithBefore(viewSelectedItemEnum); switch (viewSelectedItemEnum) { case ViewSelectedItemEnum.Meet: this.DealWithMeet(); break; case ViewSelectedItemEnum.Tree: this.DealWithTree(); break; case ViewSelectedItemEnum.Space: this.DealWidthSpace(); break; case ViewSelectedItemEnum.Resource: this.DealWidthResource(); break; case ViewSelectedItemEnum.IMM: this.DealWidthIMM(); break; case ViewSelectedItemEnum.PersonNote: this.DealWidthPersonNote(); break; case ViewSelectedItemEnum.WebBrowserView: //导航样式更改 this.ButtonStyleChanged(this.btnVote); //加载会议投票 this.borMain.Child = this.WebBrowserView; break; case ViewSelectedItemEnum.U_Disk: //U盘传输 this.borMain.Child = this.U_DiskView; break; case ViewSelectedItemEnum.Meet_Change: break; case ViewSelectedItemEnum.Chair: //加载主持人功能 this.borMain.Child = this.ChairView; break; case ViewSelectedItemEnum.Studiom: //中控设置 this.borMain.Child = this.StudiomView; break; case ViewSelectedItemEnum.SystemSetting: this.DealWidthSystemSetting(); break; case ViewSelectedItemEnum.Tool: //工具箱模块处理 this.DealWithTool(); break; case ViewSelectedItemEnum.ToolUsing: //工具应用 this.borMain.Child = this.ApplicationToolView; break; default: break; } //绑定选择项 this.ViewSelectedItemEnum = viewSelectedItemEnum; } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 服务器通讯节点集合初始化辅助 /// </summary> public static void DicServerSocketInitHelper(MeetServerSocket meetServerSocket) { try { int point = 0; switch (meetServerSocket.ConferenceClientAcceptType) { case ConferenceClientAcceptType.ConferenceTree: //知识树服务端口绑定 point = Constant.TreeServerPoint; if (Constant.MeetCount > 1) { //多个会议,合理分配端口 point += Constant.MeetCount * 7; } //服务器通讯节点初始化辅助 ServerSocket TreeServerSocket = Constant.ServerSocketInitHelper(meetServerSocket, point); //获取客户端信息 TreeServerSocket.TCPDataArrival += TreeServerSocket_TCPDataArrival; break; case ConferenceClientAcceptType.ConferenceAudio: //语音服务端口绑定 point = Constant.AudioServerPoint; if (Constant.MeetCount > 1) { //多个会议,合理分配端口 point += Constant.MeetCount * 7; } //服务器通讯节点初始化辅助 ServerSocket AudioServerSocket = Constant.ServerSocketInitHelper(meetServerSocket, point); //获取客户端信息 AudioServerSocket.TCPDataArrival += AudioServerSocket_TCPDataArrival; //获取手机端信息 AudioServerSocket.TCPDataAccroiding += AudioServerSocket_TCPDataAccroiding; break; case ConferenceClientAcceptType.ConferenceFileSync: //文件服务端口绑定【甩屏】 point = Constant.FileServerPoint; if (Constant.MeetCount > 1) { //多个会议,合理分配端口 point += Constant.MeetCount * 7; } //服务器通讯节点初始化辅助 ServerSocket FileServerSocket = Constant.ServerSocketInitHelper(meetServerSocket, point); //获取客户端信息 FileServerSocket.TCPDataArrival += FileServerSocket_TCPDataArrival; break; case ConferenceClientAcceptType.ConferenceSpaceSync: //文件服务端口绑定【甩屏】 point = Constant.SpaceServerPoint; if (Constant.MeetCount > 1) { //多个会议,合理分配端口 point += Constant.MeetCount * 7; } //服务器通讯节点初始化辅助 ServerSocket OfficeServerSocket = Constant.ServerSocketInitHelper(meetServerSocket, point); //获取客户端信息 OfficeServerSocket.TCPDataArrival += SpaceServerSocket_TCPDataArrival; break; case ConferenceClientAcceptType.ConferenceInfoSync: //消息服务端口绑定 point = Constant.InfoServerPoint; if (Constant.MeetCount > 1) { //多个会议,合理分配端口 point += Constant.MeetCount * 7; } //服务器通讯节点初始化辅助 ServerSocket InfoServerSocket = Constant.ServerSocketInitHelper(meetServerSocket, point); //获取客户端信息 InfoServerSocket.TCPDataArrival += InfoServerSocket_TCPDataArrival; break; case ConferenceClientAcceptType.LyncConversationSync: //lync服务端口绑定 point = Constant.LyncServerPoint; if (Constant.MeetCount > 1) { //多个会议,合理分配端口 point += Constant.MeetCount * 7; } //服务器通讯节点初始化辅助 ServerSocket LyncServerSocket = Constant.ServerSocketInitHelper(meetServerSocket, point); //获取客户端信息 LyncServerSocket.TCPDataArrival += LyncServerSocket_TCPDataArrival; break; case ConferenceClientAcceptType.ConferenceMatrixSync: //lync服务端口绑定 point = Constant.MatrixServerPoint; if (Constant.MeetCount > 1) { //多个会议,合理分配端口 point += Constant.MeetCount * 7; } //服务器通讯节点初始化辅助 ServerSocket MatrixServerSocket = Constant.ServerSocketInitHelper(meetServerSocket, point); //获取客户端信息 MatrixServerSocket.TCPDataArrival += MatrixServerSocket_TCPDataArrival; break; default: break; } } catch (Exception ex) { LogManage.WriteLog(typeof(Constant), ex); } finally { } }