public ClMacroData(ClMacroData input) : this() { this.IsKeyDown = input.IsKeyDown.Select(ele => ele).ToList(); this.Keys = input.Keys.Select(ele => new ClKey(ele)).ToList(); this.Index = input.Index; }
private void OpenMacroMenu() { var lst = new List <string> { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }; var fm = new FmSelectTextDialog(lst, lst.Select(ele => "macro" + ele).ToList(), "Select a macro key to edit"); fm.ShowModal(); var outputInd = fm.OutputIndex; if (outputInd >= 0) { if (!MdSessionData.OpenedMacroEdit) { if (MdSessionData.CurrentLayout.KeyDatas.Count == 0) { MessageBox.Show("Error: You must first select a device"); } else { MdSessionData.OpenedMacroEdit = true; var lay = MdSessionData.CurrentLayout; var dataCont = new ClMacroDataContainer(); var hasData = false; foreach (var ele in lay.AddonDatas) { if (ele.GetType() == ClMacroDataContainer.DATA_TYPE) { hasData = true; dataCont = ele as ClMacroDataContainer; } } if (!hasData) { lay.AddonDatas.Add(dataCont); } var data = new ClMacroData(); data.Index = outputInd; hasData = false; if (dataCont != null) { foreach (var ele in dataCont.MacroKeys) { if (ele.Index == outputInd) { hasData = true; data = ele; } } if (!hasData) { dataCont.MacroKeys.Add(data); } } var mdialog = new FmMacroEdit(new ClMacroData(data)); mdialog.Show(); } } else { MessageBox.Show("Error: Macro editor already opened"); } } }
public FmMacroEdit(ClMacroData data) : this() { this.Data = new ClMacroData(data); RefreshStack(); }