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(); } }
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; }