コード例 #1
0
        public UPnpArgumentEditControl(ActionEditForm parentform, UPnPAction action, UPnPArgument argument)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            this.parentform = parentform;
            this.parentaction = action;
            this.arg = argument;

            // Set name
            argNameTextBox.Text = arg.Name;
            //toolTip.SetToolTip(actionNameLabel,"(" + arg.RelatedStateVar.ValueType + ") " + arg.Name);

            // Set input/output
            inputMenuItem.Checked = false;
            outputMenuItem.Checked = false;
            returnMenuItem.Checked = false;

            if (arg.IsReturnValue == true)
            {
                returnMenuItem.Checked = true;
                argDirPictureBox.Image = actionImageList.Images[2];
                toolTip.SetToolTip(argDirPictureBox,"Return argument");
            }
            else
            {
                if (arg.Direction == "in")
                {
                    inputMenuItem.Checked = true;
                    argDirPictureBox.Image = actionImageList.Images[0];
                    toolTip.SetToolTip(argDirPictureBox,"Input argument");
                }
                else
                if (arg.Direction == "out")
                {
                    outputMenuItem.Checked = true;
                    argDirPictureBox.Image = actionImageList.Images[1];
                    toolTip.SetToolTip(argDirPictureBox,"Ouput argument");
                }
                else
                {
                    returnMenuItem.Checked = true;
                    argDirPictureBox.Image = actionImageList.Images[2];
                    toolTip.SetToolTip(argDirPictureBox,"Return argument");
                }
            }

            // Fill state variables
            UPnPStateVariable[] vars = action.ParentService.GetStateVariables();
            bool selitemset = false;
            foreach (UPnPStateVariable var in vars)
            {
                stateVariablesComboBox.Items.Add(var);
                if (arg.RelatedStateVar != null && var.Name == arg.RelatedStateVar.Name)
                {
                    stateVariablesComboBox.SelectedItem = var;
                    selitemset = true;
                }
            }
            if (selitemset == false)
            {
                stateVariablesComboBox.SelectedIndex = 0;
            }
        }
コード例 #2
0
        private void actionListView_DoubleClick(object sender, System.EventArgs e)
        {
            UPnPService ts;
            if (upnpService == null) return;

            if (actionListView.SelectedItems.Count == 1)
            {
                UPnPAction act = (UPnPAction)actionListView.SelectedItems[0].Tag;
                ts = (UPnPService)upnpService.Clone();
                ActionEditForm actionEditForm = new ActionEditForm(ts);
                actionEditForm.Action = ts.GetAction(act.Name);
                DialogResult r = actionEditForm.ShowDialog(this);
                if (r == DialogResult.OK)
                {
                    upnpService.RemoveMethod(act);
                    act = actionEditForm.Action;
                    upnpService.AddMethod(actionEditForm.Action);
                    updateUserInterface();
                }
            }
        }
コード例 #3
0
        private void addActionMenuItem_Click(object sender, System.EventArgs e)
        {
            if (upnpService == null) return;

            ActionEditForm actionEditForm = new ActionEditForm(upnpService);
            DialogResult r = actionEditForm.ShowDialog(this);
            if (r == DialogResult.OK)
            {
                UPnPAction act = actionEditForm.Action;
                upnpService.AddMethod(act);
                updateUserInterface();
            }
        }
コード例 #4
0
        public UPnpArgumentEditControl(ActionEditForm parentform, UPnPAction action, UPnPArgument argument)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            this.parentform   = parentform;
            this.parentaction = action;
            this.arg          = argument;

            // Set name
            argNameTextBox.Text = arg.Name;
            //toolTip.SetToolTip(actionNameLabel,"(" + arg.RelatedStateVar.ValueType + ") " + arg.Name);

            // Set input/output
            inputMenuItem.Checked  = false;
            outputMenuItem.Checked = false;
            returnMenuItem.Checked = false;

            if (arg.IsReturnValue == true)
            {
                returnMenuItem.Checked = true;
                argDirPictureBox.Image = actionImageList.Images[2];
                toolTip.SetToolTip(argDirPictureBox, "Return argument");
            }
            else
            {
                if (arg.Direction == "in")
                {
                    inputMenuItem.Checked  = true;
                    argDirPictureBox.Image = actionImageList.Images[0];
                    toolTip.SetToolTip(argDirPictureBox, "Input argument");
                }
                else
                if (arg.Direction == "out")
                {
                    outputMenuItem.Checked = true;
                    argDirPictureBox.Image = actionImageList.Images[1];
                    toolTip.SetToolTip(argDirPictureBox, "Ouput argument");
                }
                else
                {
                    returnMenuItem.Checked = true;
                    argDirPictureBox.Image = actionImageList.Images[2];
                    toolTip.SetToolTip(argDirPictureBox, "Return argument");
                }
            }

            // Fill state variables
            UPnPStateVariable[] vars = action.ParentService.GetStateVariables();
            bool selitemset          = false;

            foreach (UPnPStateVariable var in vars)
            {
                stateVariablesComboBox.Items.Add(var);
                if (arg.RelatedStateVar != null && var.Name == arg.RelatedStateVar.Name)
                {
                    stateVariablesComboBox.SelectedItem = var;
                    selitemset = true;
                }
            }
            if (selitemset == false)
            {
                stateVariablesComboBox.SelectedIndex = 0;
            }
        }