Esempio n. 1
0
        private void editWatchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // get the selected Watch
            var lvi           = lvWatches.SelectedItems[0];
            var selectedWatch = (Watch)lvi.Tag;
            var watchForm     = new WatchForm(selectedWatch);

            if (vm.Labels.Count != 0)
            {
                watchForm.InitializeLabels(vm.Labels);
            }

            watchForm.StartPosition = FormStartPosition.CenterParent;
            watchForm.Text          = "Edit Watch";
            var result = watchForm.ShowDialog(lvWatches);

            if (result != DialogResult.OK)
            {
                return;
            }

            UpdateListViewItemWithWatch(lvi);
        }
Esempio n. 2
0
        private void addWatchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var watchForm = new WatchForm();

            if (vm.Labels.Count != 0)
            {
                watchForm.InitializeLabels(vm.Labels);
            }

            watchForm.StartPosition = FormStartPosition.CenterParent;
            watchForm.Text          = "Create Watch";
            var result = watchForm.ShowDialog(lvWatches);

            if (result != DialogResult.OK)
            {
                return;
            }

            // add a new watch
            Watches.Add(watchForm.Watch);
            AddWatchToListView(watchForm.Watch);

            UpdateWatchValues();
        }