void DesktopDummy_EntsvcAllowControl(clsMessageContract objContract) { try { if (lstNodes.Count > 0) { int ControlTag = 0; if (objContract.blControl) { ControlTag = 1; } else if (!objContract.blControl) { ControlTag = 0; } #region 20oct changes clsGetMessage objGetMessage = new clsGetMessage(); objGetMessage.strFrom = objContract.strFrom; objGetMessage.strType = ""; objGetMessage.strTo = ""; objGetMessage.x = new double(); objGetMessage.y = new double(); objGetMessage.stremImage = new MemoryStream(); objGetMessage.mouseButton = new int(); objGetMessage.key = new int(); objGetMessage.blView = new bool(); objGetMessage.blControl = new bool(); objGetMessage.id = 11; objGetMessage.ViewTag = new int(); objGetMessage.ControlTag =ControlTag ; #endregion 20oct changes for (int i = 0; i < lstNodes.Count; i++) { List<clsGetMessage> lstStream = (List<clsGetMessage>)hashMessages[lstNodes[i].uName]; if (ControlTag == 0) { lstStream.Clear(); } lstStream.Add(objGetMessage); hashMessages[lstNodes[i].uName] = lstStream; } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "DesktopDummy_EntsvcAllowControl", "DesktopDummy.cs"); } }
void DesktopDummy_EntsvcUnJoin(clsMessageContract objContract) { try { #region 20oct changes clsGetMessage objGetMessage = new clsGetMessage(); objGetMessage.strFrom = objContract.strFrom; objGetMessage.strType = ""; objGetMessage.strTo = ""; objGetMessage.x = new double(); objGetMessage.y = new double(); objGetMessage.stremImage = new MemoryStream(); objGetMessage.mouseButton = new int(); objGetMessage.key = new int(); objGetMessage.blView = new bool(); objGetMessage.blControl = new bool(); objGetMessage.id = 12; objGetMessage.ViewTag = new int(); objGetMessage.ControlTag = new int(); #endregion 20oct changes for (int i = 0; i < lstNodes.Count; i++) { List<clsGetMessage> lstStream = (List<clsGetMessage>)hashMessages[lstNodes[i].uName]; lstStream.Add(objGetMessage); hashMessages[lstNodes[i].uName] = lstStream; } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "DesktopDummy_EntsvcUnJoin", "DesktopDummy.cs"); } }
void DesktopDummy_EntsvcStopControl(clsMessageContract objContract) { try { if (lstNodes.Count > 0) { for (int i = 0; i < lstNodes.Count; i++) { if (lstNodes[i].uName == objContract.strFrom) { #region 20oct changes clsGetMessage objGetMessage = new clsGetMessage(); objGetMessage.strFrom = objContract.strFrom; objGetMessage.strType = ""; objGetMessage.strTo = ""; objGetMessage.x = new double(); objGetMessage.y = new double(); objGetMessage.stremImage = new MemoryStream(); objGetMessage.mouseButton = new int(); objGetMessage.key = new int(); objGetMessage.blView = new bool(); objGetMessage.blControl = new bool(); objGetMessage.id = 5; objGetMessage.ControlTag = new int(); objGetMessage.ViewTag = new int(); #endregion 20oct changes List<clsGetMessage> lstStream = (List<clsGetMessage>)hashMessages[lstNodes[i].uName]; lstStream.Clear(); lstStream.Add(objGetMessage); hashMessages[lstNodes[i].uName] = lstStream; strSelected = ""; lstNodes[i].isControlled = false; } } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "DesktopDummy_EntsvcStopControl", "DesktopDummy.cs"); } }
void DesktopDummy_EntsvcSendMessage(clsMessageContract objContract) { try { if (lstNodes.Count > 0) { #region 20oct changes clsGetMessage objGetMessage = new clsGetMessage(); objGetMessage.strFrom = objContract.strFrom; objGetMessage.strType = ""; objGetMessage.strTo = ""; objGetMessage.x = new double(); objGetMessage.y = new double(); objGetMessage.stremImage = objContract.stremImage; objGetMessage.mouseButton = new int(); objGetMessage.key = new int(); objGetMessage.blView = new bool(); objGetMessage.blControl = new bool(); objGetMessage.id = 3; objGetMessage.ControlTag = new int(); objGetMessage.ViewTag = new int(); #endregion 20oct changes string uNameImg = objContract.strFrom; for (int i = 0; i < lstNodes.Count; i++) { if (lstNodes[i].isControlled) { } else if ((!lstNodes[i].isControlled) && (!lstNodes[i].isControlling)) { List<clsGetMessage> lstStream = (List<clsGetMessage>)hashMessages[lstNodes[i].uName]; lstStream.Add(objGetMessage); hashMessages[lstNodes[i].uName] = lstStream; } if (lstNodes[i].isControlling && lstNodes[i].strControlled==uNameImg) { List<clsGetMessage> lstStream = (List<clsGetMessage>)hashMessages[lstNodes[i].uName]; lstStream.Add(objGetMessage); hashMessages[lstNodes[i].uName] = lstStream; } } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "DesktopDummy_EntsvcSendMessage", "DesktopDummy.cs"); } }
clsGetMessage Http_EntsvcGetMessages(clsMessageContract streamRecipient) { try { string strRecipient = streamRecipient.strFrom; List<clsGetMessage> lstTemp = (List<clsGetMessage>)hashMessages[strRecipient]; if (lstTemp.Count > 0 && lstTemp[0] != null && lstTemp != null) { clsGetMessage objGet = new clsGetMessage(); objGet = lstTemp[0]; lstTemp.RemoveAt(0); hashMessages[strRecipient] = lstTemp; return objGet; } else { clsGetMessage objGet = new clsGetMessage(); objGet.blControl = new bool(); objGet.blView = new bool(); objGet.ControlTag = new int(); objGet.id=new int(); objGet.key=new int(); objGet.mouseButton=new int(); objGet.stremImage = new MemoryStream(); objGet.strFrom = ""; objGet.strTo = ""; objGet.strType = ""; objGet.ViewTag = new int(); objGet.x = new double(); objGet.y = new double(); return objGet; } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "Http_EntsvcGetMessages", "DesktopDummy.cs"); clsGetMessage objGet = new clsGetMessage(); objGet.blControl = new bool(); objGet.blView = new bool(); objGet.ControlTag = new int(); objGet.id = new int(); objGet.key = new int(); objGet.mouseButton = new int(); objGet.stremImage = new MemoryStream(); objGet.strFrom = ""; objGet.strTo = ""; objGet.strType = ""; objGet.ViewTag = new int(); objGet.x = new double(); objGet.y = new double(); return objGet; } }
void dispTimer_Tick(object sender, EventArgs e) { try { #region MsgContract clsMessageContract objMsgContract = new clsMessageContract(); objMsgContract.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName; objMsgContract.stremImage = new MemoryStream(); #endregion MsgContract // Stream objStream = new MemoryStream(); clsGetMessage obj = new clsGetMessage(); obj = channelHttp.svcGetMessages(objMsgContract); Stream tempBytes = null; if (!string.IsNullOrEmpty(obj.strFrom)) { tempBytes = fncStringToStream(obj.strFrom); } else { tempBytes = fncStringToStream(obj.strTo); } if (tempBytes.Length>0) { Dispatcher.BeginInvoke(DispatcherPriority.Normal, objDelGetMsg, obj); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "dispTimer_Tick", "ctlDesktop_Sharing.xaml.cs"); } }
void delGetMessage(clsGetMessage objGetMsg) { try { string str = objGetMsg.id.ToString(); switch(str) { case "1": #region GetUserList Messege // GetUserList Messege try { string uName = objGetMsg.strFrom; if (VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName != uName) { bool flag = true; for (int j = 0; j < lstName.Count; j++) { if (lstName[j] == uName) { flag = false; break; } } if (flag) { lstName.Add(uName); } this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, objGetUserList, lstName); if (channelHttp != null) { #region MsgContract clsMessageContract objContarctSetUserlist = new clsMessageContract(); objContarctSetUserlist.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName; objContarctSetUserlist.strType = "Set"; objContarctSetUserlist.stremImage = new MemoryStream(); #endregion MsgContract channelHttp.svcSetUserList(objContarctSetUserlist); } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } break; #endregion case "2": #region SetUserList Messege // SetUserList Messege try { string uNameSet = objGetMsg.strFrom; if (VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName != uNameSet) { bool flagSet = true; for (int i = 0; i < lstName.Count; i++) { if (lstName[i] == uNameSet) { flagSet = false; break; } } if (flagSet) { lstName.Add(uNameSet); } this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, objGetUserList, lstName); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } break; #endregion case "3": #region Image Messege // Image Messege try { byte[] myBytes = fncStreamToByteArry(objGetMsg.stremImage); MemoryStream mmsTemp = new MemoryStream(); mmsTemp.Write(myBytes, 0, myBytes.Length); mmsTemp.Position = 0; string uNameImg = objGetMsg.strFrom; byte[] byteData = mmsTemp.ToArray(); if (uNameImg != VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName) { List<object> lstData = new List<object>(); lstData.Add(uNameImg); lstData.Add(byteData); this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, objDelSendMsg, lstData); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } break; #endregion case "4": #region DesktopSelected Messege // DesktopSelected Messege try { string uNameSel = objGetMsg.strFrom; if (VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName == uNameSel) { ImgSize = true; } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } break; #endregion case "5": #region StopControl Messege //StopControl Messege try { string uNameStop = objGetMsg.strFrom; if (VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName == uNameStop) { ImgSize = false; } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } break; #endregion case "6": #region Buttonup Messege //Buttonup Messege try { string mouseButton = objGetMsg.mouseButton.ToString(); string ToBtnUp = objGetMsg.strTo; if (VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName == ToBtnUp) { if (mouseButton == "1") { myMouseInput.MouseInput.MouseFlag = MOUSE_LEFTUP; SendInput(1, ref myMouseInput, Marshal.SizeOf(myMouseInput)); } else if (mouseButton == "2") { myMouseInput.MouseInput.MouseFlag = MOUSEEVENTF_RIGHT_UP; SendInput(1, ref myMouseInput, Marshal.SizeOf(myMouseInput)); } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } break; #endregion case "7": #region Buttondown Messege //Buttondown Messege try { string mouseButtonDown = objGetMsg.mouseButton.ToString(); string ToBtnDown = objGetMsg.strTo; if (VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName == ToBtnDown) { if (mouseButtonDown == "1") { myMouseInput.MouseInput.MouseFlag = MOUSE_LEFTDOWN; SendInput(1, ref myMouseInput, Marshal.SizeOf(myMouseInput)); } else if (mouseButtonDown == "2") { myMouseInput.MouseInput.MouseFlag = MOUSEEVENTF_RIGHTDOWN; SendInput(1, ref myMouseInput, Marshal.SizeOf(myMouseInput)); } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } break; #endregion case "8": #region SendXY Messege //SendXY Messege try { string To = objGetMsg.strTo; if (VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName == To) { System.Windows.Forms.Cursor.Position = new System.Drawing.Point(Convert.ToInt32(objGetMsg.x), Convert.ToInt32(objGetMsg.y)); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } break; #endregion case "9": #region SendKey Messege //SendKey Messege try { string ToKey = objGetMsg.strTo; if (VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName == ToKey) { whichbuttonpushed(objGetMsg.key); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } break; #endregion case "10": #region View Messege //View Messege try { string ViewTag = objGetMsg.ViewTag.ToString(); string ToView = objGetMsg.strFrom; if (ToView != VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName) { if (ViewTag == "0") { List<object> lstData = new List<object>(); lstData.Add(ToView); lstDisAllowView.Add(ToView); this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, objDisAllowView, lstData); } else { for (int j = 0; j < lstDisAllowView.Count; j++) { if (lstDisAllowView[j] == ToView) { lstDisAllowView.RemoveAt(j); break; } } } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } break; #endregion case "11": #region Control Messege //Control Messege try { string ControlTag = objGetMsg.ControlTag.ToString(); string ToControl = objGetMsg.strFrom; if (ToControl != VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName) { bool blControl = false; if (ControlTag == "0") { blControl = false; } else if (ControlTag == "1") { blControl = true; } if (!blControl) { bool flagControl = true; for (int i = 0; i < lstDisAllowControl.Count; i++) { if (lstDisAllowControl[i] == ToControl) { flagControl = false; break; } } if (flagControl) { lstDisAllowControl.Add(ToControl); } if (strSelectedUser == ToControl) { this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, objStopControl); } } else if (blControl) { for (int j = 0; j < lstDisAllowControl.Count; j++) { if (lstDisAllowControl[j] == ToControl) { lstDisAllowControl.RemoveAt(j); break; } } } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } break; #endregion case "12": #region Unjoin Messege string uNameUnJoin = objGetMsg.strFrom; if (uNameUnJoin != VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName) { List<object> lstData = new List<object>(); lstData.Add(uNameUnJoin); this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, objRemoveUser, lstData); } break; #endregion default: break; } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delGetMessage", "ctlDesktop_Sharing.xaml.cs"); } }