internal void EditItem()
        {
            if (tlsDecoders.Selection.Count <= 0)
            {
                MessageBox.Show("No items selected.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            TreeListNode node = tlsDecoders.Selection[0];

            if (node == null)
            {
                return;
            }

            if (node.Tag is AccessoryDecoder)
            {
                AccessoryDecoder decoder = node.Tag as AccessoryDecoder;
                if (decoder == null)
                {
                    return;
                }

                AccessoryDecoderEditorView form = new AccessoryDecoderEditorView(decoder);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    this.RefreshTreeList();
                }
            }
            else if (node.Tag is FeedbackEncoder)
            {
                FeedbackEncoder encoder = node.Tag as FeedbackEncoder;
                if (encoder == null)
                {
                    return;
                }

                FeedbackEncoderEditorView form = new FeedbackEncoderEditorView(encoder);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    this.RefreshTreeList();
                }
            }
            else if (node.Tag is Module)
            {
                Module module = node.Tag as Module;
                if (module == null)
                {
                    return;
                }

                ModuleEditorView form = new ModuleEditorView(module);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    this.RefreshTreeList();
                }
            }
        }
Exemplo n.º 2
0
        private void AddDecoder()
        {
            AccessoryDecoderEditorView form = new AccessoryDecoderEditorView();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                this.Refresh();
            }
        }
        internal void AccessoryDecoderAdd()
        {
            AccessoryDecoderWizardView wizard = new AccessoryDecoderWizardView();

            if (wizard.ShowDialog(this) == DialogResult.OK)
            {
                wizard.Decoder.Module = (tlsDecoders.Selection.Count > 0 ? tlsDecoders.Selection[0].Tag as Module : null);

                AccessoryDecoderEditorView editor = new AccessoryDecoderEditorView(wizard.Decoder);
                if (editor.ShowDialog(this) == DialogResult.OK)
                {
                    this.RefreshTreeList();
                }
            }
        }
Exemplo n.º 4
0
        private void EditDecoder()
        {
            if (grdModuleView.SelectedRowsCount <= 0)
            {
                MessageBox.Show("You must select the module you want to edit.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (!(grdModuleView.GetRow(grdModuleView.GetSelectedRows()[0]) is AccessoryDecoder decoder))
            {
                return;
            }

            AccessoryDecoderEditorView form = new AccessoryDecoderEditorView(decoder);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                this.Refresh();
            }
        }