Esempio n. 1
0
        public MessageEntry(ChatInterface controller, string usersname, CachedPictureBox picture, string initialMessage, DateTime timeStamp, Font message, Font timeStampFont)
        {
            this.controller = controller;
            OwnerUsername = usersname;
            InitializeComponent();

            messageFont = message;
            this.timeStampFont = timeStampFont;

            userName.Text = usersname;
            userName.Font = new Font(CustomFonts.Fonts.Families[1], 11, FontStyle.Bold);
            userName.Size = userName.PreferredSize;
            userName.TextAlign = ContentAlignment.MiddleLeft;
            userName.Anchor = AnchorStyles.Top | AnchorStyles.Left;

            userPicture = picture;
            userPicture.Location = new Point(0, 9);
            userPicture.Name = "UserPicture";
            userPicture.Size = new Size(48, 48);
            userPicture.TabIndex = 0;
            userPicture.TabStop = false;
            Controls.Add(userPicture);

            ts.Font = timeStampFont;
            ts.TextAlign = ContentAlignment.MiddleLeft;
            ts.ForeColor = Color.FromArgb(0xba, 0xbb, 0xbf);

            ts.Text = timeStamp.ToString(controller.connected.Client.MySelf.prefs.time24 ? "HH:mm" : "hh:mm tt");
            ts.Size = ts.PreferredSize;
            ts.Location = new Point(userName.Right, userName.Bottom - ts.PreferredHeight);

            ts.Anchor = AnchorStyles.Top | AnchorStyles.Left;

            baseText.Text = Regex.Replace(initialMessage, "\r\n|\r|\n", "\r\n");
            baseText.BorderStyle = System.Windows.Forms.BorderStyle.None;
            baseText.Font = message;
            baseText.Size = new Size(Width - 70, 10);
            baseText.Multiline = true;
            baseText.WordWrap = true;
            baseText.ReadOnly = true;
            baseText.Location = new Point(userName.Location.X, userName.Bottom + 5);
            baseText.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            baseText.GotFocus += baseText_GotFocus;
            baseText.MouseWheel += baseText_MouseWheel;

            lastMessage = new Tuple<Label,ChainLabel>(ts, baseText);
            lastTimeStamp = timeStamp;

            appended = new List<Tuple<Label, ChainLabel>>();

            this.ClientSize = this.PreferredSize;

            oldY = this.Location.Y;
            oldHeight = this.Height;
            this.SizeChanged += UpdateSize;
        }
Esempio n. 2
0
        public MessageEntry(ChatInterface controller, string usersname, CachedPictureBox picture, string initialMessage, DateTime timeStamp, Font message, Font timeStampFont)
        {
            this.controller = controller;
            OwnerUsername   = usersname;
            InitializeComponent();

            messageFont        = message;
            this.timeStampFont = timeStampFont;

            userName.Text      = usersname;
            userName.Font      = new Font(CustomFonts.Fonts.Families[1], 11, FontStyle.Bold);
            userName.Size      = userName.PreferredSize;
            userName.TextAlign = ContentAlignment.MiddleLeft;
            userName.Anchor    = AnchorStyles.Top | AnchorStyles.Left;

            userPicture          = picture;
            userPicture.Location = new Point(0, 9);
            userPicture.Name     = "UserPicture";
            userPicture.Size     = new Size(48, 48);
            userPicture.TabIndex = 0;
            userPicture.TabStop  = false;
            Controls.Add(userPicture);

            ts.Font      = timeStampFont;
            ts.TextAlign = ContentAlignment.MiddleLeft;
            ts.ForeColor = Color.FromArgb(0xba, 0xbb, 0xbf);

            ts.Text     = timeStamp.ToString(controller.connected.Client.MySelf.prefs.time24 ? "HH:mm" : "hh:mm tt");
            ts.Size     = ts.PreferredSize;
            ts.Location = new Point(userName.Right, userName.Bottom - ts.PreferredHeight);

            ts.Anchor = AnchorStyles.Top | AnchorStyles.Left;

            baseText.Text        = Regex.Replace(initialMessage, "\r\n|\r|\n", "\r\n");
            baseText.BorderStyle = System.Windows.Forms.BorderStyle.None;
            baseText.Font        = message;
            baseText.Size        = new Size(Width - 70, 10);
            baseText.Multiline   = true;
            baseText.WordWrap    = true;
            baseText.ReadOnly    = true;
            baseText.Location    = new Point(userName.Location.X, userName.Bottom + 5);
            baseText.Anchor      = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            baseText.GotFocus   += baseText_GotFocus;
            baseText.MouseWheel += baseText_MouseWheel;

            lastMessage   = new Tuple <Label, ChainLabel>(ts, baseText);
            lastTimeStamp = timeStamp;

            appended = new List <Tuple <Label, ChainLabel> >();

            this.ClientSize = this.PreferredSize;

            oldY              = this.Location.Y;
            oldHeight         = this.Height;
            this.SizeChanged += UpdateSize;
        }
Esempio n. 3
0
        public ConnectedInterface(SlackSocketClient connectedClient, LoginResponse loginDetails)
        {
            Client = connectedClient;
            chats = new Dictionary<string, ChatInterface>();

            InitializeComponent();

            channelList = new SlackChannelList(this);
            channelList.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
            channelList.AutoScroll = true;
            channelList.BackColor = Color.FromArgb(0x4D, 0x39, 0x4B);
            channelList.Location = new Point(0, 52); //53
            channelList.Margin = new Padding(0);
            channelList.Name = "channelList";
            channelList.Size = new Size(220, 671);
            channelList.TabIndex = 2;
            channelList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            Controls.Add(this.channelList);
            channelList.Flush();

            username = new Label()
            {
                Text = Client.MySelf.name,
                Location = new Point(64, 10),
                Size = new Size(120, 24),
                ForeColor = Color.White,
                Font = new Font(CustomFonts.Fonts.Families[1], 14, FontStyle.Bold),
                TextAlign = ContentAlignment.BottomLeft
            };

            userPicture = new CachedPictureBox(Client.MyData.profile.image_48);
            userPicture.Location = new Point(8, 8);
            userPicture.Size = new Size(48, 48);

            TeamName = new Label()
            {
                Text = Client.MyTeam.name,
                Size = new Size(188, 53),
                Location = new Point(16, 0),
                TextAlign = ContentAlignment.MiddleLeft,
                ForeColor = Color.White,
                Font = new Font(CustomFonts.Fonts.Families[1], 14, FontStyle.Bold)
            };

            profileTitle.Controls.Add(username);
            teamTitle.Controls.Add(TeamName);
            profileTitle.Controls.Add(userPicture);

            //Default to general channel.
            SelectChannel(Client.Channels[0].id);

            this.Invalidate();
        }
Esempio n. 4
0
        public ConnectedInterface(SlackSocketClient connectedClient, LoginResponse loginDetails)
        {
            Client = connectedClient;
            chats  = new Dictionary <string, ChatInterface>();

            InitializeComponent();

            channelList             = new SlackChannelList(this);
            channelList.Anchor      = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
            channelList.AutoScroll  = true;
            channelList.BackColor   = Color.FromArgb(0x4D, 0x39, 0x4B);
            channelList.Location    = new Point(0, 52); //53
            channelList.Margin      = new Padding(0);
            channelList.Name        = "channelList";
            channelList.Size        = new Size(220, 671);
            channelList.TabIndex    = 2;
            channelList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            Controls.Add(this.channelList);
            channelList.Flush();

            username = new Label()
            {
                Text      = Client.MySelf.name,
                Location  = new Point(64, 10),
                Size      = new Size(120, 24),
                ForeColor = Color.White,
                Font      = new Font(CustomFonts.Fonts.Families[1], 14, FontStyle.Bold),
                TextAlign = ContentAlignment.BottomLeft
            };

            userPicture          = new CachedPictureBox(Client.MyData.profile.image_48);
            userPicture.Location = new Point(8, 8);
            userPicture.Size     = new Size(48, 48);

            TeamName = new Label()
            {
                Text      = Client.MyTeam.name,
                Size      = new Size(188, 53),
                Location  = new Point(16, 0),
                TextAlign = ContentAlignment.MiddleLeft,
                ForeColor = Color.White,
                Font      = new Font(CustomFonts.Fonts.Families[1], 14, FontStyle.Bold)
            };

            profileTitle.Controls.Add(username);
            teamTitle.Controls.Add(TeamName);
            profileTitle.Controls.Add(userPicture);

            //Default to general channel.
            SelectChannel(Client.Channels[0].id);

            this.Invalidate();
        }