Exemple #1
0
        private void SendMSG_Button_Click(object sender, EventArgs e)
        {
            DateTime dt = DateTime.Now;

            RecvBox.AppendText(dt.ToString() + "   " + CFG.UserID + ":" + Environment.NewLine);
            RecvBox.AppendText(TransBox.Text + Environment.NewLine);
            byte[] sendcache = AES_module.AES_Encrypt(Encoding.UTF8.GetBytes(TransBox.Text), AES_Key, AES_IV);
            PUB.s.Send(sendcache);
            TransBox.Clear();
        }
Exemple #2
0
 private void textbox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == (Keys.Control | Keys.Enter))
     {
         DateTime dt = DateTime.Now;
         RecvBox.AppendText(dt.ToString() + "   " + CFG.UserID + ":" + Environment.NewLine);
         RecvBox.AppendText(TransBox.Text + Environment.NewLine);
         byte[] sendcache = AES_module.AES_Encrypt(Encoding.UTF8.GetBytes(TransBox.Text), PUB.AES_Key, PUB.AES_IV);
         PUB.s_chat.Send(sendcache);
         TransBox.Clear();
         TransBox.Focus();
     }
 }
Exemple #3
0
        /// <summary>
        /// Recreates the <see cref="ITransBox"/>es for the current selection.
        /// </summary>
        /// <param name="camera">The camera describing the view area.</param>
        void UpdateTransBoxes(ICamera2D camera)
        {
            SelectedTransBox = null;
            UnderCursor      = null;

            // Clear the old boxes
            _transBoxes.Clear();

            if (_items.Count <= 0)
            {
                // Nothing selected
                return;
            }
            else if (_items.Count == 1)
            {
                // Only one selected
                var item = _items.FirstOrDefault();
                if (item == null)
                {
                    Debug.Fail("How did this happen?");
                    Clear(camera);
                    return;
                }

                var transBoxes = TransBox.SurroundEntity(this, item, camera);
                _transBoxes.AddRange(transBoxes);
            }
            else
            {
                // Multiple selected
                var min    = new Vector2(Items.Min(x => x.Position.X), Items.Min(x => x.Position.Y));
                var max    = new Vector2(Items.Max(x => x.Max.X), Items.Max(x => x.Max.Y));
                var center = min + ((max - min) / 2f).Round();

                var tb = new MoveManyTransBox(this, _items, center, camera);
                _transBoxes.Add(tb);
            }
        }