예제 #1
0
 private void buttonCancelChanges_Click(object sender, EventArgs e)
 {
     ClearBoxes();
     m_NewListInEditMode = null;
     m_EditingExisting = false;
     DisableBoxes();
     labelListStatus.Text = "Canceled Edit";
 }
예제 #2
0
        private void buttonDeleteSelected_Click(object sender, EventArgs e)
        {
            string name = (string)listBoxCurrentlyLoadedWatchLists.SelectedItem;

            WatchTools.RemoveItem(name);

            listBoxCurrentlyLoadedWatchLists.Items.Clear();
            LoadTable();

            ClearBoxes();
            m_NewListInEditMode = null;
            m_EditingExisting = false;
            DisableBoxes();
            labelListStatus.Text = "Deleted Selected Watch List";
        }
예제 #3
0
        private void buttonAddNew_Click(object sender, EventArgs e)
        {
            if (m_EditingExisting)
            {
                MessageBox.Show("Edit in progress, either save changes or cancel changes before adding new");
                return;
            }

            int index = WatchTools.GetNextIndex();
            m_NewListInEditMode = new WatchLists.WatchListControl(index);
            textBoxName.Text = m_NewListInEditMode.UserAssignedGroupName = "New List";
            labelListStatus.Text = "Editing New List";
            ClearBoxes();
            EnableBoxes();
        }
예제 #4
0
 public bool NameIsADuplicate(WatchLists.WatchListControl newListInEditMode)
 {
     try
     {
         foreach (WatchLists.WatchListControl list in m_WatchLists)
         {
             if (list.UserAssignedGroupName.Equals(newListInEditMode.UserAssignedGroupName))
             {
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL);
         return(false);
     }
 }
예제 #5
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;
        }
예제 #6
0
        private void listBoxCurrentlyLoadedWatchLists_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (m_SaveInProcess) return;

            ClearBoxes();
            m_NewListInEditMode = new WatchLists.WatchListControl();

            m_NewListInEditMode.UserAssignedGroupName = (string)listBoxCurrentlyLoadedWatchLists.SelectedItem;
            WatchTools.GetListFromUserConfig( m_NewListInEditMode.UserAssignedGroupName, m_NewListInEditMode);

            textBoxAlertMatchThreshold.Text = m_NewListInEditMode.AlertThreshold.ToString();
            textBoxEmailListFile.Text = m_NewListInEditMode.EmailFileCompletePath;
            textBoxListCount.Text = WatchTools.loadList(m_NewListInEditMode).ToString();
            textBoxName.Text = m_NewListInEditMode.UserAssignedGroupName;
            textBoxWatchListFile.Text = m_NewListInEditMode.DataFileCompletePath;

            m_OriginalBeforeEdits = m_NewListInEditMode.Clone();

            EnableBoxes();
            labelListStatus.Text = "Editing List";
            m_EditingExisting = true;
        }