Exemple #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            m_NewListInEditMode.UserAssignedGroupName = textBoxName.Text;
            m_NewListInEditMode.AlertThreshold        = Convert.ToInt32(textBoxAlertMatchThreshold.Text);

            // are there duplicates of this name?
            if (!m_EditingExisting)
            {
                if (WatchTools.NameIsADuplicate(m_NewListInEditMode))
                {
                    MessageBox.Show("ERROR the user assigned name: " + m_NewListInEditMode.UserAssignedGroupName + " is a duplicate of an existing name");
                    return;
                }
            }

            // is the watch list loaded ?
            if (!m_NewListInEditMode.WatchListLoaded)
            {
                MessageBox.Show("Error Watchlist is not loaded");
                return;
            }

            m_SaveInProcess = true;
            listBoxCurrentlyLoadedWatchLists.Enabled = false;

            m_AppData.LPRServiceControl.ConfigChangedServiceNeedsRestarting = true;

            if (!m_EditingExisting)
            {
                // add new item
                WatchTools.AddItem(m_NewListInEditMode); // this includes a save to user config file
            }
            else
            {
                // modify existing item

                WatchTools.RemoveItem(m_OriginalBeforeEdits.UserAssignedGroupName);
                WatchTools.AddItem(m_NewListInEditMode);// this includes a save to user config file
            }


            listBoxCurrentlyLoadedWatchLists.Items.Clear();

            LoadTable();// re-load the master list into the listbox

            m_NewListInEditMode = null;

            ClearBoxes();

            labelListStatus.Text = "List Saved";
            DisableBoxes();
            m_EditingExisting = false;
            listBoxCurrentlyLoadedWatchLists.Enabled = true;
            m_SaveInProcess = false;
        }