Exemplo n.º 1
0
 public FmMacroEdit(MacroData data) : this()
 {
     this.Data = new MacroData(data);
     RefreshStack();
 }
Exemplo n.º 2
0
        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 MacroDataContainer();
                        var hasData  = false;
                        foreach (var ele in lay.AddonDatas)
                        {
                            if (ele.GetType() == MacroDataContainer.DATA_TYPE)
                            {
                                hasData  = true;
                                dataCont = ele as MacroDataContainer;
                            }
                        }

                        if (!hasData)
                        {
                            lay.AddonDatas.Add(dataCont);
                        }

                        var data = new MacroData();
                        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 MacroData(data));
                        mdialog.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Error: Macro editor already opened");
                }
            }
        }
Exemplo n.º 3
0
 public MacroData(MacroData input) : this()
 {
     this.IsKeyDown = input.IsKeyDown.Select(ele => ele).ToList();
     this.Keys      = input.Keys.Select(ele => new Key(ele)).ToList();
     this.Index     = input.Index;
 }