Example #1
0
        /// <summary>
        ///     Initializes the Reset commands.
        /// </summary>
        private void InitializeResetCommand()
        {
            try
            {
                ResetMiscCommand = new RelayCommand(
                    parameter => _Model.Combat.Misc.Reset());
                ResetBarbCommand = new RelayCommand(
                    parameter =>
                {
                    _Model.Combat.Barbarian.Reset();
                    _Model.Combat.AvoidanceRadius.Reset();
                });
                ResetCrusaderCommand = new RelayCommand(
                    parameter =>
                {
                    _Model.Combat.Crusader.Reset();
                    _Model.Combat.AvoidanceRadius.Reset();
                });
                ResetMonkCommand = new RelayCommand(
                    parameter =>
                {
                    _Model.Combat.Monk.Reset();
                    _Model.Combat.AvoidanceRadius.Reset();
                });
                ResetWizardCommand = new RelayCommand(
                    parameter =>
                {
                    _Model.Combat.Wizard.Reset();
                    _Model.Combat.AvoidanceRadius.Reset();
                });
                ResetWitchDoctorCommand = new RelayCommand(
                    parameter =>
                {
                    _Model.Combat.WitchDoctor.Reset();
                    _Model.Combat.AvoidanceRadius.Reset();
                });
                ResetDemonHunterCommand = new RelayCommand(
                    parameter =>
                {
                    _Model.Combat.DemonHunter.Reset();
                    _Model.Combat.AvoidanceRadius.Reset();
                });
                ResetWorldObjectCommand = new RelayCommand(
                    parameter => _Model.WorldObject.Reset());
                ResetItemCommand = new RelayCommand(
                    parameter => _Model.Loot.Pickup.Reset());
                ResetItemRulesCommand = new RelayCommand(
                    parameter => _Model.Loot.ItemRules.Reset());
                ReloadScriptRulesCommand = new RelayCommand(
                    parameter =>
                {
                    try
                    {
                        _Model.CopyTo(_OriginalModel);
                        _OriginalModel.Save();
                        if (Trinity.StashRule == null)
                        {
                            Trinity.StashRule = new Interpreter();
                        }

                        if (Trinity.StashRule != null)
                        {
                            BotMain.PauseWhile(Trinity.StashRule.reloadFromUI);
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Exception in ReloadScriptRulesCommand: {0}", ex);
                    }
                }
                    );
                ResetTownRunCommand = new RelayCommand(
                    parameter => _Model.Loot.TownRun.Reset());
                ResetAdvancedCommand = new RelayCommand(
                    parameter => _Model.Advanced.Reset());
                ResetNotificationCommand = new RelayCommand(
                    parameter => _Model.Notification.Reset());

                ResetAllCommand = new RelayCommand(
                    parameter => _Model.UserRequestedReset());
            }
            catch (Exception ex)
            {
                Logger.LogError("Exception initializing commands {0}", ex);
            }
        }