public void SetViewModel(ComponentTemplateMainPropertiesVM viewModel)
        {
            //_viewModel = viewModel;
            //DataContext = viewModel;
            //FormulaEditorView.SetViewModel(_viewModel.FormulaEditor);
            MineralCostFormulaStackLayout.SuspendLayout();
            MineralCostFormulaStackLayout.Items.Clear();
            foreach (var item in viewModel.MineralCostFormula)
            {
                MineralCostFormulaStackLayout.Items.Add(new MineralFormulaView(item));
            }
            viewModel.MineralCostFormula.CollectionChanged += MineralCostFormula_CollectionChanged;
            MineralCostFormulaStackLayout.ResumeLayout();

            MountTypes.SuspendLayout();
            MountTypes.Items.Clear();
            foreach (var item in viewModel.MountType)
            {
                ECSLib.ComponentMountType key = item.Key;
                CheckBox chkbx = new CheckBox();
                chkbx.Text = key.ToString();
                //chkbx.CheckedBinding.BindDataContext((DictionaryVM<ECSLib.ComponentMountType, bool?, bool?> x) => x[kvp.Key], (m, val) => m[kvp.Key] = val);
                chkbx.CheckedBinding.BindDataContext((ObservableDictionary <ECSLib.ComponentMountType, bool?> x) => x[key], (m, val) => m[key] = val);
                chkbx.DataContext = viewModel.MountType;
                MountTypes.Items.Add(chkbx);
            }
            MountTypes.ResumeLayout();
            viewModel.MountType.PropertyChanged += MountType_PropertyChanged;
        }
Example #2
0
 public Scope(int id, string manufacturer, string name, float aperture, float focalLength, float centralObstructionDiameter, bool robotic, MountTypes mountType)
 {
     Id           = id;
     Manufacturer = manufacturer;
     Name         = name;
     Aperture     = aperture;
     FocalLength  = focalLength;
     CentralObstructionDiameter = centralObstructionDiameter;
     Robotic   = robotic;
     MountType = mountType;
 }
Example #3
0
        public override void PerformArea()
        {
            base.PerformArea();

            if (!Account.Settings.BuyMount || DateTime.Now < Account.MountDurationTime && Account.Mount == Account.Settings.MountToBuy || Account.Settings.MountToBuy == MountTypes.None)
            {
                return;
            }

            if (Account.Mount != Account.Settings.MountToBuy && !CanBuySelectedMount() && Account.Mount != MountTypes.None)
            {
                return;
            }

            if (!Account.QuestIsStarted && !Account.TownWatchIsStarted || Account.MirrorIsCompleted)
            {
                RaiseMessageEvent("Betrete Stall");
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                string s = SendRequest(ActionTypes.JoinMountShop);

                //checkForMoney
                bool canBuyMount = false;
                canBuyMount = CanBuySelectedMount();

                //try To Buy A Cheaper One
                MountTypes nextMount = Account.Settings.MountToBuy;
                while ((int)nextMount > 1 && !canBuyMount)
                {
                    nextMount = ((int)nextMount - 1).ToString().ToEnum <MountTypes>();
                    if (CanBuyAMount(nextMount))
                    {
                        canBuyMount = true;
                    }
                }

                if (canBuyMount && nextMount > Account.Mount)
                {
                    RaiseMessageEvent(String.Concat("Kaufe Mount ", nextMount.ToString()));
                    ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                    s = SendRequest(String.Concat(ActionTypes.BuyMount, (int)nextMount));

                    ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                    s = SendRequest(ActionTypes.JoinCharacter);

                    canBuyMount = false;
                    Account.MountDurationTime = Account.MountDurationTime.AddDays(14d);
                    Account.Mount             = nextMount;

                    RemoveMountCost(nextMount);
                }
            }
        }
Example #4
0
        private bool CanBuyAMount(MountTypes type)
        {
            bool canBuyMount = false;

            switch (type)
            {
            case MountTypes.Schwein:
                if (Account.Silver >= pigCostSilver && Account.Mushroom >= pigCostMushroom)
                {
                    canBuyMount = true;
                }
                break;

            case MountTypes.Wolf:
                if (Account.Silver >= wolfCostSilver && Account.Mushroom >= wolfCostMushroom)
                {
                    canBuyMount = true;
                }
                break;

            case MountTypes.Raptor:
                if (Account.Silver >= raptorCostSilver && Account.Mushroom >= raptorCostMushroom)
                {
                    canBuyMount = true;
                }
                break;

            case MountTypes.Drachengreif:
                if (Account.Silver >= dragonCostSilver && Account.Mushroom >= dragonCostMushroom)
                {
                    canBuyMount = true;
                }
                break;

            default:
                canBuyMount = false;
                break;
            }

            return(canBuyMount);
        }
Example #5
0
        private void RemoveMountCost(MountTypes type)
        {
            switch (type)
            {
            case MountTypes.Schwein:
                if (Account.Silver >= pigCostSilver && Account.Mushroom >= pigCostMushroom)
                {
                    Account.Silver   -= pigCostSilver;
                    Account.Mushroom -= pigCostMushroom;
                }
                break;

            case MountTypes.Wolf:
                if (Account.Silver >= wolfCostSilver && Account.Mushroom >= wolfCostMushroom)
                {
                    Account.Silver   -= wolfCostSilver;
                    Account.Mushroom -= wolfCostMushroom;
                }
                break;

            case MountTypes.Raptor:
                if (Account.Silver >= raptorCostSilver && Account.Mushroom >= raptorCostMushroom)
                {
                    Account.Silver   -= raptorCostSilver;
                    Account.Mushroom -= raptorCostMushroom;
                }
                break;

            case MountTypes.Drachengreif:
                if (Account.Silver >= dragonCostSilver && Account.Mushroom >= dragonCostMushroom)
                {
                    Account.Silver   -= dragonCostSilver;
                    Account.Mushroom -= dragonCostMushroom;
                }
                break;

            default:
                break;
            }
        }