Esempio n. 1
0
        private List <TextMessage> LoadMessages()
        {
            FileHandler _fHandler = new FileHandler();

            return(_fHandler.ReadXmlDatabase());
        }
Esempio n. 2
0
        /// <summary>
        /// Adds a text message GUI object to the selected control
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="_control"></param>
        private void AddTextMessage(TextMessage msg, Control _control)
        {
            Panel mainPanel = new Panel()
            {
                //BackColor = Color.Gray,
                BackColor = Color.FromArgb(255, 183, 210, 197),
                Size      = new Size(_control.Width - 5, 50)
            };

            Button btn_Delete = new Button()
            {
                Location              = new Point(3, 8),
                BackgroundImage       = Resources.delete,
                BackgroundImageLayout = ImageLayout.Stretch,
                Size      = new Size(35, 35),
                FlatStyle = FlatStyle.Flat,
            };

            btn_Delete.Click += (sender, args) =>
            {
                FileHandler _fHandler = new FileHandler();
                _fHandler.RemoveXmlDatabaseElement(msg.ID);
                // Refresh the visual
                this.Controls.Remove(Messages_ParentPanel);
                ShowMessagesList();
            };


            mainPanel.Controls.Add(btn_Delete);


            Label lbl_date = new Label()
            {
                Location  = new Point(70, 0),
                TextAlign = ContentAlignment.MiddleCenter,
                ForeColor = Color.White,
                //BackColor = Color.Gray,
                BackColor = Color.FromArgb(255, 58, 175, 118),
                Text      = msg.DateSent,
                Height    = 14,
            };

            mainPanel.Controls.Add(lbl_date);

            TextBox tBox = new TextBox()
            {
                BorderStyle = BorderStyle.Fixed3D,
                Location    = new Point(btn_Delete.Location.X + btn_Delete.Width + 4, 20),
                TextAlign   = HorizontalAlignment.Center,
                Size        = new Size(150, 25),
                ReadOnly    = true,
                BackColor   = Color.DarkGray,
                Text        = msg.Message
            };

            mainPanel.Controls.Add(tBox);


            Button btn_CopyClipboard = new Button()
            {
                Location              = new Point(tBox.Location.X + tBox.Size.Width + 3, 8),
                Size                  = new Size(35, 35),
                BackgroundImage       = Resources.icon_copy_clipboard_empty,
                BackgroundImageLayout = ImageLayout.Stretch,
                Text                  = ""
            };

            btn_CopyClipboard.Click += (sender, args) => {
                CopyToClipboard(msg);
            };

            mainPanel.Controls.Add(btn_CopyClipboard);

            Button btn_Expand = new Button()
            {
                Location              = new Point(btn_CopyClipboard.Location.X + btn_CopyClipboard.Size.Width + 5, 8),
                Size                  = new Size(35, 35),
                BackgroundImage       = Resources.icon_arrow_right,
                BackgroundImageLayout = ImageLayout.Stretch,
                Text                  = ""
            };

            btn_Expand.Click += (sender, args) =>
            {
                ExpandText(msg.Message);
            };

            mainPanel.Controls.Add(btn_Expand);

            _control.Controls.Add(mainPanel);
        }