Esempio n. 1
0
        public bool?ApplyScriptTo(string scriptName, string path, object scriptObj, bool prompt = true)
        {
            try
            {
                var script = scriptObj as string;

                if (script == null)
                {
                    throw new InvalidOperationException("Passed in script object is not a string");
                }

                var fileNameInRecordFolder = CalculateMD5Hash(DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString());
                var fullPathToMacroFile    = Path.Combine(path, fileNameInRecordFolder); // path/md5string
                var recordsFileFullPath    = Path.Combine(path, "records");              // path/records
                Dictionary <string, NoxRecordFormat> recordsFileContent = null;

                LoadRecord(recordsFileFullPath, ref recordsFileContent);

                var isNameExisted = recordsFileContent.FirstOrDefault(i => i.Value.Name.Equals(scriptName)).Value;
                var key           = recordsFileContent.FirstOrDefault(i => i.Value.Name.Equals(scriptName)).Key;

                if (isNameExisted == null)
                {
                    //File.WriteAllText(fullPathToMacroFile, script);
                    WriteAllText(fullPathToMacroFile, script);
                    recordsFileContent.Add(fileNameInRecordFolder, new NoxRecordFormat {
                        Name = scriptName
                    });
                }
                else
                {
                    MessageResult overwriteChoice = MessageResult.Yes;

                    if (prompt == true)
                    {
                        overwriteChoice = messageBoxService.ShowMessageBox("Macro's name already existed. Do you want to overwrite?", "Overwrite?", MessageButton.YesNo, MessageImage.Question);
                    }

                    if (overwriteChoice == MessageResult.Yes)
                    {
                        //File.WriteAllText(Path.Combine(path, key), script);
                        WriteAllText(Path.Combine(path, key), script);
                    }
                    else
                    {
                        return(null); //user press No return null
                    }
                }

                //File.WriteAllText(recordsFileFullPath, JsonConvert.SerializeObject(recordsFileContent, Formatting.Indented));
                WriteAllText(recordsFileFullPath, JsonConvert.SerializeObject(recordsFileContent, Formatting.Indented));

                return(true);
            }
            catch (Exception ex)
            {
                messageBoxService.ShowMessageBox(ex.Message + "\n" + "Something wrong. Cannot convert. Maybe try to delete the record file then try again");
                return(false);
            }
        }
Esempio n. 2
0
        public bool?ApplyScriptTo(string scriptName, string path, object scriptObj, bool prompt = true)
        {
            try
            {
                if (!(scriptObj is List <string> script))
                {
                    throw new InvalidOperationException("Passed in script object is not List<string>");
                }

                var fileNameInRecordFolder = scriptName;
                var fullPathToMacroFile    = Path.Combine(path, fileNameInRecordFolder); // path/scriptname/

                //check existed
                bool isExisted = /*Directory.Exists(fullPathToMacroFile)*/ IsDirectoryExist(fullPathToMacroFile);

                if (!isExisted)
                {
                    //Directory.CreateDirectory(fullPathToMacroFile);
                    CreateFolder(fullPathToMacroFile);
                    WriteToDisk(script, fullPathToMacroFile);
                }
                else
                {
                    MessageResult overwriteChoice = MessageResult.Yes;

                    if (prompt == true)
                    {
                        overwriteChoice = messageBoxService.ShowMessageBox("Macro's name already existed. Do you want to overwrite?", "Overwrite?", MessageButton.YesNo, MessageImage.Question);
                    }

                    if (overwriteChoice == MessageResult.Yes)
                    {
                        WriteToDisk(script, fullPathToMacroFile);
                    }
                    else
                    {
                        return(null); //user press No return null
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                messageBoxService.ShowMessageBox(ex.Message + "\n" + "Something wrong. Cannot convert. Maybe try to delete the " + scriptName + " folder then try again");
                return(false);
            }
        }
Esempio n. 3
0
        public virtual bool?ApplyScriptTo(string scriptName, string path, object scriptObj, bool prompt = true)
        {
            try
            {
                if (!(scriptObj is string script))
                {
                    throw new InvalidOperationException("Passed in script object is not a string");
                }

                var fileNameInRecordFolder = scriptName + FileExtension;
                var fullPathToMacroFile    = Path.Combine(path, fileNameInRecordFolder); // path/scriptname.txt

                //check existed
                bool isExisted = /*File.Exists(fullPathToMacroFile)*/ IsFileExist(fullPathToMacroFile);

                if (!isExisted)
                {
                    //File.WriteAllText(fullPathToMacroFile, script);
                    WriteAllText(fullPathToMacroFile, script);
                }
                else
                {
                    MessageResult overwriteChoice = MessageResult.Yes;

                    if (prompt == true)
                    {
                        overwriteChoice = messageBoxService.ShowMessageBox("Macro's name already existed. Do you want to overwrite?", "Overwrite?", MessageButton.YesNo, MessageImage.Question);
                    }

                    if (overwriteChoice == MessageResult.Yes)
                    {
                        //File.WriteAllText(fullPathToMacroFile, script);
                        WriteAllText(fullPathToMacroFile, script);
                    }
                    else
                    {
                        return(null); //user press No return null
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                messageBoxService.ShowMessageBox(ex.Message + "\n" + "Something wrong. Cannot convert. Maybe try to delete the record file then try again");
                return(false);
            }
        }
Esempio n. 4
0
        private async Task LogOut(bool closeTill)
        {
            log.Debug("LogoutViewModel:Started Logout process.");
            var result = posManager.PosLogout(closeTill);

            if (!result)
            {
                log.Error("LogoutViewModel: Logout failed.");
                log.Info("LogoutViewModel: Show MessageBox to user and inform him to retry.");
                var response = messageBoxService.ShowMessageBox("ConnectionLoseWhileLogout", MessageBoxButtonType.OK);
                log.Debug("LogoutViewModel: Close the navigation.");
                await navigationService.Close(this);
            }
            else
            {
                log.Debug("LogoutViewModel: Successful logout.");
                if (App.IsFcsConnected)
                {
                    log.Debug("LogoutViewModel: Fcs is connected. try to sign off.");
                    await App.SignOffAsync();
                }
                else
                {
                    log.Error("LogoutViewModel: Fcs is not connected.Go to LoginViewModel.");
                    await navigationService.Navigate <LoginViewModel>();
                }
            }
        }
 IMessageBoxService _messageBoxService;     // use some IoC mechanism to set this
 public void validation()
 {
     if (...)
     {
         _messageBoxService.ShowMessageBox("enter your name", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private async Task CancelPrepayRefund()
        {
            log.Debug("RefundStatusViewModel: Canceling prepau refund as refund is not approved.");
            messageBoxService.ShowMessageBox("RefundNotApprovedForPrepayRefund", MessageBoxButtonType.OK);
            await posManager.CleanUpSale(posManager.ActiveSale,
                                         posManager.ActiveSale.PumpId, false);

            await GoToHome();
        }
Esempio n. 7
0
 /// <summary>
 /// Method which executes when the Upload Button is clicked.
 /// </summary>
 /// <param name="input">Input to the method.</param>
 private void OnUploadButtonClick(object input)
 {
     _openFileDialogService.ShowFileDialog();
     if (string.IsNullOrEmpty(_openFileDialogService.SelectedFileName))
     {
         logger.Error("Selected File name null or Empty");
         _messageBoxService.ShowMessageBox("Please select a valid File to Upload", "TaxCalculatorApp");
     }
     else
     {
         SelectedFileName = _openFileDialogService.SelectedFileName;
         if (_fileUploaderBackgroundWorker.IsBusy)
         {
             logger.Info("Background Worker already running");
             MessageBox.Show("File Upload in Progress");
         }
         else
         {
             _fileUploaderBackgroundWorker.RunWorkerAsync();
         }
     }
 }
Esempio n. 8
0
        public void OpenRecentFile(string location)
        {
            if (!File.Exists(location))
            {
                _recentFiles.RemoveAt(GetIndex(location));
                _recentFilesInSettings.Remove(location);
                _messageBoxService.ShowMessageBox("File does not exist.", "PMML Validator",
                                                  System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Exclamation);
                return;
            }

            _tabViewModelManager.CreateNewTabForRecentFile(location);
        }
Esempio n. 9
0
        private bool ApplyConvertSetting(MacroViewModel macro)
        {
            if (macro.OriginalX == 0 || double.IsNaN(macro.OriginalX) || macro.OriginalY == 0 || double.IsNaN(macro.OriginalY))
            {
                messageBoxService.ShowMessageBox("The macro doesnt have any resolution set. Please set in in EMM", "Error", MessageButton.OK, MessageImage.Error);
                return(false);
            }

            GlobalData.CustomX   = setting.CustomX;
            GlobalData.CustomY   = setting.CustomY;
            GlobalData.OriginalX = macro.OriginalX;
            GlobalData.OriginalY = macro.OriginalY;
            GlobalData.Emulator  = setting.SelectedEmulator;
            GlobalData.Randomize = setting.Randomize;
            GlobalData.ScaleMode = setting.ScaleMode;

            return(true);
        }
Esempio n. 10
0
        private bool ApplyConvertSetting(MacroTemplate macro)
        {
            GlobalData.CustomX   = setting.CustomX;
            GlobalData.CustomY   = setting.CustomY;
            GlobalData.Emulator  = setting.SelectedEmulator;
            GlobalData.Randomize = setting.Randomize;

            try
            {
                GlobalData.ScaleX = (double)setting.CustomX / macro.OriginalX;
                GlobalData.ScaleY = (double)setting.CustomY / macro.OriginalY;
            }
            catch
            {
                messageBoxService.ShowMessageBox("The macro doesnt have any resolution set. Please set in in EMM", "Error", MessageButton.OK, MessageImage.Error);
                return(false);
            }

            return(true);
        }
        protected override void OnNavigating(WizardNavigationEventArgs eventArgs)
        {
            if (eventArgs.CurrentStep is CustomerOptionalStepViewModel && eventArgs.NavigationType == WizardNavigationType.Next)
            {
                string title   = LocalizationService.GetLocalizedString("CustomerConfirmation");
                string message = LocalizationService.GetLocalizedString("CustomerConfirmationMessage");

                //show Dialog box to confirm creation:
                if (_messageBoxService.ShowMessageBox(title, message, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    //Pause navigation (you must eventually call ContinueNavigation() or CancelNavigation() when you pause navigation)
                    eventArgs.NavigationAction = WizardNavigationAction.Pause;
                    CreateCustomer();
                }
                else
                {
                    eventArgs.NavigationAction = WizardNavigationAction.Cancel;
                }
            }
        }
Esempio n. 12
0
        private bool ApplyConvertSetting(MacroViewModel macroViewModel)
        {
            GlobalData.CustomX   = setting.CustomX;
            GlobalData.CustomY   = setting.CustomY;
            GlobalData.Emulator  = setting.SelectedEmulator;
            GlobalData.Randomize = setting.Randomize;

            try
            {
                GlobalData.ScaleX = (double)setting.CustomX / macroViewModel.OriginalX;
                GlobalData.ScaleY = (double)setting.CustomY / macroViewModel.OriginalY;
            }
            catch
            {
                messageBoxService.ShowMessageBox("Please set the Macro resolution", "Error", MessageButton.OK, MessageImage.Error);
                return(false);
            }

            return(true);
        }
Esempio n. 13
0
        public bool?ApplyScriptTo(string scriptName, string path, object scriptObj, bool prompt = true)
        {
            try
            {
                var script = scriptObj as string;

                if (script == null)
                {
                    throw new InvalidOperationException("Passed in script object is not a string");
                }

                var currentTime = DateTime.Now.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss");
                var section     = Uri.EscapeDataString(currentTime);

                var fullPath = Path.Combine(path, currentTime.Replace("-", string.Empty).Replace(":", string.Empty).Replace(" ", string.Empty) + ".mir");
                var record   = Path.Combine(path, "info.ini");

                //Directory.CreateDirectory(path);
                CreateFolder(path);
                StringBuilder iniFile;
                if (IsFileExist(record))
                {
                    //Read the file into a string array
                    var iniFileStringList = /*File.ReadAllLines(record).ToList()*/ ReadAllLines(record).ToList();

                    //check name exist
                    var name = iniFileStringList.Where(m => m.Equals("name=" + scriptName)).FirstOrDefault();

                    if (name != null) //name exist
                    {
                        //ask overwrite
                        MessageResult overwriteChoice = MessageResult.Yes;

                        if (prompt == true)
                        {
                            overwriteChoice = messageBoxService.ShowMessageBox("Macro's name already existed. Do you want to overwrite?", "Overwrite?", MessageButton.YesNo, MessageImage.Question);
                        }

                        if (overwriteChoice == MessageResult.Yes)
                        {
                            //get the index of file name part in ini
                            var indexOfFileName = iniFileStringList.IndexOf(name) - 1;

                            //convert it to filename
                            var filenameOnDisk = iniFileStringList[indexOfFileName]
                                                 .Replace("-", string.Empty)
                                                 .Replace("%20", string.Empty).Replace("%3A", string.Empty)
                                                 .Replace("[", string.Empty).Replace("]", string.Empty) + ".mir";

                            //overwrite it
                            //File.WriteAllText(Path.Combine(path, filenameOnDisk), script);
                            WriteAllText(Path.Combine(path, filenameOnDisk), script);
                            return(true);
                        }
                        else
                        {
                            return(null);
                        }
                    }

                    iniFile = new StringBuilder(/*File.ReadAllText(record)*/ ReadAllText(record));
                }
                else
                {
                    iniFile = new StringBuilder();
                };

                //Name not exist then just write to disk
                //File.WriteAllText(fullPath, script);
                WriteAllText(fullPath, script);

                //Reconstruct the ini file
                iniFile.AppendLine().Append("[" + section + "]")
                .AppendLine()
                .Append("name=" + scriptName)
                .AppendLine()
                .Append("replayTime=0\nreplayCycles=1\nreplayAccelRates=1\nreplayInterval=0\ncycleInfinite=false\nbNew=false")
                .AppendLine();

                //File.WriteAllText(record, iniFile.ToString());
                WriteAllText(record, iniFile.ToString());

                return(true);
            }
            catch (Exception ex)
            {
                messageBoxService.ShowMessageBox(ex.Message + "\n" + "Something wrong with the records file. Maybe delete it then try again");
                return(false);
            }
        }
Esempio n. 14
0
 private MessageResult UpdateConfirmation()
 {
     return(messageBoxService.ShowMessageBox($"There's a new version available ({updateInfo.Version.ToString(3)}). Do you want to update?\nChangelogs:\n{updateInfo.Changelog}", "Update", MessageButton.YesNo, MessageImage.Information));
 }
Esempio n. 15
0
        private bool CreateDefaultActionIfNotExistedOrOutDated()
        {
            if (File.Exists(filepath))
            {
                //check version to update
                try
                {
                    var defaultActionString = File.ReadAllText(filepath);

                    var loaddefaultAction = JsonConvert.DeserializeObject <DefaultAction>(defaultActionString, new CustomJsonConverter());

                    if (loaddefaultAction.Version.CompareTo(this.defaultAction.Version) >= 0)
                    {
                        return(false);
                    }
                }
                catch
                {
                    messageBoxService.ShowMessageBox("Cannot load default action. Delete DefaultAction in /AEMG then restart the program", "ERROR", MessageButton.OK, MessageImage.Error);
                    return(false);
                }
            }

            if (defaultAction.Dict == null)
            {
                defaultAction.Dict = new Dictionary <Action, List <IAction> >();
            }

            Directory.CreateDirectory(AEMGStatic.AEMG_FOLDER);

            var possibleAction = Enum.GetValues(typeof(Action)).Cast <Action>().ToList();

            foreach (var a in possibleAction)
            {
                defaultAction.Dict.Add(a, new List <IAction>());
            }

            //In Battle
            defaultAction.Dict[Action.ClickFirstCharacter].Add(new Click {
                ActionDescription = "ClickFirstCharacter", ClickPoint = new Point(100, 660), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickSecondCharacter].Add(new Click {
                ActionDescription = "ClickSecondCharacter", ClickPoint = new Point(260, 660), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickThirdCharacter].Add(new Click {
                ActionDescription = "ClickThirdCharacter", ClickPoint = new Point(430, 660), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickFourthCharacter].Add(new Click {
                ActionDescription = "ClickFourthCharacter", ClickPoint = new Point(600, 660), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickFifthCharacter].Add(new Click {
                ActionDescription = "ClickFifthCharacter", ClickPoint = new Point(800, 660), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickSixthCharacter].Add(new Click {
                ActionDescription = "ClickSixthCharacter", ClickPoint = new Point(960, 660), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickDefaultSkill].Add(new Click {
                ActionDescription = "ClickDefaultSkill", ClickPoint = new Point(150, 550), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickFirstSkill].Add(new Click {
                ActionDescription = "ClickFirstSkill", ClickPoint = new Point(380, 550), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickSecondSKill].Add(new Click {
                ActionDescription = "ClickSecondSKill", ClickPoint = new Point(630, 550), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickThirdSkill].Add(new Click {
                ActionDescription = "ClickThirdSkill", ClickPoint = new Point(890, 550), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickSwitch_FrontLine].Add(new Click {
                ActionDescription = "ClickSwitch_FrontLine", ClickPoint = new Point(1130, 550), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickSub].Add(new Click {
                ActionDescription = "ClickSub", ClickPoint = new Point(1130, 660), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickAF].Add(new Click {
                ActionDescription = "ClickAF", ClickPoint = new Point(1200, 80), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ClickAttack].Add(new Click {
                ActionDescription = "ClickAttack", ClickPoint = new Point(1170, 620), WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.Wait].Add(new Wait {
                ActionDescription = "Wait"
            });

            //Food in AD
            defaultAction.Dict[Action.FoodAD].Add(new Click {
                ActionDescription = "Click Menu", ClickPoint = new Point(80, 660), WaitBetweenAction = 1500
            });
            defaultAction.Dict[Action.FoodAD].Add(new Click {
                ActionDescription = "Click Food", ClickPoint = new Point(580, 610), WaitBetweenAction = 1500
            });
            defaultAction.Dict[Action.FoodAD].Add(new Click {
                ActionDescription = "Click Use", ClickPoint = new Point(780, 420), WaitBetweenAction = 1000, Repeat = 4
            });

            //Re eat food after AD
            defaultAction.Dict[Action.ReFoodAD].Add(new Swipe
            {
                ActionDescription = "Move Right A Little",
                PointList         = new List <SwipePoint> {
                    new SwipePoint {
                        Point = new Point(800, 420), SwipeSpeed = 10
                    }, new SwipePoint {
                        Point = new Point(1000, 420), HoldTime = 200, SwipeSpeed = 10
                    }
                },
                WaitBetweenAction = 500
            });
            defaultAction.Dict[Action.ReFoodAD].AddRange(this.GenerateSeriesOfClickBetweenPoint(new Point(1000, 70), new Point(450, 70), 50, "Find Tree"));
            defaultAction.Dict[Action.ReFoodAD].Add(new Click {
                ActionDescription = "Click Yes", ClickPoint = new Point(780, 400), WaitBetweenAction = 1000, Repeat = 10
            });
            defaultAction.Dict[Action.ReFoodAD].AddRange(this.GenerateSeriesOfClickBetweenPoint(new Point(650, 150), new Point(50, 150), 50, "Find Gate"));

            //Run left (for exp encounter)
            defaultAction.Dict[Action.RunLeft].Add(new Swipe
            {
                ActionDescription = "Move Left",
                PointList         = new List <SwipePoint> {
                    new SwipePoint {
                        Point = new Point(900, 420), SwipeSpeed = 10
                    }, new SwipePoint {
                        Point = new Point(700, 420), HoldTime = 2000, SwipeSpeed = 10
                    }
                },
                WaitBetweenAction = 400
            });
            //Run right (for exp encounter)
            defaultAction.Dict[Action.RunRight].Add(new Swipe
            {
                ActionDescription = "Move Right",
                PointList         = new List <SwipePoint> {
                    new SwipePoint {
                        Point = new Point(900, 420), SwipeSpeed = 10
                    }, new SwipePoint {
                        Point = new Point(1100, 420), HoldTime = 2000, SwipeSpeed = 10
                    }
                },
                WaitBetweenAction = 400
            });

            File.WriteAllText(filepath, JsonConvert.SerializeObject(defaultAction));

            return(true);
        }
Esempio n. 16
0
        private void InitializeCommandAndEvents()
        {
            CopyCommand = new RelayCommand(p =>
            {
                this.copyAEAction = this.SelectedAEAction;
            }, p => SelectedAEAction != null);

            ApplyCommand = new RelayCommand(p =>
            {
                foreach (var action in AEActionList.GetSelectedElement())
                {
                    if (action.AEAction == copyAEAction.AEAction)
                    {
                        action.CopyOntoSelf(copyAEAction);
                    }
                }
                ;
            }, p => this.copyAEAction != null);

            OpenSavedDialogCommand = new RelayCommand(p =>
            {
                IsSavedSetupDialogOpen = true;
            }, p => SelectedAEAction != null);

            CloseSavedDialogCommand = new RelayCommand(p =>
            {
                IsSavedSetupDialogOpen = false;
            }, p => IsSavedSetupDialogOpen == true);

            SaveCommand = new RelayCommand(p =>
            {
                var action  = this.SelectedAEAction.ConvertBackToAction();
                action.Name = SavedSetupName;
                repository.Add(action);

                if (!repository.SaveChange())
                {
                    messageBoxService.ShowMessageBox("Can not save your setup. Check the permission to the folder", "ERROR", MessageButton.OK, MessageImage.Error);
                }
                else
                {
                    SavedAEActions.Add(action);
                    IsSavedSetupDialogOpen = false;
                }
            }, p => SelectedAEAction != null && !string.IsNullOrWhiteSpace(SavedSetupName));

            LoadCommand = new RelayCommand(p =>
            {
                if (!(p is IAEAction aeAction))
                {
                    return;
                }

                foreach (var action in AEActionList.GetSelectedElement())
                {
                    if (action.AEAction == aeAction.AEAction)
                    {
                        action.ConvertFromAction(aeAction);
                    }
                }
                ;
            }, p => SavedAEActions.Count > 0);

            RemoveCommand = new RelayCommand(p =>
            {
                if (!(p is IAEAction aeAction))
                {
                    return;
                }

                repository.Remove(aeAction);

                if (!repository.SaveChange())
                {
                    messageBoxService.ShowMessageBox("Can not remove the saved setup. Check the permission to the folder", "ERROR", MessageButton.OK, MessageImage.Error);
                }
                else
                {
                    SavedAEActions?.Remove(aeAction);
                }
            }, p => SavedAEActions.Count > 0);

            this.macroManager.SelectChanged += (sender, e) =>
            {
                var newList = macroManager.GetCurrentAEActionList();

                AEActionList.Clear();

                if (newList != null)
                {
                    foreach (var a in newList)
                    {
                        AEActionList.Add(a);
                    }
                }

                this.copyAEAction = null;
            };

            this.macroManager.BeforeMacroReloaded += (sender, e) =>
            {
                oldList = new List <IAEActionViewModel>(AEActionList);
            };

            this.macroManager.AfterMacroReloaded += (sender, e) =>
            {
                if (oldList != null)
                {
                    var count = oldList.Count < AEActionList.Count ? oldList.Count : AEActionList.Count;

                    for (int i = 0; i < count; i++)
                    {
                        AEActionList[i].CopyOntoSelf(oldList[i]);
                    }
                }
            };

            this.macroManager.MacroProfileSelected += (sender, e) =>
            {
                if (e == null || e.Profile.Setups?.Count == 0)
                {
                    return;
                }

                ApplyProfile(e.Profile);
            };

            this.macroManager.MacroSaveLoaded += (sender, e) =>
            {
                if (e == null || e.Save == null)
                {
                    return;
                }

                ApplyProfile(e.Save.DefaultProfile);
            };
        }