Ejemplo n.º 1
0
        void FormMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            // Destroy objects
            if (mMessageListControlCurrent != null)
            {
                mMessageListControlCurrent.Dispose();
                mMessageListControlCurrent = null;
            }

            mSemaphores      = null;
            mChatUserList    = null;
            mChatMessageList = null;
            mChatMessage     = null;

            if (mMessageListControlCurrent != null)
            {
                mformUserLists.Dispose();
                mformUserLists = null;
            }

            foreach (Controls.MessageList messageListCurrent in panelMessageList.Controls)
            {
                panelMessageList.Controls.Remove(messageListCurrent);
                messageListCurrent.Dispose();
            }
        }
Ejemplo n.º 2
0
        public formMain(string[] args)
        {
            InitializeComponent();

            SetAppearance();

            // Check if CompanyID and UserID are specified in command-line arguments
            if (CheckCommandLineArguments(args) == false)
            {
                System.Environment.Exit(1);
            }

            // Check Company and User in Databases
            UserFunctions UserForCheck = new UserFunctions();

            if (UserForCheck.CheckCompany(mCompanyID) == false)
            {
                System.Environment.Exit(1);
            }
            if (UserForCheck.CheckUser(mUserID, out mUserName) == false)
            {
                System.Environment.Exit(1);
            }
            UserForCheck = null;

            mChatUserList    = new ChatUserList();
            mChatMessageList = new ChatMessageList(mCompanyID, mUserID);
            mChatMessage     = new ChatMessage(mCompanyID, mUserID);
            mSemaphores      = new Semaphores(mCompanyID, mUserID);

            timerMain.Interval = My.Settings.RefreshTimer_IntervalInMilliseconds;
            timerMain.Enabled  = true;
            TimerTick(timerMain, new EventArgs());

            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 3
0
        static public void ChatWithUser(TableLayoutPanel panelUserInfoAndMessageListAndMessageNew, ref Controls.MessageList messageListControlCurrent, Label labelUserName, Panel panelMessageList, byte companyID, short userID, string userName, ChatMessageList chatMessageListCurrent)
        {
            if (panelUserInfoAndMessageListAndMessageNew.Visible == false)
            {
                panelUserInfoAndMessageListAndMessageNew.Visible = true;
            }

            if (messageListControlCurrent != null)
            {
                messageListControlCurrent.Visible = false;
            }

            labelUserName.Text = userName;

            messageListControlCurrent         = MessageListControlFunctions.GetMessageListControl(ref panelMessageList, companyID, userID);
            messageListControlCurrent.Visible = true;

            if (chatMessageListCurrent.LoadMessagesForUser(messageListControlCurrent))
            {
            }
        }