コード例 #1
0
        public MartingaleViewModel(DiceSite Site, AutomatedBetSettings settings)
            : base(Site)
        {
            StartCommand = new Command(async() =>
            {
                stop = false;
                if (_onLose == 0)
                {
                    _onLose = (BetMultiplier / (BetMultiplier - 1)) * 1.05m;
                }

                Strategy          = new Martingale(_settings = settings);
                Strategy.Refresh += (obj, arg) =>
                {
                    RefreshValues();
                };
                await Strategy.Run(_site);
            });

            StopCommand = new Command(() => Strategy.Stop());

            MessagingCenter.Subscribe <DiceSite, string>(this, "error", (sender, args) => Strategy.Stop());
            MessagingCenter.Subscribe <DiceSite, string>(this, "updateStatus", (sender, args) => Status = args);

            Title = "Martingale";
        }
コード例 #2
0
        public AutomaticPlayPage(DiceSite Site, AutomatedBetSettings settings)
            : this()
        {
            BindingContext = viewmodel = new MartingaleViewModel(Site, settings);

            viewmodel.Title = _titleText;
        }
コード例 #3
0
        public PlayViewModel(DiceSite Site)
        {
            _site = Site;
            Bets  = new ObservableCollection <Bet>();

            BetHighCommand = new Command(async() =>
                                         await _site.PlaceBet(true, BetAmount, BetChance));

            BetLowCommand = new Command(async() =>
                                        await _site.PlaceBet(false, BetAmount, BetChance));

            MessagingCenter.Subscribe <DiceSite, decimal>(this, "updateBalance", (obj, val) =>
            {
                OnPropertyChanged(nameof(Amount));
            });

            MessagingCenter.Subscribe <DiceSite, Bet>(this, "addBet", (obj, bet) =>
            {
                Bets.Add(bet);
            });

            MessagingCenter.Subscribe <DiceSite, string>(this, "updateStatus", (obj, message) =>
            {
                Status = message;
            });
        }
コード例 #4
0
ファイル: LoginViewModel.cs プロジェクト: adolfowp/Dicer
        public LoginViewModel(DiceSite Site)
        {
            _site = Site;

            Title  = String.Format("{0} login", Site.SiteTitle);
            SignIn = new Command(async() => await ExecuteLogin());
        }
コード例 #5
0
        public BetSettingsPage(DiceSite Site)
            : this()
        {
            BindingContext = betSettings;

            _site = Site;
        }
コード例 #6
0
ファイル: Martingale.cs プロジェクト: adolfowp/Dicer
        public async Task <int> Run(DiceSite Site)
        {
            var  currentAmount = _settings.BaseBet;
            bool bettingHigh   = true;

            if (_settings.BetOn == BetOnEnum.Low)
            {
                bettingHigh = false;
            }

            while (CanExecute(Site))
            {
                if (!await Site.PlaceBet(bettingHigh, currentAmount, _settings.Chance))
                {
                    // perdita
                    if (_settings.BetAction_OnLose == BetResultAction.ReturnToBase)
                    {
                        currentAmount = _settings.BaseBet;
                    }
                    if (_settings.BetAction_OnLose == BetResultAction.Increase)
                    {
                        currentAmount *= (_settings.IncreaseAmount_OnLose / 100m + 1);
                    }
                    if (_settings.BetAction_OnLose == BetResultAction.ChangeOdds)
                    {
                        _settings.BetOdds = _settings.NewOdd_OnLose;
                    }
                }
                else
                {
                    // vincita
                    if (_settings.BetAction_OnWin == BetResultAction.ReturnToBase)
                    {
                        currentAmount = _settings.BaseBet;
                    }
                    if (_settings.BetAction_OnWin == BetResultAction.Increase)
                    {
                        currentAmount *= (_settings.IncreaseAmount_OnWin / 100m + 1);
                    }
                    if (_settings.BetAction_OnWin == BetResultAction.ChangeOdds)
                    {
                        _settings.BetOdds = _settings.NewOdd_OnWin;
                    }
                }

                if (_settings.BetOn == BetOnEnum.Alternate)
                {
                    bettingHigh = !bettingHigh;
                }

                Refresh?.Invoke(this, EventArgs.Empty);
            }
            ;

            return(await Task <int> .FromResult(Site.wins - Site.losses));
        }
コード例 #7
0
        public PlayPage(DiceSite Site)
        {
            #region Manual Bet Page
            var manualPage = new ManualPlayPage(Site);
            #endregion

            #region Automatic Bet Page
            var automaticPage = new AutomaticPlayPage(Site);
            #endregion

            Children.Add(manualPage);
            Children.Add(automaticPage);
        }
コード例 #8
0
        public MainPage(DiceSite connectedSite)
        {
            site = connectedSite;

            masterPage = new MasterPage();
            Master     = masterPage;
            Detail     = new NavigationPage(new ManualPlayPage(site));

            masterPage.ListView.ItemSelected += OnItemSelected;

            if (Device.RuntimePlatform == Device.UWP)
            {
                MasterBehavior = MasterBehavior.Popover;
            }
        }
コード例 #9
0
ファイル: Martingale.cs プロジェクト: adolfowp/Dicer
        public bool CanExecute(DiceSite Site)
        {
            if (_settings.ShouldStopOnProfit)
            {
                // Manage stop profit
                if (Site.profit >= _settings.StopOnProfit)
                {
                    return(false);
                }
            }
            if (_settings.ShouldStopOnLoss && Site.profit < 0)
            {
                if (Math.Abs(Site.profit) >= _settings.StopOnLoss)
                {
                    return(false);
                }
            }
            if (AreRollsLimited && _settings.Rolls-- <= 0)
            {
                return(false);
            }

            return(!stop);
        }
コード例 #10
0
ファイル: DisconnectPage.xaml.cs プロジェクト: adolfowp/Dicer
 public DisconnectPage(DiceSite site)
 {
     InitializeComponent();
     BindingContext = new DisconnectViewModel();
     _site          = site;
 }
コード例 #11
0
ファイル: ManualPlayPage.xaml.cs プロジェクト: adolfowp/Dicer
 public ManualPlayPage(DiceSite Site)
     : this()
 {
     BindingContext  = viewmodel = new PlayViewModel(Site);
     viewmodel.Title = _titleText;
 }
コード例 #12
0
 protected BaseDetailPage(DiceSite Site)
 {
     site = Site;
 }
コード例 #13
0
 public LoginPage(DiceSite Site)
     : this()
 {
     BindingContext = viewmodel = new LoginViewModel(Site);
 }
コード例 #14
0
ファイル: MartingalePage.xaml.cs プロジェクト: adolfowp/Dicer
 public MartingalePage(DiceSite Site)
     : this()
 {
     //BindingContext = viewmodel = new MartingaleViewModel(Site);
 }