Beispiel #1
0
 public EmailConfig(messaging editEmailConfigHelper, ButtonEvent buttonEvent)
 {
     InitializeComponent();
     _editEmailConfigHelper = editEmailConfigHelper;
     this.buttonEvent       = ButtonEvent.Edit;
     InitControls(_editEmailConfigHelper);
 }
Beispiel #2
0
 private void InitControls(messaging editConfig)
 {
     txtUsername.Text      = editConfig.username;
     txtPassword.Text      = editConfig.password;
     txtPortNumber.Text    = editConfig.port_nr.ToString();
     txtServerAddress.Text = editConfig.server_address;
     editConfig.sslEnabled = Convert.ToInt32(editConfig.sslEnabled == 1 ? checkBoxSSL.CheckState = CheckState.Checked : checkBoxSSL.CheckState = CheckState.Unchecked);
 }
Beispiel #3
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        messaging script = (messaging)this.target;

        if (GUILayout.Button("Send Tweet!"))
        {
            script.send_tweet();
        }
    }
 private messaging GetEmailConfig(messaging msg)
 {
     if (dataGridViewEmailConfig.CurrentRow.Index != -1)
     {
         msg.messaging_id = Convert.ToInt32(dataGridViewEmailConfig.CurrentRow.Cells["messaging_id"].Value);
         using (emedEntities db = new emedEntities())
         {
             msg = db.messagings.FirstOrDefault(m => m.messaging_id == msg.messaging_id);
         }
     }
     return(msg);
 }
    // Method to send message with Case and message parameters, no Player Name parameter needed as stored already
    public void SendMessage(string prCase, string prMessage)
    {
        messaging TheObject = new messaging();     // create message Object then put values into object

        TheObject.ID      = prCase;
        TheObject.Name    = PlayersName;
        TheObject.Message = prMessage;
        string json = JsonUtility.ToJson(TheObject); // Convert object into JSN string for sending to server

        Debug.Log("Sent: " + json);                  // log
        // Publish the message being sent to the chat MQTT server
        client.Publish("Excalibur/" + SceneID, System.Text.Encoding.UTF8.GetBytes(json), MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE, true);
    }
Beispiel #6
0
    // private TwitterApi twitter_api;

    void Start()
    {
        Screen.SetResolution(1024, 768, false);
        if (messaging.instance != null)
        {
            DestroyImmediate(this.gameObject);
        }

        messaging.instance = this;

        this.text_mesh          = this.GetComponent <TextMesh>();
        this.text_mesh.fontSize = 14;
    }
    //Methid called whenever MQTT server messages are recieved
    void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
    {
        string json = System.Text.Encoding.UTF8.GetString(e.Message);                        // Get the string from server response into string

        Debug.Log("Recieved: " + json);                                                      // log
        if (IgnoreFirstMsg == false)                                                         // Check if ignore first message is still false if so do code and exit method
        {
            mqtt           = mqtt + "You are now chatting in: " + SceneID.ToString() + "\n"; // append to chat that you joined
            IgnoreFirstMsg = true;                                                           // Change to true
            SendMessage("HERE", "Im Here!");                                                 // Broadcast to chat that you are here which makes you show up in others lists
            return;
        }
        //Convert the JSN response into the custom Message Class structure for chat (ID,Name,Message)
        messaging TheObject = JsonUtility.FromJson <messaging>(json);

        switch (TheObject.ID)                                               // Identify what case we are handling by the Objects ID
        {
        case "CHAT":                                                        // Got Chat message / Picked Up item message
            mqtt = mqtt + TheObject.Name + ": " + TheObject.Message + "\n"; // Append new Chat to existing chat
            break;

        case "JOIN":                         // Got Joined message telling you Someone joined
            SendMessage("HERE", "Im Here!"); // Reply when someone joins saying Here to add yourself to their list
            if (TheObject.Name == PlayersName)
            {
                return;
            }                                                               // Dont post in chat user joined if its yourself
            mqtt = mqtt + TheObject.Name + ": " + TheObject.Message + "\n"; //append joined message to chat
            break;

        case "HERE":                                           // Cse to add name to players list if not there yet
            if (chatusers.Contains(TheObject.Name) == false)   // is or isnt there already
            {
                chatusers = chatusers + TheObject.Name + "\n"; // Wasnt there so append it to the players list
            }
            return;

        case "LEFT":         // Case when user leaves chat
            if (TheObject.Name == PlayersName)
            {
                return;
            }                                                                    // Dont process if its yourself
            mqtt      = mqtt + TheObject.Name + ": " + TheObject.Message + "\n"; // Append to chat the left message
            chatusers = chatusers.Replace(TheObject.Name + "\n", "");            // Replace player in list with blank
            break;
        }

        scrolldown = true; // Set to true so chat will scroll to bottom once
    }
 private void Delete(messaging msg)
 {
     if (dataGridViewEmailConfig.CurrentRow.Index != -1)
     {
         msg.messaging_id = Convert.ToInt32(dataGridViewEmailConfig.CurrentRow.Cells["messaging_id"].Value);
         if (MessageBox.Show($"Are you sure you want to delete this record?", "Delete Email Config", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             using (emedEntities db = new emedEntities())
             {
                 var result = db.Entry(msg);
                 if (result.State == EntityState.Detached)
                 {
                     db.messagings.Attach(msg);
                 }
                 db.messagings.Remove(msg);
                 db.SaveChanges();
                 MessageBox.Show("Record Deleted Successfully", "Message");
             }
             RefreshData();
             CheckButtonState();
         }
     }
 }
Beispiel #9
0
        private void EditEmailConfig(messaging editConfig)
        {
            try
            {
                editConfig.username       = txtUsername.Text.Trim();
                editConfig.password       = txtPassword.Text.Trim();
                editConfig.port_nr        = Convert.ToInt32(txtPortNumber.Text.Trim());
                editConfig.server_address = txtServerAddress.Text.Trim();
                editConfig.sslEnabled     = (checkBoxSSL.Checked) ? isEnabled + 1 : isEnabled;

                using (emedEntities db = new emedEntities())
                {
                    db.Entry(editConfig).State = EntityState.Modified;
                    db.SaveChanges();
                    MessageBox.Show("Email Config Updated Successfully!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                MessagingControl.fromMsgControl.InitControls();
                RefreshData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #10
0
        private void SaveEmailConfig()
        {
            try
            {
                using (emedEntities db = new emedEntities())
                {
                    messaging msg = new messaging();
                    msg.username       = txtUsername.Text.Trim();
                    msg.password       = txtPassword.Text.Trim();
                    msg.port_nr        = Convert.ToInt32(txtPortNumber.Text.Trim());
                    msg.sslEnabled     = (checkBoxSSL.Checked) ? isEnabled + 1 : isEnabled;
                    msg.server_address = txtServerAddress.Text.Trim();
                    db.messagings.Add(msg);
                    db.SaveChanges();
                    MessageBox.Show("Email Connection String Saved Successfully", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                RefreshData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public override void sendMessage(_nArrayAdapter<object> n1, java.lang.String n2, messaging.Message n3) {

            string subject = toCSharp(n2);
            var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker();
            contactPicker.DesiredFieldsWithContactFieldType.Add(ContactFieldType.Email);

            Contact recipient = contactPicker.PickContactAsync().AsTask().ConfigureAwait(false).GetAwaiter().GetResult();

            if (recipient != null) {
                IList<ContactEmail> fields = recipient.Emails;

                if (fields.Count > 0) {
                    if (fields[0].GetType() == typeof(ContactEmail)) {
                        foreach (ContactEmail email in fields as IList<ContactEmail>) {

                            EmailMessage emailMessage = new EmailMessage();
                            emailMessage.Body = toCSharp((java.lang.String)n3.getContent()); ;
                            emailMessage.Subject = subject;
                            var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(email.Address);
                            emailMessage.To.Add(emailRecipient);
                            EmailManager.ShowComposeNewEmailAsync(emailMessage).AsTask().ConfigureAwait(false).GetAwaiter().GetResult();
                            break;
                        }
                    }
                }
                else {
                    //OutputTextBlock.Text = "No recipient emailid Contact found";
                }
            }
            else {
                // OutputTextBlock.Text = "No recipient emailid Contact found";
            }
        }