コード例 #1
0
        public EventInstanceEditor(EventDataWrapper eventData)
        {
            _eventData = eventData;

            InitializeComponent();
            FormBorderStyle = FormBorderStyle.FixedSingle;

            _nameTextbox.Text = eventData.Name;
            _deltaTextbox.Text = eventData.Delta.ToString();

            //Create setting controls
            int count = 0;
            foreach (MetadataField metadataField in _eventData.EventDefinition.MetadataFields)
            {
                MetadataFieldEditor control = new MetadataFieldEditor(metadataField.Name, _eventData.MetadataValues[count]);
                _metadataFileEditor.Add(control);
                _panel.Controls.Add(control);
                count++;
            }

            if (_metadataFileEditor.Count > 0)
            {
                _metadataFileEditor[0].Location = new Point(0 + 16, 0 + 2);
                for (int i = 1; i < _metadataFileEditor.Count; i++)
                {
                    _metadataFileEditor[i].Location = new Point(0 + 16, _metadataFileEditor[i - 1].Bottom + 2);
                }
            }
        }
コード例 #2
0
ファイル: EventsEditor.cs プロジェクト: altliu/sandbox-aliu
        private void _newButton_Click(object sender, EventArgs e)
        {
            EventDataWrapper eventData = new EventDataWrapper(EventDefinitionManager.EventDefinition);

            using (EventInstanceEditor instanceEditor = new EventInstanceEditor(eventData))
            {
                instanceEditor.ShowInTaskbar = false;
                instanceEditor.MaximizeBox = false;
                instanceEditor.MinimizeBox = false;

                instanceEditor.StartPosition = FormStartPosition.CenterParent;
                if (instanceEditor.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                EventDataWrapper instance = instanceEditor.Event;
                instance.Active = true;
                EventManager.EventDatabase.EventDataWrappers.Add(instance);
                _activeListbox.Items.Add(instance);
                EventManager.SaveManager();
            }
        }