public static ColorMode[] PossibleColorModes(LightChannel channel) { switch (channel) { case LightChannel.Both: return(new[] { ColorMode.Fixed, ColorMode.Breathing, ColorMode.Fading, ColorMode.CoveringMarquee, ColorMode.Pulse, ColorMode.SpectrumWave }); case LightChannel.Logo: return(new[] { ColorMode.Fixed, ColorMode.Breathing, ColorMode.Fading, ColorMode.Pulse, ColorMode.SpectrumWave }); case LightChannel.Rim: return(new[] { ColorMode.Fixed, ColorMode.Breathing, ColorMode.Fading, ColorMode.Marquee, ColorMode.CoveringMarquee, ColorMode.Pulse, ColorMode.SpectrumWave, ColorMode.Alternating, ColorMode.Wings, ColorMode.TaiChi, ColorMode.WaterCooler, ColorMode.Loading }); default: System.Diagnostics.Debug.WriteLine("Fall through should not have happened!"); return(null); } }
private void OnLightValueChanged(LightChannel channel, int value) { if (LightValueChanged != null) { LightValueChanged(channel, value); } }
/// <summary> /// 儲存程式編輯 /// </summary> /// <param name="macroName">程式編輯名稱</param> /// <param name="macroGuid">程式編輯 ID</param> /// <param name="shapeModelFilepath">程式編輯模型檔案路徑</param> /// <param name="note">程式編輯描述</param> /// <param name="trainingImage">程式編輯訓練影像二元檔</param> /// <param name="exportUnit">輸出單位</param> /// <param name="matchingParamData">模型參數二元檔</param> /// <param name="measureBinaryData">測量資料二元檔</param> /// <param name="measureAssistantParamData">測量參數二元檔</param> /// <param name="upperLight">上光源</param> /// <param name="bottomLight">下光源</param> /// <param name="findedShapeViewModel">Matching 模型資訊</param> /// <param name="loginUser">登入者</param> /// <param name="trainingImageFilepath">程式編輯訓練影像實體路徑</param> /// <param name="snapshot">程式編輯縮圖二元檔</param> /// <param name="objectXLength">物件大小 X</param> /// <param name="objectYLength">物件大小 Y</param> /// <param name="technicalDrawingModel">工程圖資訊</param> /// <returns></returns> public static bool SaveMacroPlan(string macroName, string macroGuid, string shapeModelFilepath, string note, Binary trainingImage , string exportUnit, Binary matchingParamData, Binary measureBinaryData, Binary measureAssistantParamData , LightChannel upperLight, LightChannel bottomLight , ShapeViewModel findedShapeViewModel, string loginUser , string trainingImageFilepath , Binary snapshot , double objectXLength, double objectYLength , XDocument technicalDrawingModel) { bool success = true; try { MacroPlan plan = _dc.MacroPlan.SingleOrDefault(p => p.MacroGuid == macroGuid); var isUpdate = (plan != null); if (!isUpdate) { plan = new MacroPlan() { CreateBy = loginUser, CreateOn = DateTime.Now, MacroGuid = macroGuid }; } plan.MacroName = macroName; plan.ShapeModelFilepath = shapeModelFilepath; plan.Note = note; plan.TrainingImage = trainingImage; plan.TrainingImageFilepath = trainingImageFilepath; plan.ExportUnit = exportUnit; plan.MatchingParamBinaryData = matchingParamData; plan.MeasureBinaryData = measureBinaryData; plan.UpperLightSwitch = (upperLight.OnOff == LightControl.LightSwitch.On); plan.UpperLightValue = upperLight.Intensity.ToString("d3"); plan.BottomLightSiwtch = (bottomLight.OnOff == LightControl.LightSwitch.On); plan.BottomLigthValue = bottomLight.Intensity.ToString("d3"); plan.ModifiedOn = DateTime.Now; plan.ModifiedBy = loginUser; plan.MeasureAssistantBinaryData = measureAssistantParamData; plan.ModelRow = findedShapeViewModel.Row; plan.ModelCol = findedShapeViewModel.Col; plan.ModelAngle = findedShapeViewModel.Angle; plan.IsDeleted = false; plan.Snapshot = snapshot; plan.ObjectXLength = objectXLength; plan.ObjectYLength = objectYLength; plan.TechnicalDrawingModel = XElement.Load(technicalDrawingModel.CreateReader()); if (!isUpdate) { _dc.MacroPlan.InsertOnSubmit(plan); } _dc.SubmitChanges(); } catch (Exception ex) { success = false; Hanbo.Log.LogManager.Error(ex.Message); } return(success); }
private void InitializeLightChannel(LightChannel channel) { if (!this.LightInfoCollection.ContainsKey(channel)) { this.LightInfoCollection.Add(channel, new LightInfo(this, channel)); } SetLightValue(channel, this.LightInfoCollection[channel].DefaultValue); }
public LightningManager(LightChannel observedChannel) { lightChannel = observedChannel; availableModes = new List <LightSetting>(); BuildLightOptions(); menuItems = MenuFactory(availableModes); animationSpeed = AnimationSpeed.Normal; selectedSetting = availableModes[0]; }
public LightChannelControl(ILight parent, LightChannel channel) { InitializeComponent(); _parent = parent; this.Channel = channel; this.grpChannel.Text = _parent.LightInfoCollection[this.Channel].Name; this.nudLightValue.Value = _parent.GetLightValue(this.Channel); this.ledLighSwitch.On = this.nudLightValue.Value > 0 ? true : false; _isInitialized = true; }
private DPA6024Channel LightChannelTranslate(LightChannel channel) { if (channel == LightChannel.CHAll) { return(DPA6024Channel.All); } else { return((DPA6024Channel)(channel + 1)); } }
public void SaveMacroPlanTest(string imagepath) { //assign var shapemodelpath = "filepath"; var note = "note"; var exportUnit = "mm"; var image = new HImage(imagepath); var imageBinData = new Binary(ImageConventer.ConvertHalconImageToByteArray(image, false)); var matchingParam = new MatchingParam(); var matchingParamByteArray = ModelSerializer.DoSerialize(matchingParam); var matchingParamBinData = new Binary(matchingParamByteArray); BindingList <GeoDataGridViewModel> a = new BindingList <GeoDataGridViewModel>(); a.Add(new GeoDataGridViewModel() { RecordID = "aaa" }); var measureBinData = ModelSerializer.DoSerialize(a); //BindingList a; var ma = new MeasureAssistant(); var maParam = ma.GetMeasureAssistantParam(); var maParamBin = ModelSerializer.DoSerialize(maParam); LightChannel upper = new LightChannel() { Channel = "00", Intensity = 100, OnOff = LightSwitch.On }; LightChannel bottom = new LightChannel() { Channel = "01", Intensity = 200, OnOff = LightSwitch.OFF }; //act var success = SDMSRepo.SaveMacroPlan("Test", Guid.NewGuid().ToString(), shapemodelpath, note, imageBinData, exportUnit, matchingParamBinData, measureBinData, maParamBin, upper, bottom, new ShapeViewModel() { }, "system", ""); //assert Assert.True(success); }
public LightInfo(ILight parent, LightChannel channel) { _parent = parent; this.Channel = channel; if (parent.ParameterType == ParameterType.System) { _iniFile = new IniFile(parent.ParameterFolderPath, parent.DeviceName); } else { _iniFile = new IniFile(RecipeInfoManager.GetInstance().ActiveRecipe.GetRecipePath(), parent.DeviceName); } if (string.IsNullOrEmpty(this.Name)) { this.Name = channel.ToString(); } }
/// <summary> /// 设置通道值 /// </summary> /// <param name="module"></param> /// <param name="camera"></param> /// <param name="channel"></param> /// <param name="value"></param> private void SetChannelValue(Module module, Camera camera, LightChannel channel, int value) { byte value1 = (byte)(value / 100); byte value2 = (byte)(value % 100 / 10); byte value3 = (byte)(value % 10); byte[] senByte = new byte[10]; senByte[0] = 0x02; senByte[1] = 0x4C; senByte[2] = 0x30; senByte[3] = 0x30; senByte[4] = (byte)(0x30 + channel); senByte[5] = value1; //Byte.Parse(Encoding.GetEncoding("Unicode")(new char[] { char.Parse(BAI.ToString()) })[0].ToString()); senByte[6] = value2; //Byte.Parse(Encoding.GetEncoding("Unicode").GetBytes(new char[] { char.Parse(SHI.ToString()) })[0].ToString()); senByte[7] = value3; //Byte.Parse(Encoding.GetEncoding("Unicode").GetBytes(new char[] { char.Parse(GE.ToString()) })[0].ToString()); senByte[8] = 0x0D; senByte[9] = 0x00; this.LightPort[this.CameraList[module][camera].ProtName].Write(senByte, 0, senByte.Length); }
public int GetLightValue(LightChannel channel) { return(GetLightValue(LightChannelTranslate(channel))); }
public void SetLightValue(LightChannel channel, int lightValue) { SetLightValue(LightChannelTranslate(channel), lightValue); }
public void SwitchLight(LightChannel channel, bool lightSwitch) { SwitchLight(LightChannelTranslate(channel), lightSwitch); }
private CobraSlimChannel LightChannelTranslate(LightChannel channel) { return((CobraSlimChannel)channel); }
public ControlBlock(bool forwardDirection, bool alternateMoving, LightChannel channels) { direction = forwardDirection; alternatingMoving = alternateMoving; channelMode = channels; }
private PD3Channel LightChannelTranslate(LightChannel channel) { return((PD3Channel)channel); }
public static bool SaveMacroPlan(string macroName, string macroGuid, string shapeModelFilepath, string note, Binary trainingImage, string exportUnit, Binary matchingParamData, Binary measureBinaryData, Binary measureAssistantParamData, LightChannel upperLight, LightChannel bottomLight, ShapeViewModel shapeView, string loginUser , string trainingImageFilepath , double objectXLength, double objectYLength) { return(SaveMacroPlan(macroName, macroGuid, shapeModelFilepath, note, trainingImage, exportUnit, matchingParamData, measureBinaryData, measureAssistantParamData, upperLight, bottomLight, shapeView, loginUser , trainingImageFilepath, null , objectXLength, objectYLength, null)); }