Exemple #1
0
        public MainForm()
        {
            InitializeComponent();

            this.MinimumSize = this.ClientSize;

            if (rtaGlassEffect.GlassEnabled)
            {
                this._glass = new rtaGlassEffect
                {
                    UseHandCursorOnTitle = false,
                    TopBarSize           = this.ClientSize.Height - 44,
                    LeftBarSize          = 1,
                    RightBarSize         = 1,
                    BottomBarSize        = 1
                };

                this._glass.ShowEffect(this);
            }

            AppEvents.On(AppEventType.ChatOpened, e =>
            {
                this.InvokeEx(t =>
                {
                    Dialog chat = (Dialog)e.Data[0];

                    t.Text = chat.Title + @" - WinVK";
                    t.encryptCB.Checked = (chat.Crypt && !String.IsNullOrEmpty(chat.CryptKey));
                });
            });
        }
Exemple #2
0
 public ChatsListControl() : base()
 {
     AppEvents.On(AppEventType.AuthCompleted, e =>
     {
         this.LoadChats();
     });
 }
Exemple #3
0
        public UserBarControl()
            : base()
        {
            this.DoubleBuffered = true;
            this.BackColor      = Color.Black;

            AppEvents.On(AppEventType.AuthCompleted, e =>
            {
                this.authCompleted = true;
                this.Invalidate();
            });
        }
Exemple #4
0
        public ChatControl() : base()
        {
            AppEvents.On(AppEventType.OpenChat, OpenChat);

            LongPollServer.On(LPEventType.MessageAdded, async e =>
            {
                if (this._chat == null)
                {
                    return;
                }

                int msgID = (int)((long)((JValue)e.Data[0]).Value);

                Message msg = await Message.Get(msgID);

                if (msg.UserID == this._chat.Message.UserID || (msg.ChatID != 0 && msg.ChatID == this._chat.Message.ChatID))
                {
                    (new Thread(() =>
                    {
                        if (msg.Attachments != null && msg.Attachments.Length > 0)
                        {
                            foreach (Attachment a in msg.Attachments)
                            {
                                if (a.Type == "photo" && a.Photo != null)
                                {
                                    a.Photo.Load();
                                }
                            }
                        }

                        if (msg.CryptedNow && this._chat.CryptKey != null)
                        {
                            msg.Decrypt(this._chat.CryptKey);
                        }

                        msg.Author.GetPhoto();

                        this._messages.Add(msg);

                        this._loaded = true;

                        this._heightCalculated = false;

                        this.InvokeEx(t =>
                        {
                            t.Invalidate();
                        });
                    })).Start();
                }
            });
        }