Exemplo n.º 1
0
        public Management.Editors.XChannelForm GetForm(string Path, Channel ch, ChannelService objChannelManager, string classname)
        {
            GetIODriver objFunctions = GetIODriver.GetFunctions();
            object      context      = objFunctions.ParseNamespace($@"\AdvancedScada.{Path}.Core.dll", classname);
            Type        t            = (Type)context;

            Management.Editors.XChannelForm ctrl = (Management.Editors.XChannelForm)objFunctions.CreateInstance(t, new object[] { Path, objChannelManager, ch });
            ctrl.eventChannelChanged += (chCurrent, isNew) =>
            {
                eventChannelChanged?.Invoke(chCurrent, isNew);
                ctrl.DialogResult = DialogResult.OK;
            };
            return(ctrl);
        }
Exemplo n.º 2
0
        public void GetForm(string Path, string classname)
        {
            switch (_DriverTypes)
            {
            case "LSIS":
                ctrl = new XLSIS.Core.UserEditors.XUserChannelForm(objChannelManager, ch);

                break;

            case "Modbus":
                ctrl = new XModbus.Core.UserEditors.XUserChannelForm(objChannelManager, ch);
                break;

            case "Panasonic":
                ctrl = new XPanasonic.Core.UserEditors.XUserChannelForm(objChannelManager, ch);
                break;

            case "Siemens":
                ctrl = new XSiemens.Core.UserEditors.XUserChannelForm(objChannelManager, ch);
                break;

            default:
                break;
            }

            ctrl.eventChannelChanged += (ch, isNew) =>
            {
                eventChannelChanged?.Invoke(ch, isNew);
                DialogResult = DialogResult.OK;
            };
            try
            {
                if (ctrl != null)
                {
                    ctrl.Dock   = DockStyle.Fill;
                    this.Width  = ctrl.Width + 25;
                    this.Height = ctrl.Height + 25;
                    ctrl.BringToFront();
                    ctrl.Click += Ctrl_Click;

                    Controls.Add(ctrl);
                }
            }
            catch
            {
            }
        }