/// <summary> /// Displays the UI for value selection. /// </summary> /// <param name="context"></param> /// <param name="provider"></param> /// <param name="value"></param> /// <returns></returns> public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { /*PropertiesUtils.PropertyWrapper pw; * if ((pw = context.PropertyDescriptor as PropertiesUtils.PropertyWrapper) == null) * return value; * * DependencyObject depObj = pw.ControlledObject as DependencyObject; * DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(pw.ControlledProperty); * if (depObj == null || dpd == null) * return value; * DependencyProperty depProp = dpd.DependencyProperty;*/ IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { FreeSCADA.Designer.Dialogs.VariablesDialog dlg; if (value == null) { dlg = new FreeSCADA.Designer.Dialogs.VariablesDialog(true, ""); } else { dlg = new FreeSCADA.Designer.Dialogs.VariablesDialog(true, value.ToString()); } if (dlg.ShowDialog() == DialogResult.OK) { foreach (IChannel ch in dlg.SelectedChannels) { // returns the first channel from selection return(ch.PluginId + "." + ch.Name); } } } return(value); }
private void addChannelButton_Click(object sender, EventArgs e) { FreeSCADA.Designer.Dialogs.VariablesDialog dlg = new FreeSCADA.Designer.Dialogs.VariablesDialog(true); if (dlg.ShowDialog(this) == DialogResult.OK) { Rule rule = rulesList.SelectedItems[0].Tag as Rule; if (rule != null) { foreach (IChannel ch in dlg.SelectedChannels) { ChannelInfo channel = new ChannelInfo(); channel.ChannelName = ch.Name; channel.PluginId = ch.PluginId; rule.Channels.Add(channel); } } ArchiverMain.Current.ChannelsSettings.Save(); RefreshChannelsList(); } }