示例#1
0
        private void lvwMonitorItems_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            ListViewItem             changedItem = lvwMonitorItems.Items[e.Index];
            MonitorConfigurationItem mci         = changedItem.Tag as MonitorConfigurationItem;
            bool ischecked = e.NewValue == CheckState.Checked;

            mci.Active = ischecked;
        }
示例#2
0
        private ListViewItem BuildItem(MonitorConfigurationItem mci)
        {
            ListViewItem result = new ListViewItem(new String[] { mci.Title, mci.MonitorPath, mci.Filter });

            result.Checked = mci.Active;
            result.Tag     = mci;
            return(result);
        }
示例#3
0
        private void RefreshItem(ListViewItem refreshit)
        {
            MonitorConfigurationItem mci = (MonitorConfigurationItem)refreshit.Tag;

            refreshit.Text             = mci.Title;
            refreshit.SubItems[0].Text = mci.MonitorPath;
            refreshit.SubItems[1].Text = mci.Filter;
            refreshit.Checked          = mci.Active;
        }
示例#4
0
 private void tsRemove_Click(object sender, EventArgs e)
 {
     if (lvwMonitorItems.SelectedItems.Count > 0)
     {
         ListViewItem             selecteditem = lvwMonitorItems.SelectedItems[0];
         MonitorConfigurationItem mci          = selecteditem.Tag as MonitorConfigurationItem;
         if (MessageBox.Show("Are you sure you want to remove the item " + mci.Title + "?", "Confirm Remove", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             lvwMonitorItems.Items.Remove(selecteditem);
         }
     }
 }
示例#5
0
 private void tsEdit_Click(object sender, EventArgs e)
 {
     if (lvwMonitorItems.SelectedItems.Count > 0)
     {
         ListViewItem             selecteditem = lvwMonitorItems.SelectedItems[0];
         MonitorConfigurationItem mci          = selecteditem.Tag as MonitorConfigurationItem;
         if (EditMonitorItem.EditItem(this, mci))
         {
             RefreshItem(selecteditem);
         }
     }
 }
示例#6
0
        private void cmdApply_Click(object sender, EventArgs e)
        {
            var grabitems = config.GetItems();

            grabitems.Clear();
            foreach (ListViewItem lvi in lvwMonitorItems.Items)
            {
                MonitorConfigurationItem mci = lvi.Tag as MonitorConfigurationItem;
                grabitems.Add(mci);
            }
            config.Save();
            RestartMonitor();
        }
示例#7
0
        private void tsNewItem_Click(object sender, EventArgs e)
        {
            MonitorConfigurationItem mci     = new MonitorConfigurationItem();
            ListViewItem             newitem = BuildItem(mci);

            lvwMonitorItems.Items.Add(newitem);
            if (EditMonitorItem.EditItem(this, mci))
            {
                RefreshItem(newitem);
            }
            else
            {
                lvwMonitorItems.Items.Remove(newitem);
            }
        }
示例#8
0
        private void LoadItems(XDocument docSource)
        {
            ConfigurationElements = new List <MonitorConfigurationItem>();
            XElement RootNode = docSource.Root;

            if (RootNode == null)
            {
                return;
            }


            foreach (XElement MonitorItem in RootNode.Descendants("MonitorItem"))
            {
                MonitorConfigurationItem mci = new MonitorConfigurationItem(MonitorItem);
                ConfigurationElements.Add(mci);
            }
        }
        public static bool EditItem(IWin32Window owner, MonitorConfigurationItem mciitem)
        {
            EditMonitorItem dlgUse = new EditMonitorItem(mciitem);

            return(dlgUse.ShowDialog(owner) == System.Windows.Forms.DialogResult.OK);
        }
        public EditMonitorItem(MonitorConfigurationItem itemedit)
        {
            mci = itemedit;

            InitializeComponent();
        }