7 Replies - 390 Views - Last Post: 30 August 2013 - 05:44 PM Rate Topic: -----

#1 vbnet9  Icon User is offline

  • D.I.C Regular

Reputation: 12
  • View blog
  • Posts: 346
  • Joined: 26-May 09

Initialization causes unresponsiveness and high memory

Posted 30 August 2013 - 01:41 PM

Hello

I have narrowed it down to the form in my program that is used to set the settings. On the sub new() I added the following code:

Dim ts = New TimeSpan(Now.Ticks)
InitializeComponent()

Dim newts As New TimeSpan(Now.Ticks - ts.Ticks)
MessageBox.Show(newts.TotalSeconds)


This initialization takes over 6 or 7 seconds to run, causes the entire program to freeze and the task manager spikes to 600,000 k for the process. After it popups up the message box with the time, the task manager memory for the process drops to 20,000 k and everything is back to working like normal.

This only happens the FIRST time the settings window is opened. All subsequent times it opens almost instantly. I thought that would mean something is being initialized the first time and not the others. Each time the settings window is opened the object is set to a new instance of the form.

 If openSettings = True Then
            openSettings = False

            If Not (settingsOpen) Then
                settingsOpen = True

                newSettingsForm = New frmSettings '6.30 seconds?

                newSettingsForm.Show(userAccounts.getAccounts) '0.04 seconds

            Else
                newSettingsForm.Focus()
            End If

        End If


I don't think it is any of the variables that are initialized as they are all pretty basic. I would really like some direction on what to look for to fix this, please.

Is This A Good Question/Topic? 0
  • +

Replies To: Initialization causes unresponsiveness and high memory

#2 vbnet9  Icon User is offline

  • D.I.C Regular

Reputation: 12
  • View blog
  • Posts: 346
  • Joined: 26-May 09

Re: Initialization causes unresponsiveness and high memory

Posted 30 August 2013 - 01:55 PM

Here's the whole class



Imports System.IO
Imports System.Environment

Public Class frmSettings

#Region "    storage   "
    ' Remember if the changes shoul dbe updated or not.
    Private applyChanges As Boolean = False
    Private accountlist As New List(Of NewAccounts)
    Private viewList As New List(Of myViewList)
    Private scheduleList As New List(Of schedule)
    Dim passwordResult As Boolean = False

    'Private newAccountlist As New List(Of newAccount)
    ' Any time a change is made, this boolean changesMade should be changed to true
    ' This is to prevent settings being lost if user accidentally hits cancel.
    Private newSettings As New settings
    Private changesMade As Boolean = False

#End Region
#Region "     events    "

    Public Event settingsClosed(changeList As List(Of NewAccounts))
    Public Event errorMessage(message As String, severity As Short, sender As String, fullMessage As String)
    Public Event opMessage(message As String, sender As String, fullMessage As String)
    Public Event deleteAccounts()
    Public Event ExportSettings(File As String)
    Public Event ImportSettings(File As String, tab As tabs)
    Public Event load_SGA_Settings(Filename As String)
    Public Event showProgramMessages()

    ' The okay button 
    Private Sub Btn_OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_OK.Click
        Dim validationerrors = isValidated()
        If validationerrors.Count = 0 Then
            ' Apply settings is set to true 
            applyChanges = True
            ' The form is closed
            Me.Close()
        Else
            Dim errorString As String = "There are errors on the form"

            For Each errorItem In validationerrors
                errorString += Environment.NewLine & errorItem
            Next

            ErrorProvider1.SetError(Btn_Cancel, errorString)

        End If
    End Sub
    ' The cancel button
    Private Sub Btn_Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Cancel.Click
        ' Close the form 
        ' See if the user made changes

        Try
            If changesMade Then
                ' Since the user made changes, we should check to see if they really want to exit without saving
                If MessageBox.Show("Are you sure you wish to cancel? Some changes have been made.",
                                   "Confirm", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
                    ' User wants to close
                    Me.Close()
                End If
            Else
                ' Close the form
                Me.Close()
            End If
        Catch ex As Exception
            RaiseEvent errorMessage("Cancel error", 1, "frmSettings:btnCancel", ex.Message)
        End Try

    End Sub

    Private Function isValidated() As List(Of String)

        Dim result As New List(Of String)

        If intervalSec.Value < 15 And intervalMin.Value = 0 Then
            result.Add("Checking interval is too low")
            ErrorProvider1.SetError(intervalSec, "Checking interval is too low")
        End If

        If useProxy.Checked Then

            If proxyServerAddress.Text.Length = 0 Then
                result.Add("Proxy server address is blank")
                ErrorProvider1.SetError(proxyServerAddress, "Proxy server address is blank")
            End If

            If isNumerical(proxtServerPort.Text) = False Then
                result.Add("Proxy port value is invalid")
                ErrorProvider1.SetError(proxtServerPort, "Proxy port value is invalid")
            End If

            If proxtServerPort.Text.Length = 0 Then
                result.Add("Proxy port value is blank")
                ErrorProvider1.SetError(proxtServerPort, "Proxy port value is blank")
            End If

            If chkProxyAuth.Checked Then

                If proxyDomain.Text.Length = 0 Then
                    result.Add("Proxy Domain value is blank")
                    ErrorProvider1.SetError(proxyDomain, "Proxy Domain value is blank")
                End If

                If proxyPassword.Text.Length = 0 Then
                    result.Add("Proxy password value is blank")
                    ErrorProvider1.SetError(proxyPassword, "Proxy password value is blank")
                End If

                If proxyUserName.Text.Length = 0 Then
                    result.Add("Proxy username value is blank")
                    ErrorProvider1.SetError(proxyUserName, "Proxy username value is blank")
                End If

            End If

            If RadioButton2.Checked Or RadioButton3.Checked Then

                If growlPassReq.Checked Then
                    If growlPass.Text.Length = 0 Then
                        result.Add("Growl password is blank")
                        ErrorProvider1.SetError(growlPass, "Growl password is blank")
                    End If
                End If

                If growlRemoteSess.Checked Then
                    If growlHost.Text.Length = 0 Then
                        Dim errorString As String = "Growl Host value is blank"
                        result.Add(errorString)
                        ErrorProvider1.SetError(growlHost, errorString)
                    End If

                End If
                If growlPort.Text.Length = 0 Then
                    Dim errorString As String = "Growl port value is blank"
                    result.Add(errorString)
                    ErrorProvider1.SetError(growlPort, errorString)
                End If
                If isNumerical(growlPort.Text) = False Then
                    Dim errorString As String = "Growl port value is invalid"
                    result.Add(errorString)
                    ErrorProvider1.SetError(growlPort, errorString)
                End If

            End If
        End If


        Return result

    End Function
    Private Sub clearErrorProvider(sender As Object, e As System.EventArgs) Handles growlPort.TextChanged,
                                                                                    growlHost.TextChanged,
                                                                                    growlPass.TextChanged,
                                                                                    intervalSec.ValueChanged,
                                                                                    proxtServerPort.TextChanged,
                                                                                    proxyDomain.TextChanged,
                                                                                    proxyPassword.TextChanged,
                                                                                    proxyServerAddress.TextChanged,
                                                                                    proxyUserName.TextChanged


        ErrorProvider1.SetError(sender, Nothing)

    End Sub
    ' Handle the changing of the tabcontrol index
    Private Sub TabControl1_TabIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
        ' Case select on the index
        Select Case TabControl1.SelectedIndex
            ' First tab
            Case 0
                ' Load the account data
                showAccounts()
        End Select
    End Sub
    ' Handle form closing
    Private Sub Frm_Settings_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        ' If the applyChanges boolean was set, we ahve to update the changes
        ' This should help avoid lost settings issues from early SGA interations.
        Try
            If applyChanges Then

                ' When this form closes, we send the result
                ' Return the accounts
                With systemSettings.app_settings.connection
                    .useProxy = useProxy.Checked
                    If .useProxy Then
                        .proxyAuth = chkProxyAuth.Checked
                        .proxyDomain = proxyDomain.Text
                        .proxyPassword = proxyPassword.Text
                        .proxyPort = proxtServerPort.Text
                        .proxyServer = proxyServerAddress.Text
                        .proxytype = Limilabs.Proxy.ProxyType.Http
                        .proxyUser = proxyUserName.Text
                    End If
                    .interval = (intervalMin.Value * 60) + intervalSec.Value
                End With

                With systemSettings.app_settings.alerts
                    .alertFade = alertFadeSpeed.SelectedIndex
                    .alertHoverTime = alertDisplayTime.Value
                    .pauseOnHover = CheckBox1.Checked
                    .removeTrans = alertRemoveTransOnHover.Checked
                    '.systemAeroSelected =
                    .transparency = alertTransparency.Value
                    .flashScroll = scrollFlash.Checked
                    .hideFullScreen = HideOnFullScreen.Checked
                    .showOnTop = showOnTop.Checked
                    .maxAlerts = alertMax.Value

                    .showOnWake = showOnWake.Checked
                    .showAfterIdle = chkWakeFromIdle.Checked
                    .showOnNewEmail = chkWhenEmailReceived.Checked

                End With

                With systemSettings.app_settings.advanced
                    .startWithWindows = startWithWindows.Checked
                    .startWithWindows = startWithWindows.Checked
                    .defaultMailHandler = defaultHandler.Checked
                    .sendEmail = sendEmail.Checked
                    .popMenu = chkEmailPop.Checked

                    .trayAnimate = TrayanimateTray.Checked
                    .trayDisplayMessageCount = TraydisplayMessageCount.Checked
                    .trayEnableLeftClick = enableLeftClick.Checked
                    .getTrayClientToOpen = openFor.Text

                    ' Not a specific account, instead the first account with unread mail
                    If openFor.SelectedIndex = 0 Then
                        .getTrayClientToOpen = "first"
                    End If

                    ' Not a specific account, instead the first account with most unread mail
                    If openFor.SelectedIndex = 1 Then
                        .getTrayClientToOpen = "first"
                    End If

                    .trayOpenClient = RadioButton4.Checked
                    .trayReDisplay = TrayredisplayClick.Checked
                    .trayUnseenAlert = TraydisplayunseenMessage.Checked

                    Dim accountName As String = String.Empty

                    If openFor.SelectedIndex > -1 Then
                        If accountlist(openFor.SelectedIndex).updated Then
                            accountName = accountlist(openFor.SelectedIndex).ChangedAccount.userAccountName
                        Else
                            accountName = accountlist(openFor.SelectedIndex).ExistingAccount.userAccountName
                        End If

                    End If

                    .getTrayClientToOpen = accountName

                    .getUseGrowl = RadioButton3.Checked
                    .getUseGrowlOnly = RadioButton2.Checked
                    .getUseFilterGrowl = RadioButton5.Checked

                    If growlPassReq.Checked Then
                        .growlPassword = growlPass.Text
                    Else
                        .growlPassword = Nothing
                    End If
                    If growlRemoteSess.Checked Then
                        .growlHost = growlHost.Text
                        .growlPort = growlPort.Text
                    Else
                        .growlHost = Nothing
                        .growlPort = Nothing
                    End If

                End With

            With systemSettings.app_settings.security
                .protectPassword = txtSettingsPass.Text
                .protectSettings = chkSettingsPass.Checked
            End With

            With systemSettings.app_settings.contacts
                .autoPupulate = autoPopulateContacts.Checked
                    .limit = contactsEntries.Value
                    .autoComplete = chkAutoComplete.Checked
            End With
            systemSettings.app_settings.userSchedule.setSchedule = scheduleList

            'save settings here.
            systemSettings.save()
            End If

        Catch ex As Exception
            RaiseEvent errorMessage("Form closing error", 1, "frmSettings:closing", ex.Message)
        End Try

        RaiseEvent settingsClosed(accountlist)

    End Sub
    ' Overload the show event to pass the account data to the form
    Public Overloads Sub Show(ByVal accounts As List(Of newAccount))
        ' Set a copy of the account data to the form
        Try

            For Each account In accounts

                accountlist.Add(New NewAccounts(account))

            Next
            ' Set a copy of the application settings to the form
            newSettings = systemSettings.getSettings

            If accountlist.Count = 1 Then
                If accountlist(0).ExistingAccount.userServerAddress = Nothing Then

                    Me.Enabled = False

                    Dim newAcctForm As New frmUserAcct
                    Dim account As newAccount = accountlist(0).ExistingAccount
                    Dim newAccount = newAcctForm.ShowDialog(account)

                    If newAccount IsNot Nothing Then
                        If Not (newAccount.userAccountName = Nothing) Then

                            accountlist(0).ChangedAccount = newAccount
                            accountlist(0).updated = True
                            showAccounts()
                            changesMade = True
                        End If
                    End If

                    Me.Enabled = True

                End If
            End If

        Catch ex As Exception
            RaiseEvent errorMessage("Settings show failed", 1, "frmSettings:show", ex.Message)
        End Try

        ' Initilizes the showdialog base class
        MyBase.Show()
    End Sub
    ' Handle the settings load event
    Private Sub Frm_Settings_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try

            SplitContainer27.Size = New Point(349, 30)
            GroupBox4.Size = New Point(369, 68)

            scheduleList = systemSettings.app_settings.userSchedule.getSchedule

            If systemSettings.app_settings.security.protectSettings Then

                '  If InvokeRequired Then
                ' BeginInvoke(Sub() getPassword())
                'Else
                getPassword()
                ' End If

            Else
                passwordResult = True
            End If

            scheduleList = systemSettings.app_settings.userSchedule.getSchedule

            If passwordResult Then
                ' Hide all the tabs. Tabs are used for the ease of design, not user useage
                TabControl1.Appearance = TabAppearance.FlatButtons
                TabControl1.ItemSize = New Size(0, 1)
                TabControl1.SizeMode = TabSizeMode.Fixed

                ' Select the first tab
                TabControl1.SelectedTab = TabPage1
                alertFadeSpeed.SelectedIndex = 0
                ' Load the accounts data
                showAccounts() ' This might be unnessecary since there is an event based on the change of index. Does index change here?
                loadSettings()
            Else
                Me.Close()
            End If

            clearOpenItems()


        Catch ex As Exception
            RaiseEvent errorMessage("Form loading failed", 1, "frmSettings:load", ex.Message)
        End Try
    End Sub
    Private Sub getPassword()

        Dim newPasswordFrm As New frmPassword
        Dim result As String = newPasswordFrm.ShowDialog

        If result = systemSettings.app_settings.security.protectPassword Then
            passwordResult = True
        End If

    End Sub

    Private Sub loadSettings()

        With systemSettings.app_settings.alerts
            alertTransparency.Value = .transparency
            alertFadeSpeed.SelectedIndex = .alertFade
            alertDisplayTime.Value = .alertHoverTime
            alertRemoveTransOnHover.Checked = .removeTrans
            CheckBox1.Checked = .pauseOnHover
            alertMax.Value = .maxAlerts
            scrollFlash.Checked = .flashScroll
            HideOnFullScreen.Checked = .hideFullScreen
            showOnTop.Checked = .showOnTop

            showOnWake.Checked = .showOnWake
            chkWakeFromIdle.Checked = .showAfterIdle
            chkWhenEmailReceived.Checked = .showOnNewEmail

        End With

        With systemSettings.app_settings.connection
            useProxy.Checked = .useProxy
            proxyDomain.Text = .proxyDomain
            proxyPassword.Text = .proxyPassword
            proxtServerPort.Text = .proxyPort
            proxyServerAddress.Text = .proxyServer
            proxyUserName.Text = .proxyUser
            chkProxyAuth.Checked = .proxyAuth
            ComboBox1.SelectedText = .proxytype

            Dim timeMinutes As Short = .interval / 60
            Dim timeSeconds As Short = (.interval) - (timeMinutes * 60)

            intervalMin.Value = timeMinutes
            intervalSec.Value = timeSeconds
        End With

        With systemSettings.app_settings.advanced
            startWithWindows.Checked = .startWithWindows
            defaultHandler.Checked = .defaultMailHandler
            sendEmail.Checked = .sendEmail

            growlHost.Text = .growlHost
            growlPass.Text = .growlPassword
            growlPort.Text = .growlPort

            chkEmailPop.Checked = .popMenu

            TrayanimateTray.Checked = .trayAnimate
            TraydisplayMessageCount.Checked = .trayDisplayMessageCount
            TrayredisplayClick.Checked = .trayReDisplay
            TraydisplayunseenMessage.Checked = .trayUnseenAlert
            TraydisplayUnreadMessage.Checked = Not (.trayUnseenAlert)
            enableLeftClick.Checked = .trayEnableLeftClick
            TrayredisplayClick.Checked = Not (.trayOpenClient)
            RadioButton4.Checked() = .trayOpenClient

            If growlPass.Text.Length > 0 Then
                growlPassReq.Checked = True
            Else
                growlPassReq.Checked = False
            End If

            If growlHost.Text.Length > 0 Then
                growlRemoteSess.Checked = True
            Else
                growlRemoteSess.Checked = False
            End If

            If Not (growlPassReq.Checked And growlRemoteSess.Checked) Then
                RadioButton1.Checked = True
            End If

            RadioButton3.Checked = .getUseGrowl
            RadioButton5.Checked = .getUseFilterGrowl
            RadioButton2.Checked = .getUseGrowlOnly
        End With

        With systemSettings.app_settings.contacts
            autoPopulateContacts.Checked = .autoPupulate
            contactsEntries.Value = .limit
            chkAutoComplete.Checked = .autoComplete
        End With

        With systemSettings.app_settings.security
            chkSettingsPass.Checked = .protectSettings
            txtSettingsPass.Text = .protectPassword
        End With

    End Sub

    Private Sub NumericUpDown3_ValueChanged(sender As System.Object, e As System.EventArgs) Handles intervalSec.ValueChanged
        Try
            If intervalSec.Value = 60 Then
                intervalSec.Value = 0
                intervalMin.Value += 1
            End If

            If intervalSec.Value < 15 And intervalMin.Value = 0 Then
                ErrorProvider1.SetError(intervalSec, "Minimum interval is 15 seconds")
            Else
                ErrorProvider1.SetError(intervalSec, Nothing)
            End If
        Catch ex As Exception
            RaiseEvent errorMessage("Check interval change failed", 1, "frmSettings:numericUpDown3", ex.Message)
        End Try
    End Sub

    Private Sub NumericUpDown2_ValueChanged(sender As Object, e As System.EventArgs) Handles intervalMin.ValueChanged
        Try
            If intervalSec.Value < 15 And intervalMin.Value = 0 Then
                ErrorProvider1.SetError(intervalSec, "Minimum interval is 15 seconds")
            Else
                ErrorProvider1.SetError(intervalSec, Nothing)
            End If
        Catch ex As Exception
            RaiseEvent errorMessage("Check interval change failed", 1, "frmSettings:numericUpDown2", ex.Message)
        End Try
    End Sub

    Private Sub chkProxyAuth_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkProxyAuth.CheckedChanged
        proxyDomain.Enabled = chkProxyAuth.Checked
        proxyPassword.Enabled = chkProxyAuth.Checked
        proxyUserName.Enabled = chkProxyAuth.Checked
    End Sub

    Private Sub CheckBox4_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles useProxy.CheckedChanged
        proxyServerAddress.Enabled = useProxy.Checked
        proxtServerPort.Enabled = useProxy.Checked
        chkProxyAuth.Enabled = useProxy.Checked
        ComboBox1.Enabled = useProxy.Checked
        SplitContainer27.Panel2Collapsed = Not (useProxy.Checked)

        If SplitContainer27.Panel2Collapsed Then

            SplitContainer27.Size = New Point(349, 30)
            GroupBox4.Size = New Point(369, 68)
        Else

            SplitContainer27.Size = New Point(349, 184)
            GroupBox4.Size = New Point(369, 215)
            SplitContainer27.SplitterDistance = 25
        End If

        If ComboBox1.SelectedIndex < 0 Then
            ComboBox1.SelectedIndex = 0
        End If
    End Sub

    Private Sub btnRemoveAccount_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles btnRemoveAccount.LinkClicked
        Try
            Dim questionString As String = "Are you sure that you would like to remove these accounts?"
            If AccountGrid.SelectedRows.Count = 1 Then
                questionString = "Are you sure that you want to delete this account?"
            End If

            If AccountGrid.SelectedRows.Count > 0 Then
                If MessageBox.Show(questionString, "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then

                    Dim index As Short = AccountGrid.SelectedRows(0).Index
                    accountlist(viewList(index).index).deleted = True

                End If
            End If

            showAccounts()

        Catch ex As Exception
            RaiseEvent errorMessage("Remove account failed", 1, "frmSettings:btnRemove", ex.Message)
        End Try
    End Sub
    Private Sub btnEditAccount_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles btnEditAccount.LinkClicked

        editAccount(viewList(AccountGrid.SelectedRows(0).Index).index)
       
    End Sub

    Private Sub btnAddAccount_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles btnAddAccount.LinkClicked

        Dim count As Short = 0

        For Each account In accountlist
            If account.deleted = False Then
                count += 1
            End If
        Next

        ' Check registration. If the program is not registered, limit it to only one account.
        If systemSettings.app_settings.isRegistered Or count = 0 Then
            Try
                Me.Enabled = False
                Dim newAcctForm As New frmUserAcct

                Dim newAccount As newAccount = newAcctForm.ShowDialog()

                If newAccount IsNot Nothing Then
                    If Not (newAccount.userAccountName Is Nothing) Then
                        accountlist.Add(New NewAccounts(newAccount, True))
                        changesMade = True
                    End If
                End If
                Me.Enabled = True

                showAccounts()
            Catch ex As Exception
                RaiseEvent errorMessage("Add acount failed", 1, "frmSettings:btnAddAccount", ex.Message)
                Me.Enabled = True
                showAccounts()
            End Try
        Else

            MessageBox.Show("If you would like to add more accounts, please register the program.", "Scott's Email Notifier", MessageBoxButtons.OK, MessageBoxIcon.Information)

        End If

    End Sub

#Region "     select tab    "

    Private Sub LinkLabel6_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel6.LinkClicked
        TabControl1.SelectedTab = TabPage1
    End Sub
    Private Sub LinkLabel7_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel7.LinkClicked
        TabControl1.SelectedTab = TabPage2
    End Sub
    Private Sub LinkLabel8_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel8.LinkClicked
        TabControl1.SelectedTab = TabPage3
    End Sub
    Private Sub LinkLabel9_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel9.LinkClicked
        TabControl1.SelectedTab = TabPage4
        populateSoundGrid()
    End Sub
    Private Sub LinkLabel10_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel10.LinkClicked

        clearOpenItems()

        TabControl1.SelectedTab = TabPage5

    End Sub

    Private Sub clearOpenItems()

        openFor.Items.Clear()
        Dim counter As Short = 0
        Dim selectedIndex As Short = 0

        openFor.Items.Add("First Account with unread")
        openFor.Items.Add("Account with most unread")

        For Each account In accountlist

            If account.deleted = False Then
                If Not account.isCal Then
                    If account.updated Then
                        openFor.Items.Add(account.ChangedAccount.userAccountName)
                        If systemSettings.app_settings.advanced.getTrayClientToOpen = account.ChangedAccount.userAccountName Then
                            selectedIndex = counter
                        End If
                    Else
                        openFor.Items.Add(account.ExistingAccount.userAccountName)
                        If systemSettings.app_settings.advanced.getTrayClientToOpen = account.ExistingAccount.userAccountName Then
                            selectedIndex = counter
                        End If
                    End If
                End If

            End If
            counter += 1
        Next

        openFor.SelectedIndex = selectedIndex

    End Sub
    Private Sub LinkLabel11_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel11.LinkClicked
        TabControl1.SelectedTab = TabPage6
    End Sub
    Private Sub LinkLabel12_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel12.LinkClicked
        drawRegTab()
        TabControl1.SelectedTab = TabPage7
    End Sub
    Private Sub LinkLabel13_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel13.LinkClicked
        TabControl1.SelectedTab = TabPage8
    End Sub

#End Region

#End Region

#Region "    private methods    "

    Private Sub populateSoundGrid()

        soundGrid.Rows.Clear()

        For Each sound In systemSettings.app_settings.soundSettings.soundList

            soundGrid.Rows.Add(Nothing, sound.description)


        Next



    End Sub
    ' Show the account data on the settings first tab
    Private Sub showAccounts(Optional selectedIndex As Short = -1)
        Try

            viewList.Clear()

            ' Clear the grid rows
            AccountGrid.Rows.Clear()
            ' Suspend the layout update
            AccountGrid.SuspendLayout()

            Dim index As Short = 0

            ' Loop through each account
            For Each account In accountlist
                ' Setup the string to hold the text for the row
                Dim serviceType As String = String.Empty
                Dim emailString As String = String.Empty

                If account.deleted = False Then
                    If account.updated = False Then
                        If account.ExistingAccount.serviceType IsNot Nothing Then
                            serviceType = account.ExistingAccount.serviceType.ToUpper
                        End If
                        emailString = account.ExistingAccount.userAccountName & " (" & serviceType & ")" & Environment.NewLine & _
                                                    account.ExistingAccount.userAccountEmail & " (" & account.ExistingAccount.userServerAddress & ")"

                    Else
                        If account.ChangedAccount.serviceType IsNot Nothing Then
                            serviceType = account.ChangedAccount.serviceType.ToUpper
                        End If
                        emailString = account.ChangedAccount.userAccountName & " (" & serviceType & ")" & Environment.NewLine & _
                                                    account.ChangedAccount.userAccountEmail & " (" & account.ChangedAccount.userServerAddress & ")"

                    End If

                    If account.isCal = False Then
                        If account.hasErrors Then
                            ' Set the row data using the emailstring
                            AccountGrid.Rows.Add(My.Resources.errorIcon, emailString)
                            viewList.Add(New myViewList(emailString, index))

                        Else
                            ' Set the row data using the emailstring
                            AccountGrid.Rows.Add(My.Resources.logoEnvelope, emailString)
                            viewList.Add(New myViewList(emailString, index))

                        End If
                    Else

                        ' Set the row data using the emailstring
                        AccountGrid.Rows.Add(My.Resources.cal, emailString)
                        viewList.Add(New myViewList(emailString, index))

                    End If


                End If

                index += 1
            Next

            If AccountGrid.RowCount = 0 Then
                btnEditAccount.Enabled = False
                btnRemoveAccount.Enabled = False

            Else
                btnEditAccount.Enabled = True
                btnRemoveAccount.Enabled = True
                If selectedIndex > -1 Then
                    AccountGrid.Rows(selectedIndex).Selected = True
                End If
            End If

            AccountGrid.Enabled = True

            If AccountGrid.RowCount = 0 Then

                AccountGrid.Rows.Add(My.Resources.help, "Click 'Add new account' to add an account and begin checking for email.")
                AccountGrid.Enabled = False

            End If

            ' Resume layout update
            AccountGrid.ResumeLayout()
            ' Update the layout
            AccountGrid.Update()
        Catch ex As Exception
            RaiseEvent errorMessage("Account population controller failed", 1, "frmSettings:showAccounts", ex.Message)
        End Try
    End Sub

    Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtRegCode.TextChanged

        systemSettings.app_settings.setUserCode(txtRegCode.Text.Trim)

        drawRegTab()

    End Sub

    Private Sub linkUnreg_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles linkUnreg.LinkClicked

        systemSettings.app_settings.setUserCode(Nothing)

        drawRegTab()

    End Sub

    Private Sub frmSettings_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown

        Btn_Cancel.Location = New Point(Me.Width - (Btn_Cancel.Width + Btn_OK.Width + 25), 11)
        Btn_OK.Location = New Point(Me.Width - (Btn_OK.Width + 15), 11)
    End Sub

    Private Sub CheckBox2_CheckedChanged() Handles startWithWindows.MouseClick

        Dim startInfo As ProcessStartInfo = New ProcessStartInfo()
        startInfo.UseShellExecute = True
        startInfo.WorkingDirectory = My.Application.Info.DirectoryPath
        startInfo.FileName = My.Application.Info.DirectoryPath & "\registry.exe"

        If startWithWindows.Checked Then

            startInfo.Arguments = "1"

        Else

            startInfo.Arguments = "2"

        End If

        Dim p As Process = Process.Start(startInfo)

    End Sub

    Private Sub defaultHandlerCheck() Handles defaultHandler.MouseClick

        Dim startInfo As ProcessStartInfo = New ProcessStartInfo()
        startInfo.UseShellExecute = True
        startInfo.WorkingDirectory = My.Application.Info.DirectoryPath
        startInfo.FileName = My.Application.Info.DirectoryPath & "\registry.exe"

        If defaultHandler.Checked Then

            startInfo.Arguments = "3"

        Else

            startInfo.Arguments = "4"

        End If

        Dim p As Process = Process.Start(startInfo)

    End Sub

    Private Sub RadioButtonchanged(sender As System.Object, e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged

        If RadioButton1.Checked Then
            growlHost.Enabled = False
            growlPass.Enabled = False
            growlPassReq.Enabled = False
            growlPort.Enabled = False
            growlRemoteSess.Enabled = False
            growlPassReq.Checked = False
            growlRemoteSess.Checked = False
            SplitContainer26.Panel2Collapsed = True
            SplitContainer26.Size = New Point(330, 90)
            GroupBox7.Size = New Point(368, SplitContainer26.Size.Height + 20)
            GroupBox14.Size = New Point(368, GroupBox14.Height)
            GroupBox6.Size = New Point(368, GroupBox6.Height)
        Else
            growlPassReq.Enabled = True
            SplitContainer26.Panel2Collapsed = False
            SplitContainer26.Size = New Point(330, 225)
            GroupBox7.Size = New Point(351, SplitContainer26.Size.Height + 20)
            GroupBox14.Size = New Point(351, GroupBox14.Height)
            GroupBox6.Size = New Point(351, GroupBox6.Height)
            SplitContainer26.SplitterDistance = 80
        End If

    End Sub

    Private Sub growlPassReq_EnabledChanged(sender As Object, e As System.EventArgs) Handles growlPassReq.EnabledChanged, growlPassReq.CheckedChanged

        If growlPassReq.Checked Then
            growlRemoteSess.Enabled = True
            growlPass.Enabled = True
        Else
            growlHost.Enabled = False
            growlPass.Enabled = False
            growlRemoteSess.Enabled = False
            growlRemoteSess.Checked = False
        End If
    End Sub

    Private Sub growlRemoteSess_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles growlRemoteSess.CheckedChanged, growlRemoteSess.EnabledChanged

        If growlRemoteSess.Checked And growlRemoteSess.Enabled Then

            growlPort.Enabled = True
            growlHost.Enabled = True
        Else
            growlPort.Enabled = False
            growlHost.Enabled = False
        End If

    End Sub

    Private Sub chkSettingsPass_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkSettingsPass.CheckedChanged
        txtSettingsPass.Enabled = chkSettingsPass.Checked
    End Sub

    Private Sub LinkLabel3_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked
        loadSchedules()
        TabControl1.SelectedTab = TabPage9
    End Sub

    Private Sub LinkLabel4_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel4.LinkClicked
        TabControl1.SelectedTab = TabPage10

        Label30.Text = systemSettings.getAccountSettingsFileName
        If File.Exists(systemSettings.getSettingsDirectory & "\" & systemSettings.getAccountSettingsFileName) = False Then
            Label30.Text += " (Not Found)"
        End If

        LinkLabel32.Text = systemSettings.getSettingsDirectory
    End Sub

    Private Sub LinkLabel32_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles addSchedule.LinkClicked
        Me.Enabled = False
        Dim newScheduleFrm As New frmSchedule
        Dim newSchedule As schedule = newScheduleFrm.ShowDialog()
        If newSchedule IsNot Nothing Then
            scheduleList.Add(newSchedule)
            loadSchedules()
        End If
        Me.Enabled = True
    End Sub

    Private Sub loadSchedules()

        ScheduleGrid.Rows.Clear()

        ScheduleGrid.SuspendLayout()

        For Each item In scheduleList

            Dim dayString As String = String.Empty

            If item.monday Then
                dayString += "Mon, "
            End If
            If item.tuesday Then
                dayString += "Tues, "
            End If
            If item.wednesday Then
                dayString += "Wed, "
            End If
            If item.thursday Then
                dayString += "Thurs, "
            End If
            If item.friday Then
                dayString += "Fri, "
            End If
            If item.saturday Then
                dayString += "Sat, "
            End If
            If item.sunday Then
                dayString += "Sun "
            End If

            dayString = dayString.Trim(" ")
            dayString = dayString.Trim(",")

            dayString += " - " & item.startTime.ToString("h:mm tt") & " to " & item.endTime.ToString("h:mm tt")

            Dim eventString As String = String.Empty

            If item.dontCheck Then
                eventString += "Don't check for new email, "
            End If
            If item.dontAlert Then
                eventString += "Don't show alerts, "
            End If
            If item.noSound Then
                eventString += "Disable sound alerts"
            End If

            eventString = eventString.Trim(" ")
            eventString = eventString.Trim(",")

            ScheduleGrid.Rows.Add(My.Resources.schedule, dayString & Environment.NewLine & eventString)
        Next

        ScheduleGrid.Enabled = True

        If scheduleList.Count = 0 Then

            ScheduleGrid.Rows.Add(My.Resources.help, "Click 'Add new entry' to create a new schedule.")
            ScheduleGrid.Enabled = False

            addSchedule.Enabled = True
            editSchedule.Enabled = False
            deleteSchedule.Enabled = False
        ElseIf scheduleList.Count > 9 Then
            addSchedule.Enabled = False
        Else
            addSchedule.Enabled = True
            editSchedule.Enabled = True
            deleteSchedule.Enabled = True
        End If

        ScheduleGrid.ResumeLayout()
        ScheduleGrid.Refresh()

    End Sub
    Private Sub deleteSchedule_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles deleteSchedule.LinkClicked
        If ScheduleGrid.SelectedRows.Count > 0 Then
            Dim index As Short = ScheduleGrid.SelectedRows(0).Index
            scheduleList.RemoveAt(index)
            loadSchedules()
        End If
    End Sub

    Private Sub editSchedule_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles editSchedule.LinkClicked
        If ScheduleGrid.SelectedRows.Count > 0 Then
            Dim index As Short = ScheduleGrid.SelectedRows(0).Index
            Dim newScheduleFrm As New frmSchedule
            Dim newSchdeule As New schedule
            newSchdeule = newScheduleFrm.ShowDialog(scheduleList(index))

            If newSchdeule IsNot Nothing Then
                scheduleList.RemoveAt(index)
                scheduleList.Insert(index, newSchdeule)
                loadSchedules()
            End If
        End If
    End Sub

    Private Sub LinkLabel32_LinkClicked_1(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel32.LinkClicked

        Process.Start(LinkLabel32.Text)

    End Sub
    Private Sub chkProxyAuth_EnabledChanged(sender As Object, e As System.EventArgs) Handles chkProxyAuth.EnabledChanged
        If chkProxyAuth.Enabled = True Then
            proxyDomain.Enabled = chkProxyAuth.Checked
            proxyPassword.Enabled = chkProxyAuth.Checked
            proxyUserName.Enabled = chkProxyAuth.Checked
        Else
            proxyDomain.Enabled = False
            proxyPassword.Enabled = False
            proxyUserName.Enabled = False
        End If
    End Sub

    Private Sub LinkLabel36_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel36.LinkClicked
        TabControl1.SelectedTab = TabPage11
    End Sub
#End Region

#Region "    public sub "
    Public Sub drawRegTab()

       
    End Sub
    Public Sub showTab(tab As tabs)

        Select Case tab
            Case tabs.contacts
                TabControl1.SelectedTab = TabPage11
            Case tabs.data
                TabControl1.SelectedTab = TabPage10
        End Select

    End Sub
#End Region

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        If MessageBox.Show("Are you sure?", "Delete file", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
            Dim fileName As String = systemSettings.getSettingsDirectory & "\" & systemSettings.getAccountSettingsFileName
            If File.Exists(fileName) Then
                File.Delete(fileName)
                accountlist.Clear()
                RaiseEvent deleteAccounts()
                showAccounts()

                scheduleList.Clear()
                loadSchedules()

                systemSettings = New objSystem
                loadSettings()

                MessageBox.Show("The settings have been reset.", "Complete", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End If
        End If
    End Sub

    Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click

        Dim newFileDialog As New OpenFileDialog
        newFileDialog.InitialDirectory = Environment.GetFolderPath(SpecialFolder.DesktopDirectory)
        newFileDialog.FileName = "Scotts Email Alert Settings.pSEA"
        newFileDialog.Filter = "Scotts Email Alert File | *.pSEA"

        If newFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
            RaiseEvent ImportSettings(newFileDialog.FileName, tabs.data)
            Me.Close()
        End If

    End Sub

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click

        Dim newFileDialog As New SaveFileDialog
        newFileDialog.InitialDirectory = Environment.GetFolderPath(SpecialFolder.DesktopDirectory)
        newFileDialog.FileName = "Scotts Email Alert Settings.pSEA"
        newFileDialog.Filter = "Scotts Email Alert File | *.pSEA"

        If newFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then

            RaiseEvent ExportSettings(newFileDialog.FileName)

        End If

    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Dim newFileDialog As New OpenFileDialog
        newFileDialog.InitialDirectory = Environment.GetFolderPath(SpecialFolder.DesktopDirectory)
        newFileDialog.FileName = "User_Settings.xml"
        newFileDialog.Filter = "Scotts Gmail Alert File | *.xml"

        If newFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then

            RaiseEvent load_SGA_Settings(newFileDialog.FileName)

        End If
    End Sub

    Private Sub EditSound() Handles soundGrid.CellDoubleClick, LinkLabel33.LinkClicked

        If soundGrid.SelectedRows.Count > 0 Then
            Dim index As Short = soundGrid.SelectedRows(0).Index

            Me.Enabled = False
            Dim newSoundFrm As New frmSoundSettings
            Dim newSound As Sounds = newSoundFrm.ShowDialog(systemSettings.app_settings.soundSettings.soundList(index))

            systemSettings.app_settings.soundSettings.soundList(index) = newSound

            Me.Enabled = True

        End If

    End Sub

    Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click

        RaiseEvent showProgramMessages()
    End Sub

    Private Sub LinkLabel34_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel34.LinkClicked

        Dim calForm As New newCalFrm

        ' Check registration. If the program is not registered, limit it to only one account.
        If systemSettings.app_settings.isRegistered Then
            Try
                Me.Enabled = False
                Dim newAccount As newAccount = calForm.showDialog()

                If newAccount IsNot Nothing Then
                    If Not (newAccount.userAccountName Is Nothing) Then
                        accountlist.Add(New NewAccounts(newAccount, True))
                        changesMade = True
                    End If
                End If
                Me.Enabled = True

                showAccounts()
            Catch ex As Exception
                RaiseEvent errorMessage("Add cal account failed", 1, "frmSettings:btnAddCalAccount", ex.Message)
                Me.Enabled = True
                showAccounts()
            End Try
        Else

            MessageBox.Show("If you would like to add more accounts, please register the program.", "Scott's Email Notifier", MessageBoxButtons.OK, MessageBoxIcon.Information)

        End If

    End Sub

    Private Sub enableLeftClick_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles enableLeftClick.CheckedChanged

        RadioButton4.Enabled = enableLeftClick.Checked
        openFor.Enabled = enableLeftClick.Checked
        TrayredisplayClick.Enabled = enableLeftClick.Checked

    End Sub
    Private Sub AccountGrid_CellContentDoubleClick(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles AccountGrid.CellContentDoubleClick

        editAccount(e.RowIndex)

    End Sub

    Private Sub editAccount(ByVal selection As Short)

        Me.Enabled = False
        Try
            Dim newAcctForm As New frmUserAcct
            Dim calForm As New newCalFrm

            Dim account As New newAccount
            Dim index As Integer = selection
            account = accountlist(index).ExistingAccount

            If accountlist(index).updated = True Then
                account = accountlist(index).ChangedAccount
            End If

            Dim newAccount As New newAccount

            If accountlist(index).isCal = False Then
                newAccount = newAcctForm.ShowDialog(account)
            Else
                newAccount = calForm.showDialog(account)
            End If

            If newAccount IsNot Nothing Then
                If Not (newAccount.userAccountName = Nothing) Then

                    accountlist(index).ChangedAccount = newAccount
                    accountlist(index).updated = True

                    changesMade = True
                End If
            End If
            Me.Enabled = True
            showAccounts(index)
        Catch ex As Exception
            RaiseEvent errorMessage("Edit account failed", 1, "frmSettings:btnEdit", ex.Message)
            Me.Enabled = True
            showAccounts()
        End Try

    End Sub

    Private Sub Button6_Click(sender As System.Object, e As System.EventArgs)

        systemSettings.app_settings.miniClient.windowLocation = New Point(0, 0)

    End Sub

    Public Sub New()

        ' This call is required by the designer.
        Dim ts = New TimeSpan(Now.Ticks)
        InitializeComponent()

        Dim newts As New TimeSpan(Now.Ticks - ts.Ticks)
        MessageBox.Show(newts.TotalSeconds)


        ' Add any initialization after the InitializeComponent() call.

    End Sub
End Class

Public Class NewAccounts

    Public ExistingAccount As newAccount
    Public ChangedAccount As newAccount

    Public existing As Boolean = False
    Public updated As Boolean = False
    Public deleted As Boolean = False

    Public hasErrors As Boolean = False
    Public invalidCredentials As Boolean = False
    Public errorCode As String = String.Empty
    Public isCal As Boolean = False

    Sub New(account As newAccount)

        ExistingAccount = account
        existing = True

        If ExistingAccount.serviceType = "cal" Then
            isCal = True
        End If

        If account.miscError Or account.invalidCredentials Then
            hasErrors = True
            errorCode = account.errorString
            invalidCredentials = account.invalidCredentials
        End If

    End Sub

    Sub New(account As newAccount, newaccount As Boolean)

        If newaccount = False Then
            ExistingAccount = account
            existing = True
        Else
            ChangedAccount = account
            existing = False
            updated = True

        End If

        If account.serviceType = "cal" Then
            isCal = True
        End If

        If account.miscError Or account.invalidCredentials Then
            hasErrors = True
            errorCode = account.errorString
            invalidCredentials = account.invalidCredentials
        End If
    End Sub

End Class

Public Class myViewList

    Public viewString As String
    Public index As Short

    Sub New(viewString As String, index As Short)

        Me.viewString = viewString
        Me.index = index

    End Sub
End Class

Public Enum tabs

    accounts
    alerts
    connect
    sounds
    advanced
    security
    register
    credits
    scheduling
    data
    contacts

End Enum



Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3371
  • View blog
  • Posts: 11,420
  • Joined: 12-December 12

Re: Initialization causes unresponsiveness and high memory

Posted 30 August 2013 - 02:05 PM

Are you running this in Debug mode?
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3371
  • View blog
  • Posts: 11,420
  • Joined: 12-December 12

Re: Initialization causes unresponsiveness and high memory

Posted 30 August 2013 - 02:12 PM

BTW Having variables named settingsOpen and openSettings is v.likely to trip you up at some point :)
Was This Post Helpful? 0
  • +
  • -

#5 vbnet9  Icon User is offline

  • D.I.C Regular

Reputation: 12
  • View blog
  • Posts: 346
  • Joined: 26-May 09

Re: Initialization causes unresponsiveness and high memory

Posted 30 August 2013 - 02:39 PM

View Postandrewsw, on 30 August 2013 - 05:12 PM, said:

BTW Having variables named settingsOpen and openSettings is v.likely to trip you up at some point :)/>



Yes, I know. I have been working on this for years because I just don't have time to really do much at a time. So things are ending up being rather inconsistent. I am kind of at a point of just chasing bugs.

OpenSettings is from an event saying the settings should be opened because there was a trigger of some sort. SettingsOpen is saying that the form is open or closed.

Let me run in debug and see if anything changes. I was originally in debug but switched to release and redid all the references.

Okay, yes its the same in debug.
Was This Post Helpful? 0
  • +
  • -

#6 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3371
  • View blog
  • Posts: 11,420
  • Joined: 12-December 12

Re: Initialization causes unresponsiveness and high memory

Posted 30 August 2013 - 03:03 PM

There is a lot going on when your form is opened:

  • Do you not have a suspicion about what may be causing the delay?
  • Can you selectively disable features, to help track down a bottleneck?

There are profiling tools. I haven't used them but:

Process Monitor
slimtune

I am slightly surprised, though, that you that you have not encountered the delay as you built and tested your application(?).

This post has been edited by andrewsw: 30 August 2013 - 03:05 PM

Was This Post Helpful? 0
  • +
  • -

#7 vbnet9  Icon User is offline

  • D.I.C Regular

Reputation: 12
  • View blog
  • Posts: 346
  • Joined: 26-May 09

Re: Initialization causes unresponsiveness and high memory

Posted 30 August 2013 - 04:20 PM

The application did not have this problem but I have noticed it lately. With how infrequently I work on this I can't pin point it to code changes etc.

I comented out all the code within each routine and function, and all the variables. This is the result:

all code enabled
2.4611407 seconds first opening
0.0940045 seconds second opening

all code commented out
2.5251444 seconds first opening

So none of the code within the form is the problem. I am certain that it is this form as I noticed it initialized when the program started initially when it didn't need to and the program started up a lot faster after i removed the unnecessary init. Now it is only slow when first trying to open this form.

Nothing after opening the form in the other code is run to cause this form to slow down. Could it be a messed up design file for the form?

I am really kind of stumped with this.

This post has been edited by vbnet9: 30 August 2013 - 04:24 PM

Was This Post Helpful? 0
  • +
  • -

#8 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3371
  • View blog
  • Posts: 11,420
  • Joined: 12-December 12

Re: Initialization causes unresponsiveness and high memory

Posted 30 August 2013 - 05:44 PM

View Postvbnet9, on 30 August 2013 - 11:20 PM, said:

Nothing after opening the form in the other code is run to cause this form to slow down. Could it be a messed up design file for the form?

I am really kind of stumped with this.

Sorry, I can't advise further, other than to do some detailed debugging and perhaps look into the profiling tools I mentioned (or others).

If it were a problem with the design-file then I would consider deleting the bin and object files to force a clean rebuild (there is a command-line MSBuild tool to do this), perhaps even importing into a new solution. Disclaimer: This is just a passing comment - don't proceed on these details alone.

This post has been edited by andrewsw: 30 August 2013 - 05:50 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1