예제 #1
0
        private void AddLayerButton_Click(object sender, EventArgs e)
        {
            var moduleDialog = new ModulesListWindow();

            moduleDialog.StartPosition = FormStartPosition.CenterParent;
            if (moduleDialog.ShowDialog() == DialogResult.Cancel || moduleDialog.SelectedModule == null)
            {
                return;
            }
            var module = moduleDialog.SelectedModule;

            LayerSettings settings = new LayerSettings();

            settings.LayerId    = _lastId;
            settings.Module     = module.File;
            settings.Dimensions = new LayerDimensions()
            {
                AbsoluteValues = false,
                MarginValues   = false,
                XValue         = 0,
                YValue         = 0,
                WValue         = 100,
                ZValue         = 100
            };

            var newItem = new ListViewItem()
            {
                Text = module.Name,
                Tag  = (module, settings)
            };

            newItem.SubItems.Add(_lastId.ToString());
            newItem.SubItems.Add(settings.Name);
            newItem.SubItems.Add(settings.Description);
            newItem.SubItems.Add(settings.Dimensions.MonitorName);
            newItem.SubItems.Add(settings.Enabled.ToString());


            LayerSettingsWindow window = new LayerSettingsWindow(settings, module);

            if (window.ShowDialog() == DialogResult.OK)
            {
                newItem.SubItems[2].Text = settings.Name;
                newItem.SubItems[3].Text = settings.Description;
                newItem.SubItems[4].Text = settings.Dimensions.MonitorName;
                newItem.SubItems[5].Text = settings.Enabled.ToString();
            }
            else
            {
                return;
            }

            LayerListView.Items.Add(newItem);
            _lastId = FindNextLayerId();

            LayoutChanged = true;
        }
예제 #2
0
        private void LayerOptionsButton_Click(object sender, EventArgs e)
        {
            if (LayerListView.SelectedItems.Count == 0)
            {
                return;
            }
            var selectedItem           = LayerListView.SelectedItems[0];
            var tuple                  = ((Module, LayerSettings))selectedItem.Tag;
            var settings               = tuple.Item2;
            LayerSettingsWindow window = new LayerSettingsWindow(tuple.Item2, tuple.Item1);

            if (window.ShowDialog() == DialogResult.OK)
            {
                selectedItem.SubItems[2].Text = settings.Name;
                selectedItem.SubItems[3].Text = settings.Description;
                selectedItem.SubItems[4].Text = settings.Dimensions.MonitorName;
                selectedItem.SubItems[5].Text = settings.Enabled.ToString();
            }

            LayoutChanged = true;
        }