public void SetupFluidProgram(FluidProgram fluidProgram) { this.fluidProgram = fluidProgram; this.txtBoardHeight.Text = this.fluidProgram.RuntimeSettings.StandardBoardHeight.ToString("0.000"); this.nudMaxTolerance.Value = (decimal)this.fluidProgram.RuntimeSettings.MaxTolerance; this.nudMinTolerance.Value = (decimal)this.fluidProgram.RuntimeSettings.MinTolerance; }
private void button2_Click(object sender, EventArgs e) { FluidProgram.Create("xiaoxu", 0, 0); DotCmdLine dot = new DotCmdLine(); dot.Position.X = 100; dot.Position.Y = 100; FluidProgram.CurrentOrDefault().Workpiece.AddCmdLine(dot); DoCmdLine doPattern = new DoCmdLine("1", 300, 300); FluidProgram.CurrentOrDefault().Workpiece.AddCmdLine(doPattern); Pattern pattern = new Pattern(FluidProgram.CurrentOrDefault(), "1", 200, 200); DotCmdLine dot1 = new DotCmdLine(); dot1.Position.X = 200; dot1.Position.Y = 200; pattern.AddCmdLine(dot1); FluidProgram.CurrentOrDefault().AddPattern(pattern); DrawingMsgCenter.Instance.SendMsg(DrawingMessage.需要更新绘图程序, FluidProgram.CurrentOrDefault()); DrawProgram.Instance.SetGraphics(this.g, 1); DrawProgram.Instance.Drawing(); }
public CalculateTheNeedleXYOffset(int valveNo) { this.valveNo = valveNo; InitializeComponent(); this.valveControl1.Setup(valveNo); if (this.valveNo == 1) { this.picDiagram.Image = Properties.Resources.CalculateTheNeedleXYOffset; } else { this.picDiagram.Image = Properties.Resources.CalculateTheNeedle2XYOffset; } UpdateByFlag(); for (int i = 0; i < 10; i++) { cbxDotStyle.Items.Add("Type " + (i + 1)); } cbxDotStyle.SelectedIndex = 9; dotParam = FluidProgram.CurrentOrDefault().ProgramSettings.GetDotParam(dotStyle); this.ReadLanguageResources(); this.FormClosed += CalculateTheNeedleXYOffset_FormClosed; }
private void EditCmdLine(int index) { bool inWorkpiece; int patternNo = 0; if (commandsModule is FluidProgram) { return; } else if (commandsModule is Workpiece) { inWorkpiece = true; } else { inWorkpiece = false; Pattern pattern = commandsModule as Pattern; for (int i = 0; i < FluidProgram.CurrentOrDefault().Patterns.Count; i++) { if (FluidProgram.CurrentOrDefault().Patterns[i].Name == pattern.Name) { patternNo = i; } } } int[] cmdLiensIndex = new int[1]; cmdLiensIndex[0] = index; DrawingMsgCenter.Instance.SendMsg(DrawingMessage.点击了一个绘图命令, inWorkpiece, patternNo, cmdLiensIndex); }
private void Init() { this.valveControl1.Setup(2); for (int i = 0; i < 10; i++) { this.cbxDotStyle.Items.Add("Type " + (i + 1)); } this.cbxDotStyle.SelectedIndex = 0; this.dotStyle = DotStyle.TYPE_1; this.dotParam = FluidProgram.CurrentOrDefault().ProgramSettings.GetDotParam(this.dotStyle); if (DataSetting.Default.selectDispenseMode) { this.rdoDispenseMode.Checked = true; } else { this.rdoPlasticineMode.Checked = true; } switch (DataSetting.Default.selectCorrectionAxis) { case CorrectionAxis.A轴校正: this.rdoAxisA.Checked = true; break; case CorrectionAxis.B轴校正: this.rdoAxisB.Checked = true; break; case CorrectionAxis.A轴和B轴同时校正: this.rdoAxisAandB.Checked = true; break; } }
public void SaveResult(string pathDir) { string path = pathDir; DirUtils.CreateDir(path); //this.FileName = this.FileName.Replace(':', '_'); path = path + "\\" + DateTime.Now.ToString("yyyyMMdd HHmmss"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(this.Barcode + "\r\n"); stringBuilder.Append(FluidProgram.CurrentOrDefault().RuntimeSettings.CustomParam.RTVParam.Depart + "\r\n"); stringBuilder.Append(FluidProgram.CurrentOrDefault().RuntimeSettings.CustomParam.RTVParam.ComputerInfo + "\r\n"); stringBuilder.Append(FluidProgram.CurrentOrDefault().RuntimeSettings.CustomParam.RTVParam.MachineInfo + "\r\n"); stringBuilder.Append(this.GetBarcodePart(this.Barcode) + "\r\n"); stringBuilder.Append(FluidProgram.CurrentOrDefault().RuntimeSettings.CustomParam.RTVParam.ProductLineInfo + "\r\n"); stringBuilder.Append(FluidProgram.CurrentOrDefault().RuntimeSettings.CustomParam.RTVParam.OwkInfo + "\r\n"); stringBuilder.Append(FluidProgram.CurrentOrDefault().RuntimeSettings.CustomParam.RTVParam.UserInfo + "\r\n"); stringBuilder.Append(this.GetProgramRunTime() + "\r\n"); stringBuilder.Append(this.GetProgramEndTime() + "\r\n"); stringBuilder.Append("No Width MaxValue MinValue Height MaxValue MinValue" + "\r\n"); for (int i = 0; i < this.Results.Count; i++) { string s = ""; s += (1 + i).ToString() + " "; s += this.Results[i][0] + " "; s += this.Results[i][1] + " "; s += this.Results[i][2] + " "; s += this.Results[i][3] + " "; s += this.Results[i][4] + " "; s += this.Results[i][5]; stringBuilder.Append(s + "\r\n"); } CsvUtil.WriteLine(path, stringBuilder.ToString()); }
void InitProgram(ShaderBuildinHelper shaderBuildinHelper) { if (shaderBuildinHelper == null) { Debug.Log("ShaderBuildinHelper is null"); return; } clearProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/ClearShader")); colorProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/ColorShader")); backgroundProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/BackgroundShader")); displayProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/DisplayShader")); displayBloomProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/DisplayBloomShader")); displayShadingProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/DisplayShadingShader")); displayBloomShadingProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/DisplayBloomShadingShader")); bloomPrefilterProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/BloomPrefilterShader")); bloomBlurProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/BloomBlurShader")); bloomFinalProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/BloomFinalShader")); splatProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/SplatShader")); advectionProgram = new FluidProgram(supportLinearFiltering?shaderBuildinHelper.GetShaderByName("Custom/Fluid/AdvectionShader"):shaderBuildinHelper.GetShaderByName("Custom/Fluid/AdvectionManualFilteringShader")); divergenceProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/DivergenceShader")); curlProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/CurlShader")); vorticityProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/VorticityShader")); pressureProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/PressureShader")); gradienSubtractProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/GradientSubtractShader")); }
private void button3_Click(object sender, EventArgs e) { DrawingMsgCenter.Instance.SendMsg(DrawingMessage.需要更新绘图程序, FluidProgram.CurrentOrDefault()); DrawProgram.Instance.SetGraphics(this.g, 1); //DrawProgram.Instance.Drawing(); }
public GrammarParser(FluidProgram program) { if (program == null) { throw new Exception("program is null."); } this.program = program; }
public void Setup(object[] objs) { dotParam = FluidProgram.CurrentOrDefault().ProgramSettings.GetDotParam(dotStyle); this.tileType = (TiltType)objs[0]; this.valveAngle = (double)objs[1]; this.valveCameraOffset = (PointD)objs[2]; this.standardZ = (double)objs[3]; }
private void btnTeach_Click(object sender, EventArgs e) { FluidProgram.CurrentOrDefault().ConveyorWidth = double.Parse(this.txtLiveLocation.Text); string msg = string.Format("ConveyorWidth:{0}->{1}", ConveyorWidthBackUp, double.Parse(this.txtLiveLocation.Text)); Logger.DEFAULT.Info(LogCategory.MANUAL | LogCategory.SETTING, this.GetType().Name, msg); this.ConveyorWidthBackUp = FluidProgram.CurrentOrDefault().ConveyorWidth; }
public override void LoadParam(FluidProgram program) { this.txtMesPath.Text = program.RuntimeSettings.CustomParam?.AmphnolParam.DataMesPathDir; this.txtLocalPath.Text = program.RuntimeSettings.CustomParam?.AmphnolParam.DataLocalPathDir; this.txtEmarkPath.Text = program.RuntimeSettings.CustomParam?.AmphnolParam.DataEmarkPathDir; this.txtUserName.Text = program.RuntimeSettings.CustomParam?.AmphnolParam.EmarkUserName; this.txtPassword.Text = program.RuntimeSettings.CustomParam?.AmphnolParam.EmarkPassword; }
public override void SetParam(FluidProgram program) { program.RuntimeSettings.CustomParam.AmphnolParam.DataMesPathDir = this.txtMesPath.Text; program.RuntimeSettings.CustomParam.AmphnolParam.DataLocalPathDir = this.txtLocalPath.Text; program.RuntimeSettings.CustomParam.AmphnolParam.DataEmarkPathDir = this.txtEmarkPath.Text; program.RuntimeSettings.CustomParam.AmphnolParam.EmarkUserName = this.txtUserName.Text; program.RuntimeSettings.CustomParam.AmphnolParam.EmarkPassword = this.txtPassword.Text; }
RenderTexture Render(RenderTexture target) { if (target == null) { return(null); } if (bloom_enabled) { ApplyBloom(density_dfbo.GetReadFBO(), bloom_fbo); } blendOption = FluidBlendOption.BlendOption.Enable_One_OMSA; int width = target.width; int height = target.height; if (transparent_enable) { backgroundProgram.SetFloat("_aspectRatio", (float)width / (float)height); backgroundProgram.Blit(target, target, blendOption); } else { colorProgram.SetColor("_color", BACK_COLOR); colorProgram.Blit(target, target, blendOption); } if (shading_enable) { FluidProgram program = bloom_enabled ? displayBloomShadingProgram : displayShadingProgram; program.SetFloat("_texelSize_x", 1.0f / simWidth); program.SetFloat("_texelSize_y", 1.0f / simHeight); program.SetTexture("_uTexture", density_dfbo.GetReadFBO()); if (bloom_enabled) { program.SetTexture("_Bloom", bloom_fbo); program.SetTexture("_Dithering", ditheringTexture); Vector2 scale = GetTextureScale(ditheringTexture, width, height); program.SetFloat("_ditherScale_x", scale.x); program.SetFloat("_ditherScale_y", scale.y); } program.Blit(target, target, blendOption); } else { FluidProgram program = bloom_enabled ? displayBloomProgram : displayProgram; program.SetTexture("_uTexture", density_dfbo.GetReadFBO()); if (bloom_enabled) { program.SetTexture("_Bloom", bloom_fbo); program.SetTexture("_Dithering", ditheringTexture); Vector2 scale = GetTextureScale(ditheringTexture, width, height); program.SetFloat("_ditherScale_x", scale.x); program.SetFloat("_ditherScale_y", scale.y); } program.Blit(target, target, blendOption); } return(target); }
public void SendMsg(DrawingMessage msg, FluidProgram fluidProgram) { switch (msg) { case DrawingMessage.需要更新绘图程序: for (int i = 0; i < this.receivers.Count; i++) { this.receivers[i].Update(fluidProgram); } break; } }
public ProductSettingForm(FluidProgram fluidProgram) { InitializeComponent(); this.fluidProgram = fluidProgram; this.cbxLotControl.Checked = this.fluidProgram.LotControlEnable; this.cbxStartLotById.Checked = this.fluidProgram.RuntimeSettings.IsStartLotById; this.ReadLanguageResources(); if (this.fluidProgram.RuntimeSettings != null) { this.runtimeSettingsBackUp = (RuntimeSettings)this.fluidProgram.RuntimeSettings.Clone(); } }
public override void SetParam(FluidProgram program) { program.RuntimeSettings.CustomParam.RTVParam.DataMesPathDir = this.txtMesPath.Text; program.RuntimeSettings.CustomParam.RTVParam.DataLocalPathDir = this.txtLocalPath.Text; program.RuntimeSettings.CustomParam.RTVParam.IsSaveCode = this.ckbIsSaveCode.Checked; program.RuntimeSettings.CustomParam.RTVParam.Depart = this.txtPartInfo.Text; program.RuntimeSettings.CustomParam.RTVParam.ComputerInfo = this.txtComputerInfo.Text; program.RuntimeSettings.CustomParam.RTVParam.MachineInfo = this.txtMachineInfo.Text; program.RuntimeSettings.CustomParam.RTVParam.ProductLineInfo = this.txtProductLineInfo.Text; program.RuntimeSettings.CustomParam.RTVParam.OwkInfo = this.txtOwk.Text; program.RuntimeSettings.CustomParam.RTVParam.UserInfo = this.txtUserInfo.Text; }
public LotControlSettingForm(FluidProgram fluidProgram) { InitializeComponent(); this.fluidProgram = fluidProgram; this.tbxLotStartPos.Text = fluidProgram.RuntimeSettings.LotIdStartPos.ToString(); this.tbxLotEndPos.Text = fluidProgram.RuntimeSettings.LotIdEndPos.ToString(); this.ReadLanguageResources(); if (this.fluidProgram.RuntimeSettings != null) { this.runtimeSettingsBackUp = (RuntimeSettings)this.fluidProgram.RuntimeSettings.Clone(); } }
private void OnLoadProgram(string programPath) { if (FluidProgram.Current != null && FluidProgram.CurrentFilePath == programPath) { AlarmServer.Instance.Fire(FluidProgram.Current, AlarmInfoFlu.WarnProgramAlreadyLoaded); return; } this.ProgramCtl.Enabled = false; FluidProgram.Load(programPath, program => { if (program == null) { AlarmServer.Instance.Fire(program, AlarmInfoFlu.WarnProgramNull); return; } FluidProgram.CurrentFilePath = programPath; program.HasChanged = false; //加载程序,切换程序相关硬件参数 Log.Dprint("Loading program: writing hardware..."); program.InitHardware(); Log.Dprint("Loading program: writing hardware done!"); //语法检查 if (Executor.Instance.CurrProgramState != Executor.ProgramOuterState.IDLE && Executor.Instance.CurrProgramState != Executor.ProgramOuterState.ABORTED) { return; } Log.Dprint("Loading program: grammar parsing..."); FluidProgram.Current.Parse(); Log.Dprint("Loading program: grammar parse done!"); //加载飞拍Mark校准值,只能在程序解析后赋值 if (FluidProgram.Current.RuntimeSettings.FlyOffsetIsValid) { bool result = FluidProgram.Current.ModuleStructure.SetAllMarkFlyOffset(FluidProgram.Current.RuntimeSettings.FlyOffsetList); if (!result) { FluidProgram.Current.RuntimeSettings.FlyOffsetIsValid = false; } } MsgCenter.SendMsg(MsgType.RUNINFO_PROGRAM, this, this.RunInfoCtl, program.Name); }, (errCode, errMsg) => { AlarmServer.Instance.Fire(FluidProgram.Current, AlarmInfoFlu.ErrorLoadingProgram.AppendMsg(errMsg)); }); this.ProgramCtl.Enabled = true; DrawingMsgCenter.Instance.SendMsg(DrawingMessage.需要更新绘图程序, FluidProgram.CurrentOrDefault()); DrawingMsgCenter.Instance.SendMsg(DrawingMessage.进入了Workpiece界面); }
public MoveToLocationCmd(RunnableModule runnableModule, MoveToLocationCmdLine moveToLocationCmdLine) : base(runnableModule, moveToLocationCmdLine) { FluidProgram program = runnableModule.CommandsModule.program; UserPosition up = program.UserPositions.Find(x => x.Name == moveToLocationCmdLine.PositionName); if (up == null) { throw new Exception(moveToLocationCmdLine.PositionName + " is not defined in system."); } position = new PointD(up.Position); this.PosZ = up.PosZ; MoveType = moveToLocationCmdLine.MoveType; }
/// <summary> /// 将点胶程序解析为绘图程序 /// </summary> /// <param name="fluidProgram"></param> /// <param name="workpiece"></param> /// <param name="patterns"></param> public void ParseFluidProgram(FluidProgram fluidProgram, out DrawWorkPiece drawWorkpiece, out List <DrawPattern> drawPatterns) { //初始化 this.fluidProgram = fluidProgram; this._drawWorkpiece = null; if (this._drawPatterns == null) { this._drawPatterns = new List <DrawPattern>(); } else { this._drawPatterns.Clear(); } #region 首先构建drawPatterns for (int i = 0; i < this.fluidProgram.Patterns.Count; i++) { //为drawPattern赋值原点 PointF patternOrigin = new PointF(0, 0); //patternOrigin.X = (float)this.fluidProgram.Patterns[i].Origin.X; //patternOrigin.Y = (float)this.fluidProgram.Patterns[i].Origin.Y; DrawPattern drawPattern = new DrawPattern(patternOrigin); _drawPatterns.Add(drawPattern); //为drawPattern添加绘图指令 for (int j = 0; j < this.fluidProgram.Patterns[i].CmdLineList.Count; j++) { this.Parse(this.fluidProgram.Patterns[i].CmdLineList[j], _drawPatterns[i]); } } #endregion #region 构建drawWorkpiece //为drawWorkpiece赋原点 PointF _workpieceOrigin = new PointF(0, 0); _drawWorkpiece = new DrawWorkPiece(_workpieceOrigin); //为drawWorkpiece添加绘图指令 for (int i = 0; i < this.fluidProgram.Workpiece.CmdLineList.Count; i++) { this.Parse(this.fluidProgram.Workpiece.CmdLineList[i], _drawWorkpiece); } #endregion drawWorkpiece = _drawWorkpiece; drawPatterns = _drawPatterns; }
public EditBoardHeightForm(FluidProgram fluidProgram) { InitializeComponent(); this.fluidProgram = fluidProgram; this.origin = fluidProgram.Workpiece.OriginPos; tbX.Text = fluidProgram.RuntimeSettings.HeightPosX.ToString("0.000"); tbY.Text = fluidProgram.RuntimeSettings.HeightPosY.ToString("0.000"); this.heightControl1.SetupFluidProgram(this.fluidProgram); this.heightControl1.LaserControl.MeasureStarting += HeightControl1_MeasureStarting; if (this.fluidProgram.RuntimeSettings != null) { this.runtimeSettingsBackUp = (RuntimeSettings)this.fluidProgram.RuntimeSettings.Clone(); } this.ReadLanguageResources(); }
public EditSystemLocMetro(FluidProgram program) { InitializeComponent(); //this.ReadLanguageResources(); this.program = program; this.updateList(); tbX.Text = Machine.Instance.Robot.PosX.ToString("0.000"); tbY.Text = Machine.Instance.Robot.PosY.ToString("0.000"); if (Machine.Instance.Setting.ValveSelect == ValveSelection.单阀) { this.rbNeedle2.Enabled = false; } if (listBoxDefs.Items.Count > 0) { listBoxDefs.SelectedIndex = 0; } }
/// <summary> /// 计算在手动打线模式下,普通线需要的各种参数 /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <param name="lineParam"></param> /// <param name="accStartPoint"></param> /// <param name="decelEndPoint"></param> /// <param name="runSpeed"></param> /// <param name="linePoints"></param> /// <param name="fluidIntervalSec"></param> private void GetManualNormalLineParam(PointD start, PointD end, LineParam lineParam, out PointD accStartPoint, out PointD decelEndPoint, out double runSpeed, out PointD[] linePoints, out double fluidIntervalSec) { double accDistance = 0, decelDistance = 0; // 运动速度不能超过设定的最大速度 double speed = lineParam.Speed > FluidProgram.CurrentOrDefault().MotionSettings.WorkMaxVel ? FluidProgram.CurrentOrDefault().MotionSettings.WorkMaxVel : lineParam.Speed; // 计算加速区间距离 if (lineParam.AccelDistanceValueType == LineParam.ValueType.COMPUTE) { accDistance = MathUtils.CalculateDistance(0, speed, Machine.Instance.Robot.AxisX.ConvertAcc2Mm(FluidProgram.CurrentOrDefault().MotionSettings.WeightAcc)); Log.Dprint("Acc Distance COMPUTE speed=" + speed + ", WeightAcc=" + FluidProgram.CurrentOrDefault().MotionSettings.WeightAcc + ", distance=" + accDistance); } else { accDistance = lineParam.AccelDistance; } // 计算减速区间距离 if (lineParam.DecelDistanceValueType == LineParam.ValueType.COMPUTE) { decelDistance = MathUtils.CalculateDistance(speed, 0, -Machine.Instance.Robot.AxisX.ConvertAcc2Mm(FluidProgram.CurrentOrDefault().MotionSettings.WeightAcc)); Log.Dprint("Decel Distance COMPUTE speed=" + speed + ", WeightAcc=" + FluidProgram.CurrentOrDefault().MotionSettings.WeightAcc + ", distance=" + decelDistance); } else { decelDistance = lineParam.DecelDistance; } // 计算加速区间起始位置和减速区间结束位置 PointD accStart = calAccStartPosition(start, end, accDistance); PointD decelEnd = calDecelEndPosition(start, end, decelDistance); // 计算点胶位置 double intervalSec; PointD[] points = calNormalLinePoints(start, end, lineParam, speed, out intervalSec); accStartPoint = accStart; decelEndPoint = decelEnd; runSpeed = speed; linePoints = points; fluidIntervalSec = intervalSec; }
public void Update(FluidProgram fluidProgram) { DrawWorkPiece drawWorkpiece; List <DrawPattern> drawPatterns; drawingParser.ParseFluidProgram(fluidProgram, out drawWorkpiece, out drawPatterns); this.patterns = drawPatterns; foreach (var item in drawPatterns) { item.SetupAll(); } this.workPiece = null; this.workPiece = drawWorkpiece; this.workPiece.SetupAll(); this.enterPatternNo = patterns.Count - 1; }
private bool ResultsIsRight() { if (Results.Count == 0) { this.SaveResult(FluidProgram.CurrentOrDefault().RuntimeSettings.CustomParam.RTVParam.DataLocalPathDir); return(false); } foreach (var item in this.Results) { if (Convert.ToDouble(item[0]) > Convert.ToDouble(item[1]) || Convert.ToDouble(item[0]) < Convert.ToDouble(item[2])) { return(false); } if (Convert.ToDouble(item[3]) > Convert.ToDouble(item[4]) || Convert.ToDouble(item[3]) < Convert.ToDouble(item[5])) { return(false); } } return(true); }
private void DispensingPot() { this.btnPrev.Enabled = false; this.btnNext.Enabled = false; this.grpVavelParam.Enabled = false; this.lblTitle.Text = this.lblTip[3]; this.dotStyle = (DotStyle)this.cbxDotStyle.SelectedIndex; this.dotParam = FluidProgram.CurrentOrDefault().ProgramSettings.GetDotParam(this.dotStyle); Task.Factory.StartNew(new Action(() => { Machine.Instance.Robot.MoveSafeZAndReply(); Result result; double dot1Z;//, dot2Z, dot3Z; result = this.HeightMeasure(out dot1Z); if (!result.IsOk) { this.btnPrev.Enabled = true; return; } result = Machine.Instance.Valve2.DoPurgeAndPrime(); if (!result.IsOk) { this.btnPrev.Enabled = true; return; } this.ContinueDot(dot1Z); this.BeginInvoke(new Action(() => { this.btnPrev.Enabled = true; this.btnNext.Enabled = true; })); })); }
/// <summary> /// 根据路径得到脚本程序 /// </summary> /// <param name="programPath"></param> /// <returns></returns> private FluidProgram GetProgram(string programPath) { if (programPath == null) { return(null); } Stream fstream = null; try { FluidProgram program = FluidProgram.GetProgram(fstream, programPath); //如果不在空闲时,则返回 if (Executor.Instance.CurrProgramState != Executor.ProgramOuterState.IDLE && Executor.Instance.CurrProgramState != Executor.ProgramOuterState.ABORTED) { return(null); } //进行语法检查 Result rst = program.Parse(); if (!rst.IsOk) { MessageBox.Show("该程序存在语法错误,无法加载!"); return(null); } return(program); } catch (Exception) { return(null); } finally { if (fstream != null) { fstream.Close(); } } }
public EditMoveLocMetro(FluidProgram program, MoveToLocationCmdLine moveToLocationCmdLine) { InitializeComponent(); this.program = program; if (moveToLocationCmdLine == null) { isCreating = true; this.moveToLocationCmdLine = new MoveToLocationCmdLine(); } else { isCreating = false; this.moveToLocationCmdLine = moveToLocationCmdLine; } //this.ReadLanguageResources(); refreshList(); if (this.moveToLocationCmdLine != null) { this.moveToLocationCmdLineBackUp = (MoveToLocationCmdLine)this.moveToLocationCmdLine.Clone(); } }
public void SaveFile(FluidProgram program) { if (program == null) { return; } if (FluidProgram.CurrentFilePath == string.Empty) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "*.flu|*.*"; sfd.FileName = program.Name; sfd.InitialDirectory = System.IO.Directory.GetCurrentDirectory() + "\\G"; if (sfd.ShowDialog() == DialogResult.OK) { FluidProgram.CurrentFilePath = FileUtils.FormatFilePath(sfd.FileName, "flu"); MsgCenter.Broadcast(Constants.MSG_SAVE_PROGRAM, null, FluidProgram.CurrentFilePath); } } else { MsgCenter.Broadcast(Constants.MSG_SAVE_PROGRAM, null, FluidProgram.CurrentFilePath); } }