public void Set(PinSetting[] setting, DMap[] drummap) { Setting = setting; DrumMap = drummap; ShowChannels(-1); }
/// <summary> /// Sets new properties to the Pin. /// Typically used when the pin is attached. /// </summary> /// <param name="pinSetting"></param> /// <param name="equipmentName"></param> public void SetPinParameters(PinSetting pinSetting, string equipmentName) { if (_gPIOPinModel != null) { _gPIOPinModel.SetPinParameters(pinSetting, equipmentName); } OnPropertyChanged("AttachedEquipmentViewModelName"); OnPropertyChanged("PinSetting"); }
/// <summary> /// Ensures that the value can be found in PinSettingList. /// </summary> /// <param name="pinSetting"></param> /// <returns></returns> public bool IsPinSettingPossible(PinSetting pinSetting) { foreach (PinSetting possiblePinSetting in _possiblePinSettingList) { if (possiblePinSetting == pinSetting) { return(true); } } return(false); }
/// <summary> /// Returns an Observable Collection of GPIOPinModels that have the specified PinSetting property. /// Called by the GetUnattachedPinsByThisPinSetting property. /// </summary> /// <param name="pinSetting"></param> /// <returns></returns> public ObservableCollection <GPIOPinViewModel> GetUnattachedPinsByPinSetting(PinSetting pinSetting) { ObservableCollection <GPIOPinViewModel> pinList = new ObservableCollection <GPIOPinViewModel>(); for (int categoryIndex = 0; categoryIndex < _gPIOPinSettingCategories.Count; categoryIndex++) { if (_gPIOPinSettingCategories[categoryIndex] == pinSetting) { foreach (GPIOPinViewModel gPIOPinViewModel in _gPIOPinBySettingList[categoryIndex]) { if (gPIOPinViewModel.IsAttached == false) { pinList.Add(gPIOPinViewModel); } } } } return(pinList); }
/// <summary> /// Sets new properties to the Pin. /// Typically used when the pin is attached. /// </summary> /// <param name="pinSetting"></param> /// <param name="equipmentName"></param> public void SetPinParameters(PinSetting pinSetting, string equipmentName) { PinSetting = pinSetting; _attachedEquipmentModelName = equipmentName; }
/// <summary> /// Ensures that the value can be found in PinSettingList. /// </summary> /// <param name="pinSetting"></param> /// <returns></returns> public bool IsPinSettingPossible(PinSetting pinSetting) { return((_gPIOPinModel.IsPinSettingPossible(pinSetting)) ? true : false); }
/// <summary> /// Attaches a GPIOPinModel while resetting the previously attached Pin. /// </summary> /// <param name="attachingPinModel"></param> /// <param name="pinModelField"></param> /// <param name="pinSetting"></param> public static void AttachGPIOPinModel(GPIOPinModel attachingPinModel, ref GPIOPinModel pinModelField, string attachedEquipmentName, PinSetting pinSetting) { //Detach the current pin. if (pinModelField != null) { pinModelField.ResetPinParameters(); } //Detach the new pin. if (attachingPinModel != null) { attachingPinModel.ResetPinParameters(); } //Attach the new pin. if (attachingPinModel == null) { pinModelField = null; } else if (attachingPinModel.IsPinSettingPossible(pinSetting) == true) { pinModelField = attachingPinModel; pinModelField.SetPinParameters(pinSetting, attachedEquipmentName); } }
/// <summary> /// Called by this class' GPIOPinViewModelList property setters. /// </summary> /// <param name="pinViewModelField"></param> /// <param name="possiblePinViewModelListField"></param> /// <param name="pinSetting"></param> public void RefreshGPIOPinViewModelList(ref GPIOPinViewModel pinViewModelField, ref ObservableCollection <GPIOPinViewModel> possiblePinViewModelListField, PinSetting pinSetting) { possiblePinViewModelListField = GetUnattachedPinsByPinSetting(pinSetting); possiblePinViewModelListField.Insert(0, pinViewModelField); //The first option of the list is to keep the same GPIO Pin. //The rest of the list is populated by unattached GPIO Pins. }
private void UpdateYSwitch(bool Head, PinSetting PS) { string HR = Head ? "Head" : "Rim"; GroupBox GB = Head ? gbHead : gbRim; GB.Controls["lbl" + HR + "Note"].Text = "Shaft Note:"; GB.Controls["lbl" + HR + "ScanTime"].Text = "Switch Time:"; GB.Controls["lbl" + HR + "MaskTime"].Text = "Choke Time:"; /*GB.Controls["lblOpenThresold" + HR].Text = "Bell Thresold:"; GB.Controls["lblOpenNote" + HR].Text = "Bell Note:"; GB.Controls["lblOpenThresold" + HR].Visible = true; GB.Controls["lblOpenNote" + HR].Visible = true; GB.Controls["nudOpenThresold" + HR].Visible = true; GB.Controls["dudOpenNote" + HR].Visible = true; GB.Controls["btnOpenThresold" + HR].Visible = true; GB.Controls["btnOpenNote" + HR].Visible = true;*/ GB.Controls["lblChoke" + HR].Visible = true; GB.Controls["lblChoke" + HR].Text = "Choke:"; GB.Controls["dudChoke" + HR].Visible = true; GB.Controls["nudSensibility" + HR].Visible = false; GB.Controls["btnChoke" + HR].Visible = true; /*lblAlternative.Visible = false; lblAlternativeThresold.Visible = false; lblAlternativeNote.Visible = false; dudAlternativeNote.Visible = false; nudAlternativeThresold.Visible = false; GB.Controls["btnNote" + HR].Enabled = true; GB.Controls["dudNote" + HR].Enabled = true; for (int n = 0; n < dudOpenNoteRim.Items.Count; n++) { if (((Note)dudOpenNoteRim.Items[n]).Value == PS.DualNote) dudOpenNoteRim.SelectedIndex = n; } nudOpenThresoldRim.Value = PS.DualThresold; //Dual if (PS.Dual == 255) { if (Head) chkPiezoSuppression.Checked = false; chkDualPiezoSwitch.Checked = false; return; } if (Head) chkPiezoSuppression.Checked = true; chkDualPiezoSwitch.Checked = true;*/ }
public void Draw(DMap[] DrumMap, PinSetting[] Setting, HHSetting hhSetting) { _DrumMap = DrumMap; _Setting = Setting; _hhSetting = hhSetting; }
private void UpdatePiezo(bool Head, PinSetting PS) { string HR = Head ? "Head" : "Rim"; GroupBox GB = Head ? gbHead : gbRim; GB.Controls["lbl" + HR + "Note"].Text = "Note:"; GB.Controls["lbl" + HR + "ScanTime"].Text = "Scan Time:"; GB.Controls["lbl" + HR + "MaskTime"].Text = "Mask Time:"; //GB.Controls["lblOpenThresold" + HR].Visible = false; //GB.Controls["lblOpenNote" + HR].Visible = false; //GB.Controls["nudOpenThresold" + HR].Visible = false; //GB.Controls["dudOpenNote" + HR].Visible = false; //GB.Controls["btnOpenThresold" + HR].Visible = false; //GB.Controls["btnOpenNote" + HR].Visible = false; GB.Controls["lblChoke" + HR].Text="Gain:"; GB.Controls["lblChoke" + HR].Visible = true; GB.Controls["dudChoke" + HR].Visible = false; GB.Controls["nudSensibility" + HR].Visible = true; GB.Controls["btnChoke" + HR].Visible = true; //Dual Piezo-Piezo /*if (PS.Dual == 255) { GB.Controls["btnNote" + HR].Enabled = true; GB.Controls["dudNote" + HR].Enabled = true; chkDualPiezo.Checked = false; dudDualA.Text = "---"; dudDualB.Text = "---"; dudDualC.Text = "---"; dudDualD.Text = "---"; tbHead.Value = 128; tbRim.Value = 128; labelHR.Text = "H:--- R:---"; if (Head) chkPiezoSuppression.Checked = false; return; } if (Head) chkPiezoSuppression.Checked = true; for (int n = 0; n < dudDualA.Items.Count; n++) { if (Head) { if (((Note)dudDualD.Items[n]).Value == PS.DualNote) dudDualD.SelectedIndex = n; } else { if (((Note)dudDualA.Items[n]).Value == PS.DualNote) dudDualA.SelectedIndex = n; } } chkDualPiezo.Checked = true; GB.Controls["dudNote" + HR].Text = "---"; GB.Controls["btnNote" + HR].Enabled = false; GB.Controls["dudNote" + HR].Enabled = false; //Dual Piezo-Switch chkPiezoSuppression.Checked = true; if (Head) tbHead.Value = PS.DualThresold; else tbRim.Value = 255 - PS.DualThresold; pbDualZone.Refresh();*/ }
private void UpdateHHs(bool Head, PinSetting PS) { string HR = Head ? "Head" : "Rim"; GroupBox GB = Head ? gbHead : gbRim; GB.Controls["lbl" + HR + "Note"].Text = "Close:"; GB.Controls["lbl" + HR + "ScanTime"].Text = "Switch Time:"; GB.Controls["lbl" + HR + "MaskTime"].Text = "Choke Time:"; //GB.Controls["lblOpenThresold" + HR].Text = "Open Thresold:"; //GB.Controls["lblOpenNote" + HR].Text = "Open Note:"; //GB.Controls["lblOpenThresold" + HR].Visible = true; //GB.Controls["lblOpenNote" + HR].Visible = true; //GB.Controls["nudOpenThresold" + HR].Visible = true; //GB.Controls["dudOpenNote" + HR].Visible = true; //GB.Controls["btnOpenThresold" + HR].Visible = true; //GB.Controls["btnOpenNote" + HR].Visible = true; GB.Controls["lblChoke" + HR].Visible = true; GB.Controls["lblChoke" + HR].Text = "Choke:"; GB.Controls["dudChoke" + HR].Visible = true; GB.Controls["nudSensibility" + HR].Visible = false; GB.Controls["btnChoke" + HR].Visible = true; }
private void UpdateHHC(PinSetting PS) { /*nudHH_AThresold.Value = hhSetting.A_Thresold; nudHH_BThresold.Value = hhSetting.B_Thresold; nudHH_CThresold.Value = hhSetting.C_Thresold; nudHH_DThresold.Value = hhSetting.D_Thresold; nudHH_FootCloseThresold.Value = hhSetting.FootCloseThresold; nudHH_FootSplashThresold.Value = hhSetting.FootSplashThresold; for (int n = 0; n < dudHH_A.Items.Count; n++) { if (((Note)dudHH_A.Items[n]).Value == hhSetting.A_Note) dudHH_A.SelectedIndex = n; if (((Note)dudHH_B.Items[n]).Value == hhSetting.B_Note) dudHH_B.SelectedIndex = n; if (((Note)dudHH_C.Items[n]).Value == hhSetting.C_Note) dudHH_C.SelectedIndex = n; if (((Note)dudHH_D.Items[n]).Value == hhSetting.D_Note) dudHH_D.SelectedIndex = n; if (((Note)dudHH_FootCloseNote.Items[n]).Value == hhSetting.FootCloseNote) dudHH_FootCloseNote.SelectedIndex = n; if (((Note)dudHH_FootSplashNote.Items[n]).Value == hhSetting.FootSplashNote) dudHH_FootSplashNote.SelectedIndex = n; } */ }
private void UpdateHH(PinSetting PS) { string HR = "Head"; GroupBox GB = gbHead; GB.Controls["lbl" + HR + "Note"].Text = "Close:"; GB.Controls["lbl" + HR + "ScanTime"].Text = "Scan Time:"; GB.Controls["lbl" + HR + "MaskTime"].Text = "Mask Time:"; //GB.Controls["lblOpenThresold" + HR].Text = "Open Thresold:"; //GB.Controls["lblOpenNote" + HR].Text = "Open Note:"; //GB.Controls["lblOpenThresold" + HR].Visible = true; //GB.Controls["lblOpenNote" + HR].Visible = true; //GB.Controls["nudOpenThresold" + HR].Visible = true; //GB.Controls["dudOpenNote" + HR].Visible = true; //GB.Controls["btnOpenThresold" + HR].Visible = true; //GB.Controls["btnOpenNote" + HR].Visible = true; GB.Controls["lblChoke" + HR].Visible = true; GB.Controls["lblChoke" + HR].Text = "HHC:"; GB.Controls["dudChoke" + HR].Visible = false; GB.Controls["nudSensibility" + HR].Visible = false; GB.Controls["btnChoke" + HR].Visible = true; cbHH_HHC.Visible = true; //Dual /*if (PS.Dual == 255) return; for (int i = 0; i < DrumMap.Length; i++) { if (PS.Dual == DrumMap[i].Head) cbHH_HHC.SelectedItem = DrumMap[i].Name; } nudHH_AThresold.Value = hhSetting.A_Thresold; nudHH_BThresold.Value = hhSetting.B_Thresold; nudHH_CThresold.Value = hhSetting.C_Thresold; nudHH_DThresold.Value = hhSetting.D_Thresold; nudHH_FootCloseThresold.Value = hhSetting.FootCloseThresold; nudHH_FootSplashThresold.Value = hhSetting.FootSplashThresold; for (int n = 0; n < dudHH_A.Items.Count; n++) { if (((Note)dudHH_A.Items[n]).Value == hhSetting.A_Note) dudHH_A.SelectedIndex = n; if (((Note)dudHH_B.Items[n]).Value == hhSetting.B_Note) dudHH_B.SelectedIndex = n; if (((Note)dudHH_C.Items[n]).Value == hhSetting.C_Note) dudHH_C.SelectedIndex = n; if (((Note)dudHH_D.Items[n]).Value == hhSetting.D_Note) dudHH_D.SelectedIndex = n; if (((Note)dudHH_FootCloseNote.Items[n]).Value == hhSetting.FootCloseNote) dudHH_FootCloseNote.SelectedIndex = n; if (((Note)dudHH_FootSplashNote.Items[n]).Value == hhSetting.FootSplashNote) dudHH_FootSplashNote.SelectedIndex = n; }*/ }
/// <summary> /// Attaches a GPIOPinViewModel while resetting the previously attached Pin. /// </summary> /// <param name="attachingPinViewModel"></param> /// <param name="pinViewModelField"></param> /// <param name="pinSetting"></param> public static void AttachGPIOPinViewModel(GPIOPinViewModel attachingPinViewModel, ref GPIOPinViewModel pinViewModelField, PinSetting pinSetting, string attachingEquipmentName) { //Detach the previous pin. if (pinViewModelField != null) { pinViewModelField.ResetPinParameters(); } //Attach the new pin. if (attachingPinViewModel == null) { pinViewModelField = null; } else if (attachingPinViewModel.IsPinSettingPossible(pinSetting)) { pinViewModelField = attachingPinViewModel; pinViewModelField.UpdateProperties(); } }