private void Init(IParameters parameters) { this.Controls.Clear(); //this.Height = 10 + 30 * parameters.Count + 100; this.Height = 10 + 30 * parameters.Count; int x = 10; int y = 10; for (int i = 0; i < parameters.Count; i++) { IParameter param = parameters.GetParameter(i); Label lb = new Label(); lb.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); lb.Location = new Point(x, y); lb.Text = param.Caption; lb.RightToLeft = RightToLeft.Yes; this.Controls.Add(lb); IParameterControl paramcontrol = ParameterControlFactory.Create(param); this.parameterControls.Add(paramcontrol); Control control = paramcontrol.GetControl(); control.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); control.Width = 150; control.Location = new Point(x + 120, y); this.Controls.Add(control); y += 30; } }
public override void SetDataToInterface(IParameterControl control) { base.SetDataToInterface(control); iProdParameterControl ProdParaInterface = (iProdParameterControl)control; ProdParaInterface.ProductName = ProductName; ProdParaInterface.VacuumLoadPNP = VacuumLoadPNP; ProdParaInterface.VacuumTransPNPLoad = VacuumTransPNPLoad; ProdParaInterface.VacuumTransPNPUnload = VacuumTransPNPUnload; ProdParaInterface.VacuumUnloadPNP = VacuumUnloadPNP; ProdParaInterface.VacuumSortingPNP = VacuumSortingPNP; ProdParaInterface.BackSideUp = BackSideUp; ProdParaInterface.TopSealHeight = TopSealHeight; ProdParaInterface.TopHeight = TopHeight; ProdParaInterface.TopClampWidth = TopClampWidth; ProdParaInterface.ClampDisable = ClampDisable; ProdParaInterface.ProdCellDataSpec = CellDataSpec; //ProdParaInterface.RefThickness = RefThickness; //ProdParaInterface.ThicknessMeasRefLeft = ThicknessMeasRefLeft; //ProdParaInterface.ThicknessMeasRefMid = ThicknessMeasRefMid; //ProdParaInterface.ThicknessMeasRefRight = ThicknessMeasRefRight; ProdParaInterface.MeasAmount = MeasAmount; ProdParaInterface.UseGauge = UseGauge; }
public override void GetDataFromInterface(IParameterControl control) { base.GetDataFromInterface(control); iProdParameterControl ProdParaInterface = (iProdParameterControl)control; _ProdName = ProdParaInterface.ProductName; VacuumLoadPNP = ProdParaInterface.VacuumLoadPNP; VacuumTransPNPLoad = ProdParaInterface.VacuumTransPNPLoad; VacuumTransPNPUnload = ProdParaInterface.VacuumTransPNPUnload; VacuumUnloadPNP = ProdParaInterface.VacuumUnloadPNP; VacuumSortingPNP = ProdParaInterface.VacuumSortingPNP; BackSideUp = ProdParaInterface.BackSideUp; TopSealHeight = ProdParaInterface.TopSealHeight; TopHeight = ProdParaInterface.TopHeight; TopClampWidth = ProdParaInterface.TopClampWidth; ClampDisable = ProdParaInterface.ClampDisable; CellDataSpec = ProdParaInterface.ProdCellDataSpec; //RefThickness = ProdParaInterface.RefThickness; //ThicknessMeasRefLeft = ProdParaInterface.ThicknessMeasRefLeft; //ThicknessMeasRefMid = ProdParaInterface.ThicknessMeasRefMid; //ThicknessMeasRefRight = ProdParaInterface.ThicknessMeasRefRight; MeasAmount = ProdParaInterface.MeasAmount; UseGauge = ProdParaInterface.UseGauge; }
/// <summary> /// 移除参数修改显示界面 /// </summary> /// <param name="ParaInterface">参数修改显示界面</param> public void RemoveInterface(IParameterControl ParaInterface) { if (ParaInterface == null) { return; } _ParaControls.Remove(ParaInterface); DisconnectFromInterface(ParaInterface); }
/// <summary> /// 添加参数修改显示界面 /// </summary> /// <param name="ParaInterface">参数修改显示界面</param> public void AddParaInterface(IParameterControl ParaInterface) { if (_ParaControls.Contains(ParaInterface)) { return; } _ParaControls.Add(ParaInterface); ConnectToInterface(ParaInterface); SetDataToInterface(ParaInterface); }
public override void SetDataToInterface(IParameterControl control) { base.SetDataToInterface(control); ISystemParameterControl SysParaInterface = (ISystemParameterControl)control; SysParaInterface.VacuumDelayTime = VacuumDelayTime; SysParaInterface.ThicknessMeasDelayTime = ThicknessMeasDelayTime; SysParaInterface.Products = Products; SysParaInterface.CurrentProduct = CurrentProduct; SysParaInterface.LoadInSMEMAIgnored = LoadInSMEMAIgnored; SysParaInterface.UnloadOutSMEMAIgnored = UnloadOutSMEMAIgnored; }
public override void GetDataFromInterface(IParameterControl control) { base.GetDataFromInterface(control); ISystemParameterControl SysParaInterface = (ISystemParameterControl)control; VacuumDelayTime = SysParaInterface.VacuumDelayTime; ThicknessMeasDelayTime = SysParaInterface.ThicknessMeasDelayTime; Products = SysParaInterface.Products; CurrentProduct = SysParaInterface.CurrentProduct; LoadInSMEMAIgnored = SysParaInterface.LoadInSMEMAIgnored; UnloadOutSMEMAIgnored = SysParaInterface.UnloadOutSMEMAIgnored; }
public override void SetDataToInterface(IParameterControl control) { base.SetDataToInterface(control); ISystemParameterControl SysParaInterface = (ISystemParameterControl)control; SysParaInterface.VacuumDelayTime = VacuumDelayTime; SysParaInterface.ManualLoadDelayTime = ManualLoadDelayTime; SysParaInterface.ThicknessMeasDelayTime = ThicknessMeasDelayTime; SysParaInterface.Products = Products; SysParaInterface.Gauges = Gauges; SysParaInterface.CurrentProduct = CurrentProduct; SysParaInterface.LoadInSMEMAIgnored = LoadInSMEMAIgnored; SysParaInterface.UnloadOutSMEMAIgnored = UnloadOutSMEMAIgnored; SysParaInterface.OdsSaveInterval = OdsSaveInterval; SysParaInterface.OdsSavePath = OdsSavePath; SysParaInterface.LogOutTime = LogOutTime; }
public override void GetDataFromInterface(IParameterControl control) { base.GetDataFromInterface(control); ISystemParameterControl SysParaInterface = (ISystemParameterControl)control; VacuumDelayTime = SysParaInterface.VacuumDelayTime; ManualLoadDelayTime = SysParaInterface.ManualLoadDelayTime; ThicknessMeasDelayTime = SysParaInterface.ThicknessMeasDelayTime; Products = SysParaInterface.Products; Gauges = SysParaInterface.Gauges; CurrentProduct = SysParaInterface.CurrentProduct; LoadInSMEMAIgnored = SysParaInterface.LoadInSMEMAIgnored; UnloadOutSMEMAIgnored = SysParaInterface.UnloadOutSMEMAIgnored; OdsSaveInterval = SysParaInterface.OdsSaveInterval; OdsSavePath = SysParaInterface.OdsSavePath; LogOutTime = SysParaInterface.LogOutTime; }
public override void SetDataToInterface(IParameterControl control) { base.SetDataToInterface(control); iProdParameterControl ProdParaInterface = (iProdParameterControl)control; ProdParaInterface.ProductName = ProductName; ProdParaInterface.BackSideUp = BackSideUp; ProdParaInterface.TopSealHeight = TopSealHeight; ProdParaInterface.TopHeight = TopHeight; ProdParaInterface.TopClampWidth = TopClampWidth; ProdParaInterface.ProdCellDataSpec = CellDataSpec; //ProdParaInterface.RefThickness = RefThickness; //ProdParaInterface.ThicknessMeasRefLeft = ThicknessMeasRefLeft; //ProdParaInterface.ThicknessMeasRefMid = ThicknessMeasRefMid; //ProdParaInterface.ThicknessMeasRefRight = ThicknessMeasRefRight; ProdParaInterface.MeasAmount = MeasAmount; ProdParaInterface.UseGauge = UseGauge; }
public override void GetDataFromInterface(IParameterControl control) { base.GetDataFromInterface(control); iProdParameterControl ProdParaInterface = (iProdParameterControl)control; _ProdName = ProdParaInterface.ProductName; BackSideUp = ProdParaInterface.BackSideUp; TopSealHeight = ProdParaInterface.TopSealHeight; TopHeight = ProdParaInterface.TopHeight; TopClampWidth = ProdParaInterface.TopClampWidth; CellDataSpec = ProdParaInterface.ProdCellDataSpec; //RefThickness = ProdParaInterface.RefThickness; //ThicknessMeasRefLeft = ProdParaInterface.ThicknessMeasRefLeft; //ThicknessMeasRefMid = ProdParaInterface.ThicknessMeasRefMid; //ThicknessMeasRefRight = ProdParaInterface.ThicknessMeasRefRight; MeasAmount = ProdParaInterface.MeasAmount; UseGauge = ProdParaInterface.UseGauge; }
/// <summary> /// Generate based on property /// </summary> /// <param name="propInfo"></param> public TypeRow(Data.EditableValue propInfo) { editableValue = propInfo; Title = editableValue.Title; Description = editableValue.Description; EnableUndo = editableValue.IsUndoEnabled; var shown = editableValue.IsShown; IParameterControl gui = null; var type = editableValue.Value.GetType(); if (!shown) { gui = null; return; } gui = ParameterListComponentFactory.Generate(type); if (gui != null) { // already generated } else if (type == typeof(Data.Value.String)) { gui = new String(); } else if (type == typeof(Data.Value.Boolean)) { gui = new Boolean(); } else if (type == typeof(Data.Value.Int)) { gui = new Int(); } else if (type == typeof(Data.Value.IntWithInifinite)) { gui = new IntWithInifinite(); } else if (type == typeof(Data.Value.IntWithRandom)) { gui = new IntWithRandom(); } else if (type == typeof(Data.Value.Float)) { gui = new Float(); } else if (type == typeof(Data.Value.FloatWithRandom)) { gui = new FloatWithRandom(); } else if (type == typeof(Data.Value.Vector2D)) { gui = new Vector2D(); } else if (type == typeof(Data.Value.Vector2DWithRandom)) { gui = new Vector2DWithRandom(); } else if (type == typeof(Data.Value.Vector3D)) { gui = new Vector3D(); } else if (type == typeof(Data.Value.Vector3DWithRandom)) { gui = new Vector3DWithRandom(); } else if (type == typeof(Data.Value.Vector4D)) { gui = new Vector4D(); } else if (type == typeof(Data.Value.Color)) { gui = new ColorCtrl(); } else if (type == typeof(Data.Value.ColorWithRandom)) { gui = new ColorWithRandom(); } else if (type == typeof(Data.Value.Path)) { gui = null; return; } else if (type == typeof(Data.Value.PathForModel)) { gui = new PathForModel(); } else if (type == typeof(Data.Value.PathForImage)) { gui = new PathForImage(); } else if (type == typeof(Data.Value.PathForSound)) { gui = new PathForSound(); } else if (type == typeof(Data.Value.PathForMaterial)) { gui = new PathForMaterial(); } else if (type == typeof(Data.Value.FCurveScalar)) { gui = new FCurveButton(); } else if (type == typeof(Data.Value.FCurveVector2D)) { gui = new FCurveButton(); } else if (type == typeof(Data.Value.FCurveVector3D)) { gui = new FCurveButton(); } else if (type == typeof(Data.Value.FCurveColorRGBA)) { gui = new FCurveButton(); } else if (editableValue.Value is Data.IEditableValueCollection) { gui = new Dummy(); } else if (type == typeof(Data.Value.FCurve <float>)) { gui = null; return; } else if (type == typeof(Data.Value.FCurve <byte>)) { gui = null; return; } else if (type == typeof(Data.Value.IFCurveKey)) { gui = null; return; } else if (type.IsGenericType) { var types = type.GetGenericArguments(); gui = new Enum(); var dgui = (dynamic)gui; dgui.Initialize(types[0]); } if (editableValue.SelfSelectorID >= 0) { IsSelector = true; SelfSelectorID = editableValue.SelfSelectorID; } else { IsSelector = false; SelfSelectorID = -1; } Control = gui; Label = Title; ControlDynamic = Control; if (Control != null) { Control.EnableUndo = EnableUndo; } }
public virtual void GetDataFromInterface(IParameterControl control) { }
protected virtual void DisconnectFromInterface(IParameterControl control) { control.SaveParaEvent -= SaveParaEventHandler; }
protected virtual void ConnectToInterface(IParameterControl control) { control.SaveParaEvent -= SaveParaEventHandler; control.SaveParaEvent += SaveParaEventHandler; }
/// <summary> /// Generate based on property /// </summary> /// <param name="properties"></param> public TypeRow(PropertyInfo[] properties, List <TypeRow> sameLayer, TypeRow parent) { Parent = parent; var p = properties.LastOrDefault(); var attributes = p.GetCustomAttributes(false); Title = NameAttribute.GetName(attributes); Description = DescriptionAttribute.GetDescription(attributes); IParameterControl gui = null; var undo = attributes.Where(_ => _.GetType() == typeof(Effekseer.Data.UndoAttribute)).FirstOrDefault() as Effekseer.Data.UndoAttribute; if (undo != null && !undo.Undo) { EnableUndo = false; } else { EnableUndo = true; } var shown = attributes.Where(_ => _.GetType() == typeof(Effekseer.Data.ShownAttribute)).FirstOrDefault() as Effekseer.Data.ShownAttribute; if (shown != null && !shown.Shown) { gui = null; return; } else if (p.PropertyType == typeof(Data.Value.String)) { gui = new String(Title); } else if (p.PropertyType == typeof(Data.Value.Boolean)) { gui = new Boolean(Title); } else if (p.PropertyType == typeof(Data.Value.Int)) { gui = new Int(Title); } else if (p.PropertyType == typeof(Data.Value.IntWithInifinite)) { gui = new IntWithInifinite(Title); } else if (p.PropertyType == typeof(Data.Value.IntWithRandom)) { gui = new IntWithRandom(Title); } else if (p.PropertyType == typeof(Data.Value.Float)) { gui = new Float(Title); } else if (p.PropertyType == typeof(Data.Value.FloatWithRandom)) { gui = new FloatWithRandom(Title); } else if (p.PropertyType == typeof(Data.Value.Vector2D)) { gui = new Vector2D(Title); } else if (p.PropertyType == typeof(Data.Value.Vector2DWithRandom)) { gui = new Vector2DWithRandom(Title); } else if (p.PropertyType == typeof(Data.Value.Vector3D)) { gui = new Vector3D(Title); } else if (p.PropertyType == typeof(Data.Value.Vector3DWithRandom)) { gui = new Vector3DWithRandom(Title); } else if (p.PropertyType == typeof(Data.Value.Color)) { gui = new ColorCtrl(Title); } else if (p.PropertyType == typeof(Data.Value.ColorWithRandom)) { gui = new ColorWithRandom(Title); } else if (p.PropertyType == typeof(Data.Value.Path)) { gui = null; return; } else if (p.PropertyType == typeof(Data.Value.PathForModel)) { gui = new PathForModel(Title); } else if (p.PropertyType == typeof(Data.Value.PathForImage)) { gui = new PathForImage(Title); } else if (p.PropertyType == typeof(Data.Value.PathForSound)) { gui = new PathForSound(Title); } else if (p.PropertyType == typeof(Data.Value.FCurveVector2D)) { gui = new FCurveButton(Title); } else if (p.PropertyType == typeof(Data.Value.FCurveVector3D)) { gui = new FCurveButton(Title); } else if (p.PropertyType == typeof(Data.Value.FCurveColorRGBA)) { gui = new FCurveButton(Title); } else if (p.PropertyType == typeof(Data.Value.FCurve <float>)) { gui = null; return; } else if (p.PropertyType == typeof(Data.Value.FCurve <byte>)) { gui = null; return; } else if (p.PropertyType == typeof(Data.Value.IFCurveKey)) { gui = null; return; } else if (p.PropertyType.IsGenericType) { var types = p.PropertyType.GetGenericArguments(); gui = new Enum(Title); var dgui = (dynamic)gui; dgui.Initialize(types[0]); } var selector_attribute = (from a in attributes where a is Data.SelectorAttribute select a).FirstOrDefault() as Data.SelectorAttribute; if (selector_attribute != null) { IsSelector = true; SelectorID = selector_attribute.ID; } else { IsSelector = false; SelectorID = -1; } Properties = properties.Clone() as PropertyInfo[]; Control = gui; if (gui != null) { gui.Description = this.Description; } // Selector var selected_attribute = (from a in attributes where a is Data.SelectedAttribute select a).FirstOrDefault() as Data.SelectedAttribute; if (selected_attribute != null) { var selector = sameLayer.Where(_ => _.IsSelector && _.SelectorID == selected_attribute.ID).LastOrDefault(); if (selector != null) { Selector = selector; SelectorValue = selected_attribute.Value; } } Label = Title; ControlDynamic = Control; if (Control != null) { Control.EnableUndo = EnableUndo; } }
/// <summary> /// 获取该视图所呈现的包含参数设置、插件控件、翻页控件的界面。 /// </summary> /// <returns></returns> public override Control CreateViewControl() { Control ctlView = new Control(); FlowLayoutPanel flpParameters = null; //初始化插件 System.Reflection.ConstructorInfo ci = this.PluginType.Type.GetConstructor(new System.Type[] { }); object objInstance = ci.Invoke(new object[] { }); this.m_Plugin = objInstance as IPlugin; if (this.m_IsHtmlPlugin) { this.m_PluginControl = new System.Windows.Forms.WebBrowser(); ((System.Windows.Forms.WebBrowser) this.m_PluginControl).ObjectForScripting = new ScriptManager(this); ((System.Windows.Forms.WebBrowser) this.m_PluginControl).NewWindow += new System.ComponentModel.CancelEventHandler(PluginViewBase_NewWindow); } else { this.m_PluginControl = objInstance as Control; } //设置应用程序框架 this.m_Plugin.SetApplication(base.Application); //设置账号 if (this.m_Plugin is IUseAccount) { if (this.Application.CurrentAccount == null) { throw new Exception("“" + this.PluginType.Name + "”需要使用操作员账号,但应用程序框架无账号信息。"); } IUseAccount useAccount = this.m_Plugin as IUseAccount; useAccount.SetAccount(this.Application.CurrentAccount); } //由继承的类设置对象 this.SetPlugin(this.m_Plugin); //设置参数 foreach (Type typParameter in this.PluginType.ParameterTypes) { if (flpParameters == null) { flpParameters = new FlowLayoutPanel(); } if (this.m_lsParameterControls == null) { this.m_lsParameterControls = new List <IParameterControl>(); } Type typControlType = this.Application.GetParameterControlType(typParameter); if (typControlType != null) { System.Reflection.ConstructorInfo ciParameter = typControlType.GetConstructor(new System.Type[] { }); object objParameterInstance = ciParameter.Invoke(new object[] { }); IParameterControl parameterControl = objParameterInstance as IParameterControl; parameterControl.SetApplication(base.Application); if (objParameterInstance is IUseAccount) { IUseAccount useAccount = objParameterInstance as IUseAccount; useAccount.SetAccount(this.Application.CurrentAccount); } parameterControl.SetOrientation(true); if (this.m_ParameterValues != null) { foreach (ParameterValue _ParameterValue in this.m_ParameterValues) { if (_ParameterValue.Type.Equals(typParameter)) { parameterControl.SetParameterValue(_ParameterValue.Value); break; } } } m_lsParameterControls.Add(parameterControl); parameterControl.SetParameterPlugin(this.m_Plugin as IParameter); flpParameters.Controls.Add(objParameterInstance as Control); } else { Label labError = new Label(); labError.Text = "未发现“" + typParameter.FullName + "”的查询参数界面控件。"; labError.ForeColor = System.Drawing.Color.Red; labError.AutoSize = true; flpParameters.Controls.Add(labError); } } //edit by xch 3.23 if (Function.IsInheritableBaseType(this.PluginType.Type, typeof(System.Windows.Forms.UserControl))) { ctlView.Size = new System.Drawing.Size((this.m_PluginControl as UserControl).Width + 10, (this.m_PluginControl as UserControl).Height + 40); } else { ctlView.Size = new System.Drawing.Size(800, 600); } this.m_PluginControl.Dock = DockStyle.Fill; ctlView.Controls.Add(this.m_PluginControl); if (flpParameters != null) { Button btnParameter = new Button(); btnParameter.Text = "确定"; btnParameter.Click += new EventHandler(btnParameter_Click); flpParameters.Controls.Add(btnParameter); flpParameters.Dock = DockStyle.Top; flpParameters.AutoSize = true; ctlView.Controls.Add(flpParameters); } if (this.PluginType.IsPagination) { IPagination pluginPagination = this.m_Plugin as IPagination; pluginPagination.Pagination += new PaginationEventHandler(plugin_Pagination); this.m_Pagination = new Pagination(); this.m_Pagination.Dock = DockStyle.Bottom; this.m_Pagination.Paging += new PagingEventHandler(m_Pagination_Paging); ctlView.Controls.Add(this.m_Pagination); pluginPagination.SetPageNumber(1); } if (this.m_IsHtmlPlugin) { this.WriterHtmlPlugin(this.m_Plugin); } this.m_IsCreateViewControl = true; return(ctlView); }
public virtual void SetDataToInterface(IParameterControl control) { }