public MessageEventArgs(string topic, string json) { Topic = topic; if (!String.IsNullOrWhiteSpace(json)) { _data = JsonConvert.DeserializeObject<MessageObject>(json); } else { _data = new MessageObject(); } }
public MessageObjectAll(MessageObject object1, MessageObject object2, MessageObject object3, MessageObject object4, MessageObject object5, MessageObject object6, MessageObject object7, MessageObject object8, MessageObject object9, MessageObject object10) { Object1 = object1; Object2 = object2; Object3 = object3; Object4 = object4; Object5 = object5; Object6 = object6; Object7 = object7; Object8 = object8; Object9 = object9; Object10 = object10; }
public void ShowMessage (string text, Action completion = null, bool autohide = true) { if (currentMessage != null) return; gameObject.GetComponent<AudioSource> ().Play (); currentMessage = Instantiate (messagePrefab); currentMessage.transform.SetParent (mainCanvas.transform, false); currentMessage.message.text = text; currentMessage.ShowMessage (completion); if (autohide) { StartCoroutine (HideMessage (Constants.messageTime, null)); } }
public void ProcessMessage(string channelId, string message, Protocol protocol) { var request = CreateRequest().ForOperation(Operations.Messages.ProcessMessage); var messageObject = new MessageObject { Id = Guid.NewGuid().ToString(), ChannelId = channelId, RawDataProtocol = protocol, RawData = message.Replace("\r\n", "
"), DateCreated = DateTime.Now.ToMirthDateTime("Europe/London"), ConnectorName = "Source" }; request.AddPostData("message", messageObject.ToXml()); request.Execute(); }
/// <summary> /// Runs in background clientReceiveThread; Listens for incomming data. /// </summary> private void ListenForData() { try { socketConnection = new TcpClient(Globals.ip, Globals.port); SendMessage(new HelloMessage(Globals.name)); SendMessage(new GetStateMessage()); Byte[] bytes = new Byte[1024]; while (true) { // Get a stream object for reading using (NetworkStream stream = socketConnection.GetStream()) { int length; // Read incomming stream into byte arrary. while ((length = stream.Read(bytes, 0, bytes.Length)) != 0) { var incommingData = new byte[length]; Array.Copy(bytes, 0, incommingData, 0, length); // Convert byte array to string message. string serverMessage = Encoding.UTF8.GetString(incommingData); receivedMessage = JsonUtility.FromJson <MessageObject>(serverMessage); Debug.Log("server message received as: " + serverMessage); if (receivedMessage.type.Equals("end")) { Disconnect(); clientReceiveThread.Abort(); } if (receivedMessage.type.Equals("chat")) { receivedChatMessage = new ChatMessage(receivedMessage); //Debug.Log("receivedChatMessage: " + receivedChatMessage); } if (receivedMessage.type.Equals("welcome")) { receivedWelcomeMessage = new WelcomeMessage(receivedMessage); //Debug.Log("receivedWelcomeMessage: " + receivedMessage); } if (receivedMessage.type.Equals("state")) { //Debug.Log("receivedStateMessage"); Dictionary <string, string> posMessage = JsonConvert.DeserializeObject <Dictionary <string, string> >(serverMessage); receivedStateMessage = new StateMessage(JsonConvert.DeserializeObject <Dictionary <string, string> >(posMessage["positions"])); } if (receivedMessage.type.Equals("stateofcubes")) { //Debug.Log("receivedStateOfCubesMessage"); Dictionary <string, string> posMessage = JsonConvert.DeserializeObject <Dictionary <string, string> >(serverMessage); List <ReceivedCubeFromServer> receivedCubesFromServer = JsonConvert.DeserializeObject <List <ReceivedCubeFromServer> >(posMessage["cubes"]); receivedStateofCubesFromServerMessage = new StateOfCubesFromServerMessage(receivedCubesFromServer); } if (receivedMessage.type.Equals("addCube")) { //Debug.Log("receivedStateOfCubesMessage"); Dictionary <string, string> posMessage = JsonConvert.DeserializeObject <Dictionary <string, string> >(serverMessage); receivedAddCubeFromServerMessage = new AddCubeFromServerMessage(posMessage["position"], posMessage["matIndex"], posMessage["owner"]); } if (receivedMessage.type.Equals("removeCube")) { //Debug.Log("receivedStateOfCubesMessage"); Dictionary <string, string> posMessage = JsonConvert.DeserializeObject <Dictionary <string, string> >(serverMessage); receivedRemoveCubeFromServerMessage = new RemoveCubeFromServerMessage(posMessage["position"]); } } } } } catch (SocketException socketException) { Debug.Log("Socket exception: " + socketException); } }
public static Values3D ParseSelectionWithCurrentSettings(Range pSelection, UploadForm pFrm, int mFirstDataRow, int mFirstDataCol) { var mMessages = new MessageObject(); pFrm.Log("Freistar å prosessere utvalet med gjeldande innstillingar", true); var mTimer = new Stopwatch(); mTimer.Start(); var mSelection = pSelection.Cells.Value; // Create data object to hold values var mData = new Values3D(); // For each row for (int mR = mFirstDataRow; mR <= pSelection.Rows.Count; mR++) { // For each column for (int mC = mFirstDataCol; mC <= pSelection.Columns.Count; mC++) { // Get the value (as a double) var mAdaptiveValue = new AdaptiveValue(Table.GetNullOrDoubleString(mSelection[mR, mC])); // Get manual settings for statistical variable var mManualStatVarProps = pFrm.ParseStatVarProperties(mR, mC, pFrm.StatVarProperties.DataOrientation); // Get/set the corresponding statvar if (mManualStatVarProps.StatVar1 != null) { mAdaptiveValue.variable1 = mManualStatVarProps.StatVar1.var1; if (String.IsNullOrWhiteSpace(mManualStatVarProps.StatVar1.var1)) { mMessages.AddMessage(MessagesNotices.StatVarParseUsingDefaultNotice); } } if (mManualStatVarProps.StatVar2 != null) { mAdaptiveValue.variable2 = mManualStatVarProps.StatVar2.var2; } if (mManualStatVarProps.StatVar3 != null) { mAdaptiveValue.variable3 = mManualStatVarProps.StatVar3.var3; } if (mManualStatVarProps.StatVar4 != null) { mAdaptiveValue.variable4 = mManualStatVarProps.StatVar4.var4; } if (mManualStatVarProps.StatVar5 != null) { mAdaptiveValue.variable5 = mManualStatVarProps.StatVar5.var5; } mAdaptiveValue.fk_variable = mManualStatVarProps.fk_variable; // Get/set the measurement unit mAdaptiveValue.enhet = mManualStatVarProps.MeasurementUnit; if (mAdaptiveValue.enhet == null) { mMessages.AddMessage(MessagesErrors.MUnitNotSet); } // Add date, if available if (pFrm.StatDatumProperties != null) { // Add logic to parse the date value into its individual parts here var mStatDatum = new StatDateParser((string)pFrm.StatDatumProperties.GetValue(mR, mC), (string)pFrm.cbStatDatumFormat.SelectedValue); if (mStatDatum.Success == true) { mAdaptiveValue.ar = mStatDatum.Year; mAdaptiveValue.mnd = mStatDatum.Month; //mAdaptiveValue.Day = mStatDatum.Day; mAdaptiveValue.kvartal = mStatDatum.Quarter; } else { mMessages.AddMessage(MessagesErrors.AutoDateParseError); } } else { // Get the values from the datagridview with statistical variables if (mManualStatVarProps.Year != null) { mAdaptiveValue.ar = mManualStatVarProps.Year; mMessages.AddMessage(MessagesErrors.ManualDateNotSet); } if (mManualStatVarProps.Quarter != null) { mAdaptiveValue.kvartal = mManualStatVarProps.Quarter; mMessages.AddMessage(MessagesNotices.ManualQuarterNotSet); } if (mManualStatVarProps.Month != null) { mAdaptiveValue.mnd = mManualStatVarProps.Month; mMessages.AddMessage(MessagesNotices.ManualMonthNotSet); } if (mManualStatVarProps.Day != null) { mAdaptiveValue.Day = mManualStatVarProps.Day; mMessages.AddMessage(MessagesNotices.ManualDayNotSet); } } if (pFrm.StatAreaIDsProperties != null || pFrm.StatAreaNameProperties != null || pFrm.StatAreaGroupProperties != null) { // Add statareaID if available if (pFrm.StatAreaIDsProperties != null) { mAdaptiveValue.krets_id = (string)pFrm.StatAreaIDsProperties.GetValue(mR, mC); } // Statareaname is only relevant if id is present if (pFrm.StatAreaNameProperties != null) { mAdaptiveValue.krets_navn = (string)pFrm.StatAreaNameProperties.GetValue(mR, mC); } // Statarea group is only relevant if id is present if (pFrm.StatAreaGroupProperties != null) { mAdaptiveValue.region = (string)pFrm.StatAreaGroupProperties.GetValue(mR, mC); } } // If no auto-properties, pick values from manual form fields else { mAdaptiveValue.krets_id = pFrm.tbStatUnitID.Text; mAdaptiveValue.krets_navn = pFrm.tbStatUnitName.Text; mAdaptiveValue.region = pFrm.tbStatUnitGroup.Text; } mData.AddByKey(mAdaptiveValue, mR, mC); } } mTimer.Stop(); pFrm.Log(mMessages.GetMessages()); pFrm.Log(String.Format("Ferdig på {0} ms", mTimer.ElapsedMilliseconds)); return mData; }
public void Send(MessageObject message) { // Overwrite Time and Date to Servertime message.Timestamp = DateTime.Now; Clients.All.AddNewMessage(message); }
// On updated values void OnUpdateValues(NetworkMessage msg) { // When values updated Debug.Log("Server: Values updated"); MessageObject o = msg.ReadMessage <MessageObject>(); }
//Send notify, do not need id internal void Send(string route, MessageObject msg) { Send(route, 0, msg); }
public MessageResult(string errorMessage) { IsSuccess = false; Messages = new MessageObject[] { new MessageObject(errorMessage) }; }
protected void OnActionFinish(MessageObject msg) { GestureManager.Instance.EnableMoveChar(); }
public void RecieveConnectionMsgResponse(MessageObject m) { ConnectionChechMessage msg = (ConnectionChechMessage)m; foreach(ClientProfile p in ClientList.Values) { if(p.ClientId == msg.profile.ClientId) { p.connectionCheckRecievedDateTime = DateTime.Now.ToFileTime(); break; } } }
public void RegisterAudio(MessageObject msg) { RegisterAudioMessage m=(RegisterAudioMessage) msg; int i=0; ClientProfile profile=(ClientProfile)ClientList[m.SenderID]; if(profile != null) { if(m.subscribe==true) { profile.audioID=m.audioID; Audio a=new Audio(); AudioList.Add( m.audioID,a); } else profile.audioID=0; BroadcastControlMessage(ControlCode.AttendeeUpdate, profile); } }
public void Execute(WebSocketClient SocketClient, MessageObject Data) { SocketClient.Send(new PongHandler()); }
public void ClientActions(MessageObject message) { switch (message.FormIdentifier) { //Loading Screen case 0: { LoadingScreen loadingscreen = (LoadingScreen)Form.ActiveForm; switch (message.ObjectIdentifier) { //Farmer case 1: { switch (message.ActionIdentifier) { //Select case 1: { Farmer[] AllFarmers = (Farmer[])message.Data.BinaryDeserialization(); InvokeFarmerforLoading(AllFarmers, loadingscreen); break; } default: break; } break; } default: break; } break; } //Farmer Selection case 1: { Farmer_Selection farmerSelection = (Farmer_Selection)Form.ActiveForm; switch (message.ObjectIdentifier) { //Farmer case 1: { switch (message.ActionIdentifier) { //Select case 1: { Farmer[] AllFarmers = (Farmer[])message.Data.BinaryDeserialization(); InvokeFarmer(AllFarmers, farmerSelection); break; } default: break; } break; } default: break; } break; } //Animal Selection case 4: { Animal_Selection animalSelection = (Animal_Selection)Form.ActiveForm; switch (message.ObjectIdentifier) { //Species case 4: { switch (message.ActionIdentifier) { //Select case 1: { List <Species> species = (List <Species>)message.Data.BinaryDeserialization(); InvokeSpecies(species, animalSelection); break; } default: break; } break; } default: break; } break; } //Farm View case 6: { Farm_View farmView = (Farm_View)Form.ActiveForm; switch (message.ObjectIdentifier) { //Farm case 2: { switch (message.ActionIdentifier) { //Select case 1: { ArrayList farmViewData = (ArrayList)message.Data.BinaryDeserialization(); InvokeFarmView(farmViewData, farmView); break; } default: break; } break; } //Animal case 3: { switch (message.ActionIdentifier) { //Select case 1: { break; } default: break; } break; } //Location case 5: { switch (message.ActionIdentifier) { //Select case 1: { break; } default: break; } break; } default: break; } break; } default: break; } }
protected override void OnActivityResult(int req, Result res, Intent data) { var tvPreviewCommand = FindViewById <TextView>(Resource.Id.tvPreviewCommand); //STTtextBox = FindViewById<TextView>(Resource.Id.etxtCommand); if (req == NeedLang) { // we need a new language installed var installTTS = new Intent(); installTTS.SetAction(TextToSpeech.Engine.ActionInstallTtsData); StartActivity(installTTS); } else if (req == VOICE) { if (res == Result.Ok) { var matches = data.GetStringArrayListExtra(RecognizerIntent.ExtraResults); if (matches.Count != 0) { //string textInput = STTtextBox.Text + matches[0]; string textInput = matches[0]; // limit the output to 500 characters if (textInput.Length > 500) { textInput = textInput.Substring(0, 500); } tvPreviewCommand.Text = textInput; STTtextBox.Text = textInput; //put logic transfer here. compare keywords then redirect to next activity. if (textInput.ToLower() == "one" || textInput.ToLower() == "1" || textInput.ToLower() == "call" || textInput.ToLower() == "dial") { //start activity here. StartActivity(typeof(Activities.PhoneCallActivity)); } else if (textInput.ToLower() == "two" || textInput.ToLower() == "2" || textInput.ToLower() == "message" || textInput.ToLower() == "SMS") { StartActivity(typeof(Activities.MessageActivity)); } else if (textInput.ToLower() == "four" || textInput.ToLower() == "4" || textInput.ToLower() == "email" || textInput.ToLower() == "mail") { StartActivity(typeof(Activities.EmailActivity)); } else if (textInput.ToLower() == "read email" || textInput.ToLower() == "5" || textInput.ToLower() == "five") { var progressDialog = ProgressDialog.Show(this, "Please wait...", "Connecting to GDSS Mail Server", true); progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); new Thread(new ThreadStart(delegate { //LOAD METHOD TO GET ACCOUNT INFO RunOnUiThread(() => { Toast.MakeText(this, "Email Sync: Connecting to Server", ToastLength.Long).Show(); }); RunOnUiThread(() => RetrievePOP3Mail()); //RetrievePOP3Mail(); RunOnUiThread(() => { Toast.MakeText(this, "Email Sync: Successful", ToastLength.Long).Show(); }); //RunOnUiThread(() => { DatabaseUpdates tblEmail = new DatabaseUpdates(); List <EmailObject> EmailObjectList = tblEmail.EmailOBJ(); int emailListCount = 0; EmailObject item = EmailObjectList[emailListCount]; var actEmailReader = new Intent(this, typeof(EmailReaderActivity)); actEmailReader.PutExtra("emlFrom", item.From); actEmailReader.PutExtra("emlCC", item.CC); actEmailReader.PutExtra("emlDate", item.date.ToString()); actEmailReader.PutExtra("emlSubject", item.Subject); actEmailReader.PutExtra("emlBody", item.Body); actEmailReader.PutExtra("curPos", emailListCount); actEmailReader.PutExtra("maxPos", EmailObjectList.Count()); actEmailReader.PutExtra("autoRead", 1); actEmailReader.SetFlags(ActivityFlags.ReorderToFront); StartActivity(actEmailReader); //}); //HIDE PROGRESS DIALOG RunOnUiThread(() => progressDialog.Hide()); })).Start(); } else if (textInput.ToLower() == "read message" || textInput.ToLower() == "read messages" || textInput.ToLower() == "3" || textInput.ToLower() == "three") { var progressDialog = ProgressDialog.Show(this, "Please wait...", "Fetching Messages", true); progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); new Thread(new ThreadStart(delegate { //LOAD METHOD TO GET ACCOUNT INFO RunOnUiThread(() => { Toast.MakeText(this, "SMS Sync: Fetching Messages", ToastLength.Long).Show(); }); RunOnUiThread(() => { Toast.MakeText(this, "SMS Sync: Successful", ToastLength.Long).Show(); }); //RunOnUiThread(() => { var cursor = Application.Context.ContentResolver.Query(Telephony.Sms.Inbox.ContentUri, null, null, null, null); var actSMSReader = new Intent(this, typeof(MessageReaderActivity)); cursor.MoveToFirst(); var ID = cursor.GetString(cursor.GetColumnIndex(Telephony.Sms.Inbox.InterfaceConsts.Id)); string From = cursor.GetString(cursor.GetColumnIndex(Telephony.Sms.Inbox.InterfaceConsts.Address)).ToString(); string messageVal = cursor.GetString(cursor.GetColumnIndex(Telephony.Sms.Inbox.InterfaceConsts.Body)).ToString(); var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified); var Dateval = epoch.AddMilliseconds(cursor.GetLong(cursor.GetColumnIndex(Telephony.Sms.Inbox.InterfaceConsts.Date))).AddHours(10); var currSMS = new MessageObject(ID, From, messageVal, Dateval); actSMSReader.PutExtra("SMSFrom", From); actSMSReader.PutExtra("SMSID", ID); actSMSReader.PutExtra("SMSDate", Dateval.ToString()); actSMSReader.PutExtra("SMSMessage", messageVal); actSMSReader.PutExtra("curPos", 0); actSMSReader.PutExtra("maxPos", cursor.Count - 1); actSMSReader.PutExtra("autoRead", 1); actSMSReader.SetFlags(ActivityFlags.ReorderToFront); cursor.Close(); StartActivity(actSMSReader); //}); //HIDE PROGRESS DIALOG RunOnUiThread(() => progressDialog.Hide()); })).Start(); } else if (textInput.ToLower() == "six" || textInput.ToLower() == "6" || textInput.ToLower() == "assistant" || textInput.ToLower() == "google") { RunOnUiThread(async() => { //Process.KillProcess(Process.MyPid()); var voiceAssistantIntent = new Intent(RecognizerIntent.ActionVoiceSearchHandsFree); voiceAssistantIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm); // put a message on the modal dialog voiceAssistantIntent.PutExtra(RecognizerIntent.ExtraPrompt, "Assistant Command"); //Application.Context.GetString(Resource.String)); // if there is more then 1.5s of silence, consider the speech over voiceAssistantIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 3000); voiceAssistantIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 3000); voiceAssistantIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 3000); voiceAssistantIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1); voiceAssistantIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default); voiceAssistantIntent.SetFlags(ActivityFlags.ReorderToFront); try { await Task.Delay(4000); StartActivity(voiceAssistantIntent); } catch (Exception ex) { //Console.WriteLine(ex.Source + "|" + ex.Message); Console.WriteLine(ex.Source + "|" + ex.Message); } }); } else if (textInput.ToLower() == "quit" || textInput.ToLower() == "exit" || textInput.ToLower() == "close") { Process.KillProcess(Process.MyPid()); } else if (textInput.ToLower() == "settings" || textInput.ToLower() == "configuration") { StartActivity(typeof(Activities.ConfigActivity)); } else { SetReadMessage("Unrecognized command. You said: " + textInput); var btnAction = FindViewById <ImageButton>(Resource.Id.imgBtnListen); btnAction.SetImageResource(Resource.Drawable.micread); //@android:drawable/presence_audio_online + Android.Resource.Drawable.PresenceAudioOnline + Android.Resource.Drawable.IcDialogInfo } } else { STTtextBox.Text = "No speech was recognised"; SetReadMessage(STTtextBox.Text); } } } base.OnActivityResult(req, res, data); }
/// <summary>上传头像</summary> /// <param name="doc"></param> /// <returns></returns> public string Upload(XmlDocument doc) { StringBuilder outString = new StringBuilder(); string data = XmlHelper.Fetch("data", doc); Bitmap bitmap = null; int height; int width; IAccountInfo account = KernelContext.Current.User; if (account == null) { return(MessageObject.Stringify("1", "必须登陆后才能上传头像。")); } string directoryName = this.GetDirectoryName(account.Id); string path = MembershipConfigurationView.Instance.AvatarPhysicalFolder + directoryName + "\\"; string filePath = null; if (!Directory.Exists(path)) { DirectoryHelper.Create(path); } byte[] buffer = Convert.FromBase64String(data); using (MemoryStream stream = new MemoryStream(buffer)) { bitmap = new Bitmap(stream); } string[] sizes = MembershipConfigurationView.Instance.AvatarSizes.Split(','); height = width = Convert.ToInt32(sizes[0]); filePath = string.Format(@"{0}\{1}_" + height + "x" + width + ".png", path, account.Id); bitmap = KiResizeImage(bitmap, width, height); bitmap.Save(filePath, ImageFormat.Png); // 设置头像记录 filePath = account.CertifiedAvatar = "{avatar}" + directoryName + "/" + account.Id + "_" + height + "x" + width + ".png"; MembershipManagement.Instance.AccountService.SetCertifiedAvatar(account.Id, filePath); IAccountStorageStrategy strategy = KernelContext.Current.AuthenticationManagement.GetAccountStorageStrategy(); string accountIdentity = KernelContext.Current.AuthenticationManagement.GetIdentityValue(); SessionContext.Instance.Write(strategy, accountIdentity, account); // 保存其他格式图片 for (int i = 1; i < sizes.Length; i++) { height = width = Convert.ToInt32(sizes[i]); filePath = string.Format(@"{0}\{1}_" + height + "x" + width + ".png", path, account.Id); bitmap = KiResizeImage(bitmap, height, height); bitmap.Save(filePath, ImageFormat.Png); } // 记录帐号操作日志 MembershipManagement.Instance.AccountLogService.Log(account.Id, "membership.account.avatar.upload", "【" + account.Name + "】更新了自己的头像,【IP:" + IPQueryContext.GetClientIP() + "】。", account.Id); return("{\"data\":{\"virtualPath\":\"" + account.CertifiedAvatar.Replace("{avatar}", MembershipConfigurationView.Instance.AvatarVirtualFolder).Replace("//", "/") + "\"},\"message\":{\"returnCode\":0,\"value\":\"上传成功。\"}}"); }
public async Task Out(MessageObject message) { Task consoleOut = new Task(() => { DateTime now = DateTime.Now; string kewlLevel; Brush foregroundColor, backgroundColor; switch (message.Level) { case MessageLevel.Debug: kewlLevel = "[Ò___Ó] "; foregroundColor = Brushes.Black; backgroundColor = Brushes.DarkGray; break; case MessageLevel.Info: kewlLevel = "[o___o] "; foregroundColor = Brushes.Black; backgroundColor = ConsoleBgColor; break; case MessageLevel.Warn: kewlLevel = "[O___o;]"; foregroundColor = Brushes.Black; backgroundColor = Brushes.Yellow; break; case MessageLevel.Error: kewlLevel = "[X___-;]"; foregroundColor = Brushes.Black; backgroundColor = Brushes.DarkOrange; break; case MessageLevel.Fatal: kewlLevel = "[X___x;]"; foregroundColor = Brushes.White; backgroundColor = Brushes.DarkRed; break; default: kewlLevel = "[ ]"; foregroundColor = Brushes.Black; backgroundColor = ConsoleBgColor; break; } string[] lines = message.Message.Split(new[] { Environment.NewLine }, StringSplitOptions.None); foreach (string line in lines) { _uiContext.Send(x => { if (string.IsNullOrWhiteSpace(line)) { kewlLevel = string.Empty; } TextRange textRange = new TextRange(_console.Document.ContentEnd, _console.Document.ContentEnd) { Text = $" [{now.Hour:00}:{now.Minute:00}:{now.Second:00}] {kewlLevel} {line} {Environment.NewLine}" }; textRange.ApplyPropertyValue(TextElement.ForegroundProperty, foregroundColor); textRange.ApplyPropertyValue(TextElement.BackgroundProperty, backgroundColor); }, null); } _uiContext.Send(x => _console.ScrollToEnd(), null); }, TaskCreationOptions.LongRunning); consoleOut.Start(); await consoleOut; }
private void OnHitTerrain(MessageObject msg) { //IsPlayerControlled = false; m_CharTransformData.SetSelectedStatus(false); }
public void RegisterVideo(MessageObject msg) { RegisterVideoMessage m=(RegisterVideoMessage) msg; int i=0; ClientProfile profile=(ClientProfile)ClientList[msg.SenderID]; if(profile != null) { if(m.subscribe==true) { profile.videoID=m.videoID; Video v=new Video(); VideoList.Add( m.videoID,v); } else { profile.videoID=-1; } BroadcastControlMessage(ControlCode.AttendeeUpdate, profile); } }
public void SendAudioMessage(MessageObject msg) { AudioMessage m =(AudioMessage) msg; Audio a=(Audio)AudioList[m.audioID]; if(a!=null) a.SendMessage(ref m); }
/// <summary> /// This Method will only be called by the Host /// </summary> /// <param name="incoming_MMmsg"> this message comes from the Network and of type Minuts of meeting</param> public void _Snapshot(MessageObject incoming_MMmsg) { try { Common.Mes_MinutsofMeeting mm_msg; // Will be filled on the Host side //msg_Minuts.Available=false; //msg_Minuts.Host=HostName(); //msg_Minuts.Mis=""; //msg_Minuts.Available // This filed is used for Text only //msg_Minuts.Text mm_msg =(Common.Mes_MinutsofMeeting)incoming_MMmsg; mm_msg.Available=0; mm_msg.Host=ClientUI.getInstance().HostName(); if( mm_msg.Module=="Whiteboard") { Whiteboard_Snapshot(mm_msg); } else if( mm_msg.Module=="Appshare") { Appshare_Snapshot(mm_msg); } else if( mm_msg.Module=="Webshare") { WebBrowser_Snapshot(mm_msg); } } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Minuts_controller.cs line==> 102",exp,null,false); } }
/*void SendLoggedMessage(MessageObject message); void SendNonLoggedMessage(MessageObject message); void SendNonLoggedMessage2(MessageObject message); void SendPrivateChatMessage(MessageObject obj,int receiverConnectionID); void RemoveClientFromConference(string clientURI, bool gracefulExit); void GetUniqueSessionID(ref int i); void GetManageContent(MessageObject msg); void SendAudioMessage(MessageObject m); void SendVideoMessage(MessageObject m); void SubscribeToAudio(MessageObject m); void SubscribeToVideo(MessageObject m); void RegisterVideo(MessageObject msg); void RegisterAudio(MessageObject msg); void CloseConference(MessageObject msg); int StartDocumentSharing(ref MessageObject msg); void RequestDesktopShare(int clientID, int senderID); int HandleDesktopShareRespnse(int clientID,int senderId,bool response); void RecieveConnectionMsgResponse(MessageObject m); void SendDesktopMessage(MessageObject m); string UserDefinedPing(string msgtext); */ //Method for network test. public void SendDesktopMessage(MessageObject m) { AppSharingMessageEx msg=(AppSharingMessageEx ) m; Desktop a=(Desktop)DesktopList[msg.sessionId]; if(a!=null) a.SendMessage(ref msg); }
public void UpdateSkillProgress(MessageObject message) { Actor player = message.play; Actor building = message.bldg; updatePlayerSkillProgress(player, building.Name); }
/// <summary> /// Sends message to all clients. /// </summary> /// <param name="message">Message to send.</param> /// <returns>Number of clients having received this message.</returns> public void SendLoggedMessage(MessageObject message) { // fetch the nickname //string nickname = GenuineUtility.CurrentSession["Nickname"] as string; //Console.WriteLine("Message \"{0}\" will be sent to all clients from {1}.", message, nickname); //IMessageReceiver iMessageReceiver = (IMessageReceiver) this._dispatcher.TransparentProxy; // Zaeem view /// This code should be commented /// if(message.GetType() == typeof(DocumentSharing)) { int x = ((DocumentSharing)message).sessionID; Object obj = DocumentSharingList[x]; if(obj == null) DocumentSharingList.Add(((DocumentSharing)message).sessionID,message); else DocumentSharingList[x] = message; } else if(message.GetType() == typeof(DrawingClearMessage)) { try { DrawingClearMessage dMsg = (DrawingClearMessage)message; if(dMsg.m_ControlType == ControlType.DrawingBoard) { for(int i = LoggedMessages.Count -1 ; i >= 0 ; i --) { MessageObject objMsg = (MessageObject)LoggedMessages[i]; if(objMsg.GetType().Equals(typeof(StateUpdateMessage))) { if(((StateUpdateMessage)objMsg).updateType == UpdateTypeCode.UpdateWhiteboard) { LoggedMessages.Remove(objMsg); } } } } } catch(Exception ee) { } } else if(message.GetType() == typeof(MsgWebBrowseMessage)) { MsgWebBrowseMessage msg = (MsgWebBrowseMessage)message; Object obj = WebBrowserList[msg.webBrowseID]; if(obj == null) WebBrowserList.Add(msg.webBrowseID,message); else WebBrowserList[msg.webBrowseID] = message; } else if(message.GetType().Equals(typeof(StateUpdateMessage))) { StateUpdateMessage msg = (StateUpdateMessage )message; if(msg.updateType != UpdateTypeCode.UpdateAppsharingannotations) LoggedMessages.Add(message); } else if(message.GetType().Equals(typeof(TabPagesSyncrhonizationMsessage))) { msgSynchronization = (TabPagesSyncrhonizationMsessage)message; } else LoggedMessages.Add(message); if(message.GetType() == typeof(ControlMessage)) { ControlMessage tempMessage = (ControlMessage) message; if(tempMessage.Code == ControlCode.AttendeeUpdate) { ClientProfile prof = (ClientProfile)tempMessage.Parameter;// = profile; foreach(ClientProfile cp in ClientList.Values) { if(prof.ClientId == cp.ClientId) { ClientList.Remove(prof.ClientId); ClientList.Add(prof.ClientId,prof); //GenuineUtility.CurrentSession["Profile"] = prof; break; } } } else if(tempMessage.Code == ControlCode.PresenterClosedConference) { CloseConference(tempMessage); } else if(tempMessage.Code == ControlCode.PresenterKickedPerson) { ClientProfile prof = (ClientProfile)tempMessage.Parameter;// = profile; IMessageReceiver iMessageReceiver = (IMessageReceiver) Activator.GetObject(typeof(IMessageReceiver), prof.clientURI); if(iMessageReceiver != null) { iMessageReceiver.ReceiveMessage(tempMessage); LoggedMessages.Remove(message); return; } } } ((IMessageReceiver) this._dispatcher.TransparentProxy).ReceiveMessage(message); }
public bool DocumentShareStart(string strPath,out MessageObject msg) { msg = null; try { m_sharedFilePath = strPath; if(UploadDocument()) { if(OnStatusUpdateFunction !=null) OnStatusUpdateFunction(DOCSHARING_REQUEST_MSG); NetworkManager networkMngr = NetworkManager.getInstance(); WebMeeting.Common.DocumentSharing message = new WebMeeting.Common.DocumentSharing(); message.SenderID = networkMngr.profile.ClientId; message.ConferenceID=networkMngr.profile.ConferenceID; message.CurrentPage=1; message.senderProfile = networkMngr.profile; message.sessionID = this.sessionID; message.DocumentSharingSessionId = this.sessionID; message.DownloadURL = Path.GetFileName(strPath);//this.strRemoteUrl; message.DocumentType = this.m_DocumentType; MessageObject Message2 = ((MessageObject)message); if(networkMngr.StartDocumentSharing(ref Message2) == false) { if(OnStatusUpdateFunction !=null) OnStatusUpdateFunction("Unable to Initialize Document Sharing. Please try again"); return false; } if(message.DocumentType==DocumentMessageType.typePDF) this.strRemoteUrl+=("/"+Path.GetFileNameWithoutExtension(strPath));//this.strRemoteUrl; message.DownloadURL=this.strRemoteUrl;/// Remote URL of the files msg = message; ((DocumentSharing)msg).TotalPages=((DocumentSharing)Message2).TotalPages; //msg = Message2; if(OnStatusUpdateFunction !=null) OnStatusUpdateFunction("Starting Document Sharing."); return true; } } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage( "DocumentSharingEx.cs ==>DocumentShareStart( line==>650",exp,null,false); } return false; }
/// <summary> /// Member Description /// Aborted The thread is in the Stopped state. /// AbortRequested The ThreadAbort method has been invoked on the thread, /// but the thread has not yet received the pending System.Threading. /// ThreadAbortException that will attempt to terminate it. /// Background The thread is being executed as a background thread, /// as opposed to a foreground thread. /// This state is controlled by setting the IsBackground property of the Thread class. /// Running The thread has been started, it is not blocked, and there is no pending ThreadAbortException. /// Stopped The thread has stopped. /// StopRequested The thread is being requested to stop. This is for internal use only. /// Suspended The thread has been suspended. /// SuspendRequested The thread is being requested to suspend. /// Unstarted The Thread.Start method has not been invoked on the thread. /// WaitSleepJoin The thread is blocked as a result of a call to Wait, Sleep or Join methods. /// /// </summary> /// <param name="msg"></param> public void ReceiveMessage(MessageObject msg) { try { //if the thead is Not alive due to some reason it will make that alive if(ReceiveThread==null) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Self made Exception of receive thread, Thread was null ", null ,null,false); } else if(!(ReceiveThread.IsAlive)) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Self made Exception of receive thread, Thread was not Alive,Its state was :==>==> "+this.ReceiveThread.ThreadState.ToString(),null,null,false); // ReceiveThread=new Thread(new ThreadStart(receiveThread)); // ReceiveThread.Name="Network Manager Constructor Thread: receiveThread()"; // ReceiveThread.Start(); // if((ReceiveThread.IsAlive)) // { // WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Now receive thread is alive.......and its state is :"+this.ReceiveThread.ThreadState.ToString(),new Exception(),null,false); // // } // } if(msg.MessageType == (ushort)MessageObjectType.MsgConnectionCheck) { myRecvMsgList.Add(msg); if(count >50) { count=0; } else count++; } else if(msg.SenderID!=this.profile.ClientId) { myRecvMsgList.Add(msg); if(count >50) { count=0; } else count++; } } catch(Exception exp)// e) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 166 receivethread ",exp,null,false); //WebMeeting.Error.Show(e.Message + " On Receive, Exception"); } }
private void OnChangeScene(MessageObject obj) { ClearAction(); }
public MessageObjectAll getMessages(int userId, int otherId, Int64 messageId) { MessageObjectAll allObjects = new MessageObjectAll(); if (messageId == 0) { messageId = 999999999; } DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlDataAdapter sda1 = new SqlDataAdapter("sp_messages", sqlConn); sda1.SelectCommand.CommandType = CommandType.StoredProcedure; sda1.SelectCommand.Parameters.Add("@OwnerId", SqlDbType.Int).Value = userId; sda1.SelectCommand.Parameters.Add("@OtherId", SqlDbType.Int).Value = otherId; sda1.SelectCommand.Parameters.Add("@MessageId", SqlDbType.Int).Value = messageId; //try //{ sda1.Fill(ds); dt = ds.Tables[0]; //} //catch (Exception ex) //{ //} //finally //{ sqlConn.Close(); sda1.Dispose(); sqlConn.Dispose(); //} if (dt.Rows.Count == 0) { return allObjects; } else { MessageObject object1 = new MessageObject(); MessageObject object2 = new MessageObject(); MessageObject object3 = new MessageObject(); MessageObject object4 = new MessageObject(); MessageObject object5 = new MessageObject(); MessageObject object6 = new MessageObject(); MessageObject object7 = new MessageObject(); MessageObject object8 = new MessageObject(); MessageObject object9 = new MessageObject(); MessageObject object10 = new MessageObject(); // profile pic url int userIdString = 0; Classes.Date d = new Classes.Date(); for (int i = 0; i < dt.Rows.Count; i++) { if (Convert.ToBoolean(dt.Rows[i]["Sender"].ToString())) { userIdString = Convert.ToInt32(dt.Rows[i]["OwnerId"].ToString()); } else { userIdString = Convert.ToInt32(dt.Rows[i]["OtherId"].ToString()); } MessageObject myMessageObject = new MessageObject( Convert.ToInt32(dt.Rows[i]["MessageId"].ToString()), Convert.ToBoolean(dt.Rows[i]["Sender"].ToString()), dt.Rows[i]["Message"].ToString(), d.FormatPassedDate(dt.Rows[i]["SubmitDate"].ToString()), Convert.ToBoolean(dt.Rows[i]["Unread"].ToString()), userIdString); switch (i) { case 0: { object10 = myMessageObject; break; } case 1: { object9 = myMessageObject; break; } case 2: { object8 = myMessageObject; break; } case 3: { object7 = myMessageObject; break; } case 4: { object6 = myMessageObject; break; } case 5: { object5 = myMessageObject; break; } case 6: { object4 = myMessageObject; break; } case 7: { object3 = myMessageObject; break; } case 8: { object2 = myMessageObject; break; } case 9: { object1 = myMessageObject; break; } } allObjects = new MessageObjectAll( object1, object2, object3, object4, object5, object6, object7, object8, object9, object10); } return allObjects; } }
public void Execute(WebSocketClient SocketClient, MessageObject Data) { SocketClient.Nickname = Convert.ToString(Data.Body["nickname"]); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.Frame = UIScreen.MainScreen.Bounds; View.BackgroundColor = UIColor.White; View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; mBtnClickMe = UIButton.FromType(UIButtonType.RoundedRect); mBtnSend = UIButton.FromType(UIButtonType.RoundedRect); mBtnLogin = UIButton.FromType(UIButtonType.RoundedRect); mBtnGetContacts = UIButton.FromType(UIButtonType.RoundedRect); mBtnClickMe.Frame = new RectangleF( View.Frame.Width / 2 - buttonWidth / 2, 10, //View.Frame.Height / 2 - buttonHeight / 2, buttonWidth, buttonHeight); mBtnSend.Frame = new RectangleF( View.Frame.Width / 2 - buttonWidth / 2, 10 + buttonHeight + labelHeight * 3, buttonWidth, buttonHeight); mBtnLogin.Frame = new RectangleF( View.Frame.Width / 2 - buttonWidth / 2, 10 + buttonHeight * 2 + labelHeight * 3, buttonWidth, buttonHeight); mBtnGetContacts.Frame = new RectangleF( View.Frame.Width / 2 - buttonWidth / 2, 10 + buttonHeight * 3 + labelHeight * 3, buttonWidth, buttonHeight); mPickerView = new UIPickerView(); mPickerView.Frame = new RectangleF( View.Frame.Width / 2 - buttonWidth / 2, 10 + buttonHeight * 3 + labelHeight * 3, buttonWidth, buttonHeight); mLblUsername = new UILabel(); mLblMessage = new UILabel(); mLblSendTo = new UILabel(); mLblUsername.Frame = new RectangleF(20, 10 + buttonHeight, labelWidth, labelHeight); mLblUsername.Text = "Username:"******"Message:"; mLblSendTo.Frame = new RectangleF(20, 10 + buttonHeight + labelHeight * 2, labelWidth, labelHeight); mLblSendTo.Text = "Send To:"; mTxtUsername = new UITextField(); mTxtMessage = new UITextField(); mTxtSendTo = new UITextField(); mTxtUsername.Frame = new RectangleF(20 + labelWidth, 10 + buttonHeight, textWidth, textHeight); mTxtMessage.Frame = new RectangleF(20 + labelWidth, 10 + buttonHeight + textHeight, textWidth, textHeight); mTxtSendTo.Frame = new RectangleF(20 + labelWidth, 10 + buttonHeight + textHeight * 2, textWidth, textHeight); mTxtUsername.Text = "iOSUser"; mBtnClickMe.SetTitle("Click me", UIControlState.Normal); mBtnSend.SetTitle("Send", UIControlState.Normal); mBtnLogin.SetTitle("Login", UIControlState.Normal); mBtnGetContacts.SetTitle("Get Contacts", UIControlState.Normal); mTxtUsername.ShouldReturn = (textfield) => { textfield.ResignFirstResponder(); return(true); }; mTxtMessage.ShouldReturn = (textfield) => { textfield.ResignFirstResponder(); return(true); }; mTxtSendTo.ShouldReturn = (textfield) => { textfield.ResignFirstResponder(); return(true); }; mBtnClickMe.TouchUpInside += (object sender, EventArgs e) => { mBtnClickMe.SetTitle(String.Format("clicked {0} times", numClicks++), UIControlState.Normal); //PCLProject.ServiceHelper.RecordClick(); ServiceHelper.GetInstance().RecordClick(numClicks, "ios"); }; mBtnSend.TouchUpInside += (object sender, EventArgs e) => { MessageObject message = new MessageObject() { Text = mTxtMessage.Text, Recipient = mTxtSendTo.Text }; ServiceHelper.GetInstance().SendMessage(message); }; mBtnLogin.TouchUpInside += async(object sender, EventArgs e) => { if (await ServiceHelper.GetInstance().Authenticate(mTxtUsername.Text, this)) { mBtnLogin.SetTitle("Logout", UIControlState.Normal); } }; mBtnGetContacts.TouchUpInside += async(object sender, EventArgs e) => { List <string> contacts = await ServiceHelper.GetInstance().GetContacts(); if (contacts != null && contacts.Count > 0) { mPickerViewModel = new ListPickerViewModel <string>(contacts); mPickerView.Model = mPickerViewModel; mPickerViewModel.ValueChanged += (pickerSender, pickerArgs) => { this.mTxtSendTo.Text = mPickerViewModel.SelectedItem.ToString(); }; //ArrayAdapter adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerItem, contacts); //adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); //mDdlContacts.Adapter = adapter; } }; mBtnClickMe.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin; View.AddSubview(mBtnClickMe); View.AddSubview(mLblUsername); View.AddSubview(mLblMessage); View.AddSubview(mLblSendTo); View.AddSubview(mTxtUsername); View.AddSubview(mTxtMessage); View.AddSubview(mTxtSendTo); View.AddSubview(mBtnSend); View.AddSubview(mBtnLogin); View.AddSubview(mBtnGetContacts); View.AddSubview(mPickerView); }
private void OnActionFinish(MessageObject obj) { StageManager.Instance.ChangeState(GameStateType.FlightState); }
private void NotifyCompleteDataReceived(MessageObject Data) { this.CompleteDataReceived?.Invoke(Data); }
private void OnHitLife(MessageObject msg) { var transform = ((Transform)(msg.msgValue)); if (transform == m_CharTransformData.GetGameObject().transform) { // set high light //m_CharTransformData.SetSelectedStatus(true); //trigger npc hit function FuncMethods.HandleFuncExec(HandleTarget.GetHandleTarget(this), m_NpcBaseInfo.ClickFuncId, null); } else { //IsPlayerControlled = false; m_CharTransformData.SetSelectedStatus(false); } }
private void OnActionFinish(MessageObject msg) { GestureManager.Instance.EnableMoveChar(); }
public MessageObjectAll getMessages(int userId, int otherId, Int64 messageId) { MessageObjectAll allObjects = new MessageObjectAll(); if (messageId == 0) { messageId = 999999999; } DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlDataAdapter sda1 = new SqlDataAdapter("sp_messages", sqlConn); sda1.SelectCommand.CommandType = CommandType.StoredProcedure; sda1.SelectCommand.Parameters.Add("@OwnerId", SqlDbType.Int).Value = userId; sda1.SelectCommand.Parameters.Add("@OtherId", SqlDbType.Int).Value = otherId; sda1.SelectCommand.Parameters.Add("@MessageId", SqlDbType.Int).Value = messageId; //try //{ sda1.Fill(ds); dt = ds.Tables[0]; //} //catch (Exception ex) //{ //} //finally //{ sqlConn.Close(); sda1.Dispose(); sqlConn.Dispose(); //} if (dt.Rows.Count == 0) { return(allObjects); } else { MessageObject object1 = new MessageObject(); MessageObject object2 = new MessageObject(); MessageObject object3 = new MessageObject(); MessageObject object4 = new MessageObject(); MessageObject object5 = new MessageObject(); MessageObject object6 = new MessageObject(); MessageObject object7 = new MessageObject(); MessageObject object8 = new MessageObject(); MessageObject object9 = new MessageObject(); MessageObject object10 = new MessageObject(); // profile pic url int userIdString = 0; Classes.Date d = new Classes.Date(); for (int i = 0; i < dt.Rows.Count; i++) { if (Convert.ToBoolean(dt.Rows[i]["Sender"].ToString())) { userIdString = Convert.ToInt32(dt.Rows[i]["OwnerId"].ToString()); } else { userIdString = Convert.ToInt32(dt.Rows[i]["OtherId"].ToString()); } MessageObject myMessageObject = new MessageObject( Convert.ToInt32(dt.Rows[i]["MessageId"].ToString()), Convert.ToBoolean(dt.Rows[i]["Sender"].ToString()), dt.Rows[i]["Message"].ToString(), d.FormatPassedDate(dt.Rows[i]["SubmitDate"].ToString()), Convert.ToBoolean(dt.Rows[i]["Unread"].ToString()), userIdString); switch (i) { case 0: { object10 = myMessageObject; break; } case 1: { object9 = myMessageObject; break; } case 2: { object8 = myMessageObject; break; } case 3: { object7 = myMessageObject; break; } case 4: { object6 = myMessageObject; break; } case 5: { object5 = myMessageObject; break; } case 6: { object4 = myMessageObject; break; } case 7: { object3 = myMessageObject; break; } case 8: { object2 = myMessageObject; break; } case 9: { object1 = myMessageObject; break; } } allObjects = new MessageObjectAll( object1, object2, object3, object4, object5, object6, object7, object8, object9, object10); } return(allObjects); } }
private void OnHitTerrain(MessageObject msg) { //Vector3 pos = (Vector3)(msg.msgValue); //Debuger.Log("Move to target pos"); //m_PlayerChar.MoveTo(pos); }
private static void PrintIncomingMessage(PacketHeader header, Connection connection, MessageObject message) { //Console.WriteLine(message.message); if (Equals(message.action, "Card") == true) { //Console.WriteLine(message.message); hand.Add(message.message); } else if (Equals(message.action, "You") == true) { Console.WriteLine(message.message); play = true; } else if (Equals(message.action, "End") == true) { Console.WriteLine(message.message); end = true; } else if (Equals(message.action, "Message") == true) { Console.WriteLine(message.message); } }
private void OnActionStart(MessageObject msg) { GestureManager.Instance.DisableMoveChar(); }
public void ServerActions(MessageObject message, Socket client) { switch (message.FormIdentifier) { //From Loading Screen case 0: { switch (message.ObjectIdentifier) { //Farmer case 1: { switch (message.ActionIdentifier) { //Select case 1: { Farmer farmer = new Farmer(); Farmer[] AllFarmers = farmer.FarmerSelection(); message.Data = AllFarmers.BinarySerialization(); SendData(message, client); break; } default: break; } break; } default: break; } break; } //From Farmer Selection case 1: { switch (message.ObjectIdentifier) { //Farmer case 1: { switch (message.ActionIdentifier) { //Select case 1: { Farmer farmer = new Farmer(); Farmer[] AllFarmers = farmer.FarmerSelection(); message.Data = AllFarmers.BinarySerialization(); SendData(message, client); break; } case 5: { Farmer farmer = new Farmer(); Farmer[] AllFarmers = farmer.FarmerSelection(); message.Data = AllFarmers.BinarySerialization(); SendData(message, client); break; } //Delete case 3: { Farmer farmer = (Farmer)message.Data.BinaryDeserialization(); farmer.DeleteFarmer(); break; } default: break; } break; } default: break; } break; } //From Farmer Creation case 2: { switch (message.ObjectIdentifier) { //Farmer case 1: { switch (message.ActionIdentifier) { //Insert case 2: { Farmer farmer = (Farmer)message.Data.BinaryDeserialization(); farmer.InsertFarmer(); break; } default: break; } break; } default: break; } break; } //From Farm Creation case 3: { switch (message.ObjectIdentifier) { //Farm case 2: { switch (message.ActionIdentifier) { //Insert case 2: { Farm farm = (Farm)message.Data.BinaryDeserialization(); farm.insertFarm(); break; } default: break; } break; } default: break; } break; } //From Animal Selection case 4: { switch (message.ObjectIdentifier) { //Animal case 3: { switch (message.ActionIdentifier) { //Insert case 2: { lock (semePhore) { Animal animal = new Animal(); AddingAnimal animalstoadd = (AddingAnimal)message.Data.BinaryDeserialization(); // List<AnimalsSelected> animalsSelected = (List<AnimalsSelected>)message.Data.BinaryDeserialization(); animal.AddAnimal(animalstoadd.AnimalstoAdd, animalstoadd.FarmerId); } break; } default: break; } break; } //Species case 4: { switch (message.ActionIdentifier) { //Select case 1: { AnimalsSelected animalsSelected = new AnimalsSelected(); List <Species> species = animalsSelected.getAnimalName(); message.Data = species.BinarySerialization(); SendData(message, client); break; } default: break; } break; } default: break; } break; } //From Add Species case 5: { switch (message.ObjectIdentifier) { //Species case 4: { switch (message.ActionIdentifier) { //Insert case 2: { Species species = (Species)message.Data.BinaryDeserialization(); species.writeSpecies(); break; } default: break; } break; } default: break; } break; } //From Farm View case 6: { switch (message.ObjectIdentifier) { //Farmer case 1: { switch (message.ActionIdentifier) { //Update case 4: { //Update farmer details Farmer farmer = (Farmer)message.Data.BinaryDeserialization(); farmer.UpdateFarmer(); break; } default: break; } break; } //Farm, Animal and Location case 2: { switch (message.ActionIdentifier) { //Select case 1: { ArrayList farmViewData = new ArrayList(); int id = (int)message.Data.BinaryDeserialization(); Farm farm = new Farm(); List <Farm> farms = farm.selectFarm(id); farmViewData.Add(farms); Animal animal = new Animal(); List <Animal> animals = animal.selectAnimals(id); farmViewData.Add(animals); Location location = new Location(); List <Location> locations = location.selectLocation(id); farmViewData.Add(locations); message.Data = farmViewData.BinarySerialization(); SendData(message, client); break; } //Update case 4: { //Update farm details Farm farm = (Farm)message.Data.BinaryDeserialization(); farm.UpdateFarm(); break; } default: break; } break; } //Animal case 3: { switch (message.ActionIdentifier) { //Select case 1: { break; } //Insert case 2: { Animal animal = (Animal)message.Data.BinaryDeserialization(); Console.WriteLine("INSERT IS STILL COMMENTED OU!!!!!!!!!!!!"); animal.InsertAnimal(); break; } //Delete case 3: { Animal animal = (Animal)message.Data.BinaryDeserialization(); Console.WriteLine("DELETE IS STILL COMMENTED OU!!!!!!!!!!!!"); animal.DeleteAnimal(); break; } default: break; } break; } //Location case 5: { switch (message.ActionIdentifier) { //Select case 1: { break; } default: break; } break; } default: break; } break; } default: break; } }
async Task floop() { while (_ws.State == WebSocketState.Open) { byte[] arrbytebuf = new byte[4096]; ArraySegment <byte> arrseg = new ArraySegment <byte>(arrbytebuf); var incoming = await _ws.ReceiveAsync(arrseg, CancellationToken.None); try { MessageObject objSend = new MessageObject(); switch (incoming.MessageType) { case WebSocketMessageType.Text: var sdata = System.Text.Encoding.UTF8.GetString(arrseg.Array, arrseg.Offset, arrseg.Count); var obj = JsonConvert.DeserializeObject <csockdata>(sdata); foreach (var s in wss) { if ((s.Value.UserInfor != null) && (s.Value.UserInfor.Username != null) && (s.Value.UserInfor.Username == "loguser")) { objSend.UserName = "******"; objSend.FullName = objSend.UserName; objSend.Message = JsonConvert.SerializeObject(obj); await fsend(s.Key, MessageType.Message, objSend); objSend = new MessageObject(); } } switch (obj.MessageType.ToLower()) { case MessageType.Login: var objLogin = JsonConvert.DeserializeObject <LoginObject>(obj.Value); UserInfor = new Authentication(objLogin.Username, objLogin.Password, objLogin.FullName, objLogin.token); if (!UserInfor.IsAuthenticated) { foreach (var s in wss) { if ((s.Value.UserInfor != null) && (s.Value.UserInfor.Username != null) && (s.Value.UserInfor.Username == "loguser")) { objSend.UserName = "******"; objSend.FullName = objSend.UserName; objSend.Message = "Login fail: " + JsonConvert.SerializeObject(objLogin); await fsend(s.Key, MessageType.Message, objSend); objSend = new MessageObject(); } } await fsendLoginFail(id); WebSocketConnectionManagerMiddleware cNewLogin; if (wss.TryRemove(id, out cNewLogin)) { await cNewLogin.fclr(); } } else { objSend.UserName = "******"; objSend.FullName = "Server"; objSend.Message = "Login OK"; await fsend(id, MessageType.Message, objSend); } break; case MessageType.FileAction: FileMessage objAction = null; try { objAction = JsonConvert.DeserializeObject <FileMessage>(obj.Value); } catch { } if (objAction != null) { FileMessage fileMessageResult = new FileMessage(); string userCheckouted = UserInfor.FilePermission(objAction.FilePath); fileMessageResult.FileName = objAction.FilePath; fileMessageResult.FilePath = objAction.FilePath; fileMessageResult.UserName = UserInfor.Username; //TODO: chamge fullname fileMessageResult.FullName = UserInfor.FullName; fileMessageResult.Action = FileAction.All; fileMessageResult.LockedByUserName = userCheckouted; //TODO: chamge fullname fileMessageResult.LockedByFullName = userCheckouted; fileMessageResult.FileMD5 = objAction.FileMD5; switch (objAction.Action) { case FileAction.CheckEditable: await fsend(id, MessageType.FileAction, fileMessageResult); break; default: foreach (var s in wss) { await fsend(s.Key, MessageType.FileAction, fileMessageResult); } break; } } break; case MessageType.Message: objSend.UserName = UserInfor.Username; objSend.FullName = UserInfor.FullName; objSend.Message = obj.Value; foreach (var s in wss) { if (s.Value.id != id) { await fsend(s.Key, MessageType.Message, objSend); } } break; case MessageType.APICommand: var objAPICommands = JsonConvert.DeserializeObject <APIMessageObject>(obj.Value); objSend.UserName = UserInfor.Username; objSend.FullName = UserInfor.FullName; objSend.Message = objAPICommands.Message; if ((objAPICommands.ToList == null) || (objAPICommands.ToList.Count == 0)) { foreach (var s in wss) { await fsend(s.Key, MessageType.Message, objSend); } } else { foreach (var s in wss) { if (objAPICommands.ToList.Contains(s.Value.UserInfor.Username)) { await fsend(s.Key, MessageType.Message, objSend); } } } break; case MessageType.GetConcurrentUsers: var userList = new List <LoginObject>(); foreach (var s in wss) { //if (userList.Find(x => x.Username == s.Value.UserInfor.Username) ) var temp = new LoginObject(); temp.Username = s.Value.UserInfor.Username; temp.FullName = s.Value.UserInfor.FullName; temp.token = s.Value.UserInfor.Token; userList.Add(temp); } await fsend(id, MessageType.GetConcurrentUsers, userList); break; case MessageType.GetAllFileInformation: default: break; } break; case WebSocketMessageType.Close: WebSocketConnectionManagerMiddleware ctemp; if (wss.TryRemove(id, out ctemp)) { await ctemp.fclr(); } break; default: break; } } catch (Exception ex) { throw new Exception("Web Socket: Error"); } } }
protected void OnActionStart(MessageObject msg) { GestureManager.Instance.DisableMoveChar(); }
private void OnTriggerChangeState(MessageObject obj) { if (!(obj.msgValue is ELifeState)) { return; } ELifeState newState = (ELifeState)(obj.msgValue); TryEnterState(newState, false); }
private bool updatePlayerSkillProgress(Actor player, string skillName) { bool updated = false; bool justFinished = false; if (player.Name == "Player 1") { SkillNode node = FindActiveNodeByNameAndPlayer(skillName, player.Name); if (node != null) { if (node.Completed(player.Name)) { updated = false; _game.StatusTextP1.Color = Color.Green; _game.StatusTextP1.DisplayString = skillName + " already completed"; } else { node.P1_Points += 1; if (node.Completed(player.Name)) { justFinished = true; } updated = true; _game.StatusTextP1.Color = Color.Blue; _game.StatusTextP1.DisplayString = skillName + " updating"; } } else { _game.StatusTextP1.Color = Color.White; _game.StatusTextP1.DisplayString = skillName + ": prereqs not met"; } } else if (player.Name == "Player 2") { SkillNode node = FindActiveNodeByNameAndPlayer(skillName, player.Name); if (node != null) { if (node.Completed(player.Name)) { updated = false; _game.StatusTextP2.Color = Color.Green; _game.StatusTextP2.DisplayString = skillName + " already completed"; } else { node.P2_Points += 1; if (node.Completed(player.Name)) { justFinished = true; } updated = true; _game.StatusTextP2.Color = Color.Blue; _game.StatusTextP2.DisplayString = skillName + " updating"; } } else { _game.StatusTextP2.Color = Color.Black; _game.StatusTextP2.DisplayString = skillName + ": prereqs not met"; } } MessageObject messageObject = new MessageObject(); messageObject.play = player; messageObject.boolie = updated; messageObject.justFinished = justFinished; Switchboard.Instance.Broadcast(new Message("SkillUpdate", messageObject)); return updated; }
public void StartDocumentSharingReciever(MessageObject m) { try { if( NetworkManager.getInstance().profile.clientType==ClientType.ClientPresenter || NetworkManager.getInstance().profile.clientType==ClientType.ClientHost) { m_bIsAllowedToAddAnnotations=true; chkThumbNail.Checked = true; this.btnNext.Visible=true; this.btnPrev.Visible=true; this.chkThumbNail.Visible=true; this.btnFirst.Visible=true; this.btnLast.Visible=true; this.chkShowThumbNails.Visible=true; } else if( NetworkManager.getInstance().profile.clientType==ClientType.ClientAttendee) { m_bIsAllowedToAddAnnotations=true; chkThumbNail.Checked = false; annotationBrowser.IsAttendee = true; chkSynch.Visible = false; IsAttendee = true; AttendeeFormDocument(); } WebMeeting.Common.DocumentSharing DocSharing = (WebMeeting.Common.DocumentSharing)m; m_DocumentMessage = DocSharing; this.sessionID = DocSharing.sessionID; switch(DocSharing.DocumentType) { case DocumentMessageType.typeDocument: SetDocumentAndPDFInterface(); break; case DocumentMessageType.typePDF: SetDocumentAndPDFInterface(); break; case DocumentMessageType.typeExcel: SetPresentationAndExcelInterface(); SetDocumentAndPDFInterface(); { SetPresentationAndExcelInterface(); panelAnnotations.Visible = false; nsButton1.Visible = false; buttonDown.Visible = false; } break; case DocumentMessageType.typePresentation: SetPresentationAndExcelInterface(); SetDocumentAndPDFInterface(); break; }; IntializationCompleted = true; SetControls(false); MessagePool.Add(m); m_bTerminated = false; RecieveThread = new Thread(new ThreadStart(RecieveThreadFunction)); RecieveThread.Name = "StartDocumentSharingReciever Thread: RecieveThreadFunction()"; RecieveThread.Start(); } catch (WebException exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("documentSharingControl.cs ==> StartDocumentSharingInitiaterManageContent( line==> 1961",exp,null,false); // MeetingAlerts alert=new MeetingAlerts(); // alert.ShowMessage(Alerts.MeetingAlerts.AlertType.NonFatal,this.Name + " Class : StartDocumentSharingReciever() function ," + ex.Source + " Source ," + ex.Message ,true,false); } }
private async Task SendMessageAsync(ActivityEnvelope activityEnvelope) { var listOfUsers = new List<string>(); if (_selectedAssignees != null && _selectedAssignees.Any()) listOfUsers.AddRange(_selectedAssignees.Select(user => string.Format(@"[[user:{0}]]", user.Id.ToString()))); var messageObject = new MessageObject() { Body = Body, Title = Title, Type = activityEnvelope.Activity.OgObject.Type, Description = activityEnvelope.Activity.OgObject.Title, ImageUri = activityEnvelope.Activity.OgObject.ImageUri, Url = activityEnvelope.Activity.OgObject.Url, Users = string.Join(",", listOfUsers.ToArray()) }; await _messageRepository.PostMessageAsync(messageObject); }
public static void onDisconnect(MessageObject result) { Console.WriteLine("on sockect disconnected!"); }
/// <summary> /// Container Class for all the properties for organization. /// </summary> /// <param name="c"></param> public TorqueScriptTemplate(ref dnTorque c) { m_ts = c; _mConsoleobject = new ConsoleObject(ref c); _mMathobject = new tMath(ref c); _mUtil = new UtilObject(ref c); _mHTTPObject = new HTTPObjectObject(ref c); _mTCPObject = new TCPObjectObject(ref c); _mDynamicConsoleMethodComponent = new DynamicConsoleMethodComponentObject(ref c); _mSimComponent = new SimComponentObject(ref c); _mArrayObject = new ArrayObjectObject(ref c); _mConsoleLogger = new ConsoleLoggerObject(ref c); _mFieldBrushObject = new FieldBrushObjectObject(ref c); _mPersistenceManager = new PersistenceManagerObject(ref c); _mSimDataBlock = new SimDataBlockObject(ref c); _mSimObject = new SimObjectObject(ref c); _mSimPersistSet = new SimPersistSetObject(ref c); _mSimSet = new SimSetObject(ref c); _mSimXMLDocument = new SimXMLDocumentObject(ref c); _mFileObject = new FileObjectObject(ref c); _mFileStreamObject = new FileStreamObjectObject(ref c); _mStreamObject = new StreamObjectObject(ref c); _mZipObject = new ZipObjectObject(ref c); _mDecalRoad = new DecalRoadObject(ref c); _mMeshRoad = new MeshRoadObject(ref c); _mRiver = new RiverObject(ref c); _mScatterSky = new ScatterSkyObject(ref c); _mSkyBox = new SkyBoxObject(ref c); _mSun = new SunObject(ref c); _mGuiRoadEditorCtrl = new GuiRoadEditorCtrlObject(ref c); _mForest = new ForestObject(ref c); _mForestWindEmitter = new ForestWindEmitterObject(ref c); _mForestBrush = new ForestBrushObject(ref c); _mForestBrushTool = new ForestBrushToolObject(ref c); _mForestEditorCtrl = new ForestEditorCtrlObject(ref c); _mForestSelectionTool = new ForestSelectionToolObject(ref c); _mCubemapData = new CubemapDataObject(ref c); _mDebugDrawer = new DebugDrawerObject(ref c); _mGuiTSCtrl = new GuiTSCtrlObject(ref c); _mGuiBitmapButtonCtrl = new GuiBitmapButtonCtrlObject(ref c); _mGuiButtonBaseCtrl = new GuiButtonBaseCtrlObject(ref c); _mGuiCheckBoxCtrl = new GuiCheckBoxCtrlObject(ref c); _mGuiIconButtonCtrl = new GuiIconButtonCtrlObject(ref c); _mGuiSwatchButtonCtrl = new GuiSwatchButtonCtrlObject(ref c); _mGuiToolboxButtonCtrl = new GuiToolboxButtonCtrlObject(ref c); _mGuiAutoScrollCtrl = new GuiAutoScrollCtrlObject(ref c); _mGuiDynamicCtrlArrayControl = new GuiDynamicCtrlArrayControlObject(ref c); _mGuiFormCtrl = new GuiFormCtrlObject(ref c); _mGuiFrameSetCtrl = new GuiFrameSetCtrlObject(ref c); _mGuiPaneControl = new GuiPaneControlObject(ref c); _mGuiRolloutCtrl = new GuiRolloutCtrlObject(ref c); _mGuiScrollCtrl = new GuiScrollCtrlObject(ref c); _mGuiStackControl = new GuiStackControlObject(ref c); _mGuiTabBookCtrl = new GuiTabBookCtrlObject(ref c); _mGuiBitmapCtrl = new GuiBitmapCtrlObject(ref c); _mGuiColorPickerCtrl = new GuiColorPickerCtrlObject(ref c); _mGuiDirectoryFileListCtrl = new GuiDirectoryFileListCtrlObject(ref c); _mGuiFileTreeCtrl = new GuiFileTreeCtrlObject(ref c); _mGuiGameListMenuCtrl = new GuiGameListMenuCtrlObject(ref c); _mGuiGameListOptionsCtrl = new GuiGameListOptionsCtrlObject(ref c); _mGuiGradientCtrl = new GuiGradientCtrlObject(ref c); _mGuiListBoxCtrl = new GuiListBoxCtrlObject(ref c); _mGuiMaterialCtrl = new GuiMaterialCtrlObject(ref c); _mGuiMLTextCtrl = new GuiMLTextCtrlObject(ref c); _mGuiPopUpMenuCtrl = new GuiPopUpMenuCtrlObject(ref c); _mGuiPopUpMenuCtrlEx = new GuiPopUpMenuCtrlExObject(ref c); _mGuiSliderCtrl = new GuiSliderCtrlObject(ref c); _mGuiTabPageCtrl = new GuiTabPageCtrlObject(ref c); _mGuiTextCtrl = new GuiTextCtrlObject(ref c); _mGuiTextEditCtrl = new GuiTextEditCtrlObject(ref c); _mGuiTextListCtrl = new GuiTextListCtrlObject(ref c); _mGuiTreeViewCtrl = new GuiTreeViewCtrlObject(ref c); _mGuiCanvas = new GuiCanvasObject(ref c); _mGuiControl = new GuiControlObject(ref c); _mGuiControlProfile = new GuiControlProfileObject(ref c); _mDbgFileView = new DbgFileViewObject(ref c); _mGuiEditCtrl = new GuiEditCtrlObject(ref c); _mGuiFilterCtrl = new GuiFilterCtrlObject(ref c); _mGuiGraphCtrl = new GuiGraphCtrlObject(ref c); _mGuiImageList = new GuiImageListObject(ref c); _mGuiInspector = new GuiInspectorObject(ref c); _mGuiInspectorTypeFileName = new GuiInspectorTypeFileNameObject(ref c); _mGuiInspectorTypeBitMask32 = new GuiInspectorTypeBitMask32Object(ref c); _mGuiMenuBar = new GuiMenuBarObject(ref c); _mGuiParticleGraphCtrl = new GuiParticleGraphCtrlObject(ref c); _mGuiShapeEdPreview = new GuiShapeEdPreviewObject(ref c); _mGuiInspectorDynamicField = new GuiInspectorDynamicFieldObject(ref c); _mGuiInspectorDynamicGroup = new GuiInspectorDynamicGroupObject(ref c); _mGuiInspectorField = new GuiInspectorFieldObject(ref c); _mGuiVariableInspector = new GuiVariableInspectorObject(ref c); _mGuiMessageVectorCtrl = new GuiMessageVectorCtrlObject(ref c); _mGuiProgressBitmapCtrl = new GuiProgressBitmapCtrlObject(ref c); _mGuiTickCtrl = new GuiTickCtrlObject(ref c); _mGuiTheoraCtrl = new GuiTheoraCtrlObject(ref c); _mMessageVector = new MessageVectorObject(ref c); _mEditTSCtrl = new EditTSCtrlObject(ref c); _mGuiMissionAreaCtrl = new GuiMissionAreaCtrlObject(ref c); _mMECreateUndoAction = new MECreateUndoActionObject(ref c); _mMEDeleteUndoAction = new MEDeleteUndoActionObject(ref c); _mWorldEditor = new WorldEditorObject(ref c); _mLangTable = new LangTableObject(ref c); _mPathedInterior = new PathedInteriorObject(ref c); _mMaterial = new MaterialObject(ref c); _mSimResponseCurve = new SimResponseCurveObject(ref c); _mMenuBar = new MenuBarObject(ref c); _mPopupMenu = new PopupMenuObject(ref c); _mFileDialog = new FileDialogObject(ref c); _mPostEffect = new PostEffectObject(ref c); _mRenderBinManager = new RenderBinManagerObject(ref c); _mRenderPassManager = new RenderPassManagerObject(ref c); _mRenderPassStateToken = new RenderPassStateTokenObject(ref c); _mSceneObject = new SceneObjectObject(ref c); _mSFXController = new SFXControllerObject(ref c); _mSFXParameter = new SFXParameterObject(ref c); _mSFXProfile = new SFXProfileObject(ref c); _mSFXSource = new SFXSourceObject(ref c); _mActionMap = new ActionMapObject(ref c); _mNetConnection = new NetConnectionObject(ref c); _mNetObject = new NetObjectObject(ref c); _mAIClient = new AIClientObject(ref c); _mAIConnection = new AIConnectionObject(ref c); _mAIPlayer = new AIPlayerObject(ref c); _mCamera = new CameraObject(ref c); _mDebris = new DebrisObject(ref c); _mGroundPlane = new GroundPlaneObject(ref c); _mGuiMaterialPreview = new GuiMaterialPreviewObject(ref c); _mGuiObjectView = new GuiObjectViewObject(ref c); _mItem = new ItemObject(ref c); _mLightBase = new LightBaseObject(ref c); _mLightDescription = new LightDescriptionObject(ref c); _mLightFlareData = new LightFlareDataObject(ref c); _mMissionArea = new MissionAreaObject(ref c); _mSpawnSphere = new SpawnSphereObject(ref c); _mPathCamera = new PathCameraObject(ref c); _mPhysicalZone = new PhysicalZoneObject(ref c); _mPlayer = new PlayerObject(ref c); _mPortal = new PortalObject(ref c); _mProjectile = new ProjectileObject(ref c); _mProximityMine = new ProximityMineObject(ref c); _mShapeBaseData = new ShapeBaseDataObject(ref c); _mShapeBase = new ShapeBaseObject(ref c); _mStaticShape = new StaticShapeObject(ref c); _mTrigger = new TriggerObject(ref c); _mTSStatic = new TSStaticObject(ref c); _mZone = new ZoneObject(ref c); _mRenderMeshExample = new RenderMeshExampleObject(ref c); _mLightning = new LightningObject(ref c); _mParticleData = new ParticleDataObject(ref c); _mParticleEmitterData = new ParticleEmitterDataObject(ref c); _mParticleEmitterNode = new ParticleEmitterNodeObject(ref c); _mPrecipitation = new PrecipitationObject(ref c); _mGameBase = new GameBaseObject(ref c); _mGameConnection = new GameConnectionObject(ref c); _mPhysicsDebrisData = new PhysicsDebrisDataObject(ref c); _mPhysicsForce = new PhysicsForceObject(ref c); _mPhysicsShape = new PhysicsShapeObject(ref c); _mAITurretShape = new AITurretShapeObject(ref c); _mTurretShape = new TurretShapeObject(ref c); _mFlyingVehicle = new FlyingVehicleObject(ref c); _mWheeledVehicle = new WheeledVehicleObject(ref c); _mTerrainBlock = new TerrainBlockObject(ref c); _mSettings = new SettingsObject(ref c); _mCompoundUndoAction = new CompoundUndoActionObject(ref c); _mUndoManager = new UndoManagerObject(ref c); _mUndoAction = new UndoActionObject(ref c); _mEventManager = new EventManagerObject(ref c); _mMessage = new MessageObject(ref c); }
private bool SendMail(UserViewModel model) { try { if (model == null || string.IsNullOrEmpty(model.SecurityStamp)) { return(false); } const int type = (int)MessageEventEnum.New_User; const string label = "Activate your Account!"; var msgBody = ""; var msg = new MessageTemplateServices().GetMessageTempWithExpiry(type); if (msg.Id < 1) { return(false); } var emMs = new MessageObject { UserId = model.Id, MessageTemplateId = msg.Id, Status = (int)MessageStatus.Pending, DateSent = DateTime.Now, MessageBody = msg.MessageContent }; var sta = new MessageServices().AddMessage(emMs); if (sta < 1) { return(false); } if (Request.Url != null) { msg.MessageContent = msg.MessageContent.Replace("\n", "<br/>"); msg.Subject = msg.Subject.Replace("\n", "<br/>"); msgBody = "DPR/DS/IEP/" + DateTime.Today.ToString("ddMMyyyy") + "/" + sta + "<br/><br/>"; if (msg.MessageContent.Contains("{hours}") && msg.MessageLifeSpan > 0) { msg.MessageContent = msg.MessageContent.Replace("{hours}", msg.MessageLifeSpan.ToString()); } msg.Subject = msg.Subject.Replace("{firstname lastname}", model.FirstName + " " + model.LastName); msg.MessageContent = msg.MessageContent.Replace("{user}", model.LastName).Replace("{password}", model.Password); msgBody += "<br/><br/>" + msg.MessageContent.Replace("{email verification link}", "<br/><a style=\"color:green; cursor:pointer\" title=\"Activate Account\" href=" + Url.Action("ConfirmEmail", "Account", new { email = model.Email, code = model.SecurityStamp, ixf = sta }, Request.Url.Scheme) + ">" + label + "</a>").Replace("\n", "<br/>"); msgBody += "<br/><br/>" + msg.Footer.Replace("\n", "<br/>"); } if (Request.Url != null) { #region Using SendGrid var config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Request.ApplicationPath); var settings = (MailSettingsSectionGroup)config.GetSectionGroup("system.net/mailSettings"); if (settings == null) { return(false); } var mail = new MailMessage(new MailAddress(settings.Smtp.From), new MailAddress(model.Email)) { Subject = msg.Subject, Body = msgBody, IsBodyHtml = true }; var smtp = new SmtpClient(settings.Smtp.Network.Host) { Credentials = new NetworkCredential(settings.Smtp.Network.UserName, settings.Smtp.Network.Password), EnableSsl = true, Port = settings.Smtp.Network.Port }; smtp.Send(mail); emMs.Id = sta; emMs.MessageBody = msgBody; emMs.Status = (int)MessageStatus.Sent; var tts = new MessageServices().UpdateMessage(emMs); if (tts < 1) { return(false); } return(true); #endregion } return(false); } catch (Exception e) { ErrorLogger.LoggError(e.StackTrace, e.Source, e.Message); return(false); } }
/// <summary> /// Processes a message in the queue /// </summary> /// <param name="obj"></param> private void ProcessMessage(MessageObject obj) { try { if(obj != null) { WebMeeting.Common.DocumentSharing DocSharing = (WebMeeting.Common.DocumentSharing)obj; DocumentSharingEx DocEx = new WebMeeting.Client.DocumentSharingEx(DocSharing.DocumentType,DocSharing.sessionID); DocEx.OnStatusUpdateFunction = new WebMeeting.Client.DocumentSharingEx.OnStatusUpdate(OnStatusUpdate); string localFilePath = this.DocumentFilePath; SetControls(false); ///////////// ===============================================================////////// /// By Zaeem uncomented ///////////// ===============================================================////////// /* // used for downloading documents. if(!m_DocumentDownloaded) // these checks are for ppt and xls sharing cause there can be Next and Previous movement messages { // keep track if the presentation has already been downloaded don't download it again. just move the the current page of presentation if(!DocEx.RecieveDocumentSharing(obj,out localFilePath)) //Failed { this.MessagePool.Remove(obj); // alert.ShowMessage(4,"Unable to download document to webserver","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Error); //Process failure return; } else this.m_DocumentDownloaded = true; this.DocumentFilePath = localFilePath; annotationBrowser.sheetsEventStores = new ArrayList(); annotationBrowser.sheetsEventStores.Add(annotationBrowser.eventStore); // only for checking purpose try { for(int i = 1 ;i < DocSharing.TotalPages ; i++) //Create Transparent Annotation windows over the //browser control for drawing on each presentation page. { annotationBrowser.eventStore = new ArrayList(); annotationBrowser.sheetsEventStores.Add(annotationBrowser.eventStore ); } } catch(Exception ee) { annotationBrowser.eventStore = new ArrayList(); annotationBrowser.sheetsEventStores.Add(annotationBrowser.eventStore ); ee = ee; } this.documentTitle = Path.GetFileNameWithoutExtension(DocumentFilePath); AddSaveMenus(); } */ ///////////// ===============================================================////////// /// End Block ///////////// ===============================================================////////// ///////////// this.DocumentFilePath = localFilePath; this.pictureCount = DocSharing.TotalPages; //synchornizePPTAnnotations(); m_DocumentMessage = DocSharing; switch(m_DocumentMessage.DocumentType) { case DocumentMessageType.typeDocument: {//Load the Word Document object oUrl = m_DocumentMessage.DownloadURL; object o = new object(); if(!m_bVisited) { this.axWebBrowser1.Navigate2(ref oUrl,ref o,ref o,ref o,ref o); lblStatus.Text ="Document " + Path.GetFileName(this.DocumentFilePath); m_bVisited = true; } } break; case DocumentMessageType.typePresentation: { // this.DocumentFilePath = localFilePath; // localFilePath = Directory.GetParent(localFilePath).FullName; //object oUrl = localFilePath + "\\slide" + object oUrl = m_DocumentMessage.DownloadURL+DocSharing.CurrentPage.ToString() + ".jpg"; object o = new object(); if(currentImage != m_DocumentMessage.CurrentPage) { if(File.Exists(strLocalPath+"\\"+DocSharing.CurrentPage.ToString() + ".jpg")) { oUrl=strLocalPath+"\\"+DocSharing.CurrentPage.ToString() + ".jpg"; this.axWebBrowser1.Navigate2(ref oUrl,ref o,ref o,ref o,ref o); } else this.axWebBrowser1.Navigate2(ref oUrl,ref o,ref o,ref o,ref o); } currentImage = m_DocumentMessage.CurrentPage; pictureCount = m_DocumentMessage.TotalPages; ///////////////////////////////////////// annotationBrowser.currentSlideNo=currentImage ; ///////////////////////////////////////// lblStatus.Text = "Slide " + currentImage.ToString() + " of " + pictureCount.ToString(); }break; case DocumentMessageType.typePDF: { //object oUrl = Path.GetDirectoryName(localFilePath) + "\\"+ Path.GetFileNameWithoutExtension(localFilePath) + "\\index.htm"; object oUrl=this.m_DocumentMessage.DownloadURL; object o = new object(); if(!m_bVisited) { this.axWebBrowser1.Navigate2(ref oUrl,ref o,ref o,ref o,ref o); m_bVisited = true; } } break; case DocumentMessageType.typeExcel: { object oUrl = m_DocumentMessage.DownloadURL; object o = new object(); if((this.pictureCount == 1) || (m_DocumentMessage.TotalPages == 1)) { lblStatus.Text = "Book 1 of 1"; this.axWebBrowser1.Navigate2(ref oUrl,ref o,ref o,ref o,ref o); } else { string basePath = m_DocumentMessage.DownloadURL; //string basePath = Path.GetDirectoryName(localFilePath); //basePath += "\\" + Path.GetFileNameWithoutExtension(localFilePath) + "_files\\sheet"; //currentImage+=1; if(this.m_DocumentMessage.CurrentPage > 10) basePath += this.m_DocumentMessage.CurrentPage.ToString() + ".htm"; else basePath += "00" + this.m_DocumentMessage.CurrentPage.ToString() + ".htm"; //MessageBox.Show(basePath); oUrl = basePath; if(!m_bVisited) { this.axWebBrowser1.Navigate2(ref oUrl,ref o,ref o,ref o,ref o); lblStatus.Text = "Book " + currentImage.ToString() + " of " + pictureCount.ToString(); if(this.m_DocumentMessage.TotalPages==1) m_bVisited =true; } } } break; } SetControls(true); lblStatus.Visible = false; if(m_bOwnerofthisControl) { btnOptions.Visible = true; btnOptions.Enabled = true; btnOptions.Top = btnLast.Top+4; //chkSynch.Visible = true; } else { btnOptions.Visible = false; } chkThumbNail.Enabled = m_bIsAllowedToAddAnnotations; if(this.documentType == DocumentMessageType.typePresentation && chkThumbnail==false) { try { if(ClientUI.getInstance().IsShowThumbnails())/*check either we need to display thumnails or not*/ { createThumbnailThread = new Thread(new ThreadStart(CreateThumbnails)); createThumbnailThread.Name = "createThumbnailThread() : documentSharingControl"; createThumbnailThread.Start(); } } catch(Exception ex) { ex = ex; } //CreateThumbnails(); chkThumbnail=true; this.panelAnnotations.Height=65; } } } catch (WebException exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("documentSharingControl.cs ==>ProcessMessage( line==> 2265",exp,null,false); //MeetingAlerts alert=new MeetingAlerts(); //alert.ShowMessage(Alerts.MeetingAlerts.AlertType.NonFatal,this.Name + " Class : ProcessMessage() function ," + ex.Source + " Source ," + ex.Message ,true,false); } }
public void HandleMessage(MessageObject msgobj) { HandledString = Encoding.ASCII.GetString(msgobj.CompleteData); }
private void OnMissionCounterChange(MessageObject obj) { RefreshStatus(); }
private void OnActionFinished(MessageObject msgObj) { if (!(msgObj.msgValue is ActionParam)) { return; } ActionParam ap = msgObj.msgValue as ActionParam; if (!(ap.Object is FuncContext)) { return; } m_PlayingSkill.Remove(ap.Id); m_LockedTargetList.Remove(ap.Id); }
public bool RecieveDocumentSharing(MessageObject msg,out string localFile) { localFile = ""; try { string documentFolderName = ""; if(this.m_DocumentType == DocumentMessageType.typeDocument) documentFolderName = "Documents"; else if(this.m_DocumentType == DocumentMessageType.typeExcel) documentFolderName = "WorkBooks"; else if(this.m_DocumentType == DocumentMessageType.typePDF) documentFolderName = "PDF"; else if(this.m_DocumentType == DocumentMessageType.typePresentation) documentFolderName = "Presentations"; WebMeeting.Common.DocumentSharing docMessage = (DocumentSharing)msg; localFile = Application.StartupPath + "\\DocumentSharing\\Downloaded\\" + documentFolderName + "\\" + docMessage.sessionID; CreateLocalDirectoryStructure(false); if(!Directory.Exists(localFile)) Directory.CreateDirectory(localFile); string strDirectory = localFile; localFile = localFile + "\\" + Path.GetFileName(docMessage.DownloadURL); if(File.Exists(localFile)) File.Delete(localFile); if(DownloadFile(docMessage.DownloadURL,localFile) <= 1) return false; /////////////////////////////////////// this.setSavedFileNameAndPath(localFile); ICSharpZip.UnzipZip(localFile,strDirectory + "\\"); //ICSharpZip.UnzipFile.UnZippedFrom(localFile,strDirectory + "\\" );//+ Path.GetFileNameWithoutExtension(docMessage.DownloadURL)); localFile = strDirectory + "\\" + Path.GetFileNameWithoutExtension(docMessage.DownloadURL); return true; } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage( "DocumentSharingEx.cs ==>RecieveDocumentSharing( line==>304",exp,"Unable to communicate with WebServer. " + exp.Message.ToString(),true); if(OnStatusUpdateFunction !=null) OnStatusUpdateFunction("Unable to communicate with WebServer. " + exp.Message); return false; } //return false; }
public void SendMessage(MessageObject msg) { _publicQueue.Send(msg); }