Ejemplo n.º 1
0
        /// <summary>
        /// Method for handling the event of all money loss.
        /// </summary>
        private void NoMoney()
        {
            int moneyMoreThanZero = person.wallet.GetCredit();

            if (moneyMoreThanZero <= 0)
            {
                MessageBoxResult result = MessageBox.Show("You got no money left, huh? Do you want to exit," +
                                                          " kick the machine and go kill yourself? Or at least re-think your life you f*****g gambling addict!"
                                                          , "NO MONEY left! Wife is gonna KILL YOU!", MessageBoxButton.YesNo, MessageBoxImage.Warning);

                if (MessageBoxResult.Yes == result)
                {
                    Close();
                }
                else if (MessageBoxResult.No == result)
                {
                    int inputCredit = 0;
                    person.wallet.SetCredit(inputCredit);
                    BetTextBox.Clear();
                    CreditTextBox.Clear();
                    CreditLabel.Content = " ";
                    NameLabel.Content   = " ";
                }
            }
        }
Ejemplo n.º 2
0
 private void SaveContent_Click(object sender, RoutedEventArgs e)
 {
     SetInnitialWalletValue(PlayerName);
     CreditLabel.Content = person.wallet.GetCredit();
     CreditTextBox.Clear();
     NameLabel.Content = PlayerName + "'s Game";
     NameTextBox.Clear();
 }
Ejemplo n.º 3
0
        private void LoadData(BenchmarksModel model)
        {
            var(location, size) = WindowPosition.Normalize(this, model.FormLocation, model.FormSize);

            Location         = location;
            LocationChanged += (s, e) => model.FormLocation = WindowState == FormWindowState.Normal ? Location : RestoreBounds.Location;
            Size             = size;
            SizeChanged     += (s, e) => model.FormSize = WindowState == FormWindowState.Normal ? Size : RestoreBounds.Size;

            cboClients.BindSelectedValue(model, nameof(BenchmarksModel.SelectedSlotIdentifier));
            cboClients.DataSource    = model.SlotIdentifiers;
            cboClients.DisplayMember = nameof(ListItem.DisplayMember);
            cboClients.ValueMember   = nameof(ListItem.ValueMember);

            picDeleteClient.BindVisible(model, nameof(BenchmarksModel.SelectedSlotDeleteEnabled));

            ProjectIDTextBox.BindText(model, nameof(BenchmarksModel.WorkUnitName));
            CreditTextBox.BindText(model, nameof(BenchmarksModel.Credit));
            KFactorTextBox.BindText(model, nameof(BenchmarksModel.KFactor));
            FramesTextBox.BindText(model, nameof(BenchmarksModel.Frames));
            AtomsTextBox.BindText(model, nameof(BenchmarksModel.NumberOfAtoms));
            CoreTextBox.BindText(model, nameof(BenchmarksModel.Core));
            DescriptionLinkLabel.Text = "Click to view online";
            DescriptionLinkLabel.DataBindings.Add(nameof(Tag), model, nameof(BenchmarksModel.DescriptionUrl), false, DataSourceUpdateMode.OnPropertyChanged);
            TimeoutTextBox.BindText(model, nameof(BenchmarksModel.PreferredDays));
            ExpirationTextBox.BindText(model, nameof(BenchmarksModel.MaximumDays));
            ContactTextBox.BindText(model, nameof(BenchmarksModel.Contact));
            WorkServerTextBox.BindText(model, nameof(BenchmarksModel.ServerIP));

            model.PropertyChanged += (s, e) => ModelPropertyChanged((BenchmarksModel)s, e);
            model.SelectedSlotProjectListItems = new ListBoxSelectedListItemCollection(projectsListBox);
            projectsListBox.DataSource         = model.SlotProjects;
            projectsListBox.DisplayMember      = nameof(ListItem.DisplayMember);
            projectsListBox.ValueMember        = nameof(ListItem.ValueMember);
            model.SetDefaultSlotProject();

            lstColors.DataSource    = model.GraphColors;
            lstColors.DisplayMember = nameof(ListItem.DisplayMember);
            lstColors.ValueMember   = nameof(ListItem.ValueMember);
            lstColors.BindSelectedValue(model, nameof(BenchmarksModel.SelectedGraphColorItem));

            colorPreviewPictureBox.DataBindings.Add(nameof(PictureBox.BackColor), model, nameof(BenchmarksModel.SelectedGraphColor), false, DataSourceUpdateMode.OnPropertyChanged);
        }