コード例 #1
0
        public ItemBox(Eggs egg, ISession session)
        {
            InitializeComponent();
            Session         = session;
            DisableTimer    = true;
            lbl.Font        = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            pb.Image        = egg.Icon;
            lblTime.Parent  = pb;
            lblTime.Visible = true;
            lbl.Text        = String.Format(CultureInfo.InvariantCulture, "{0:0.0}Km", egg.KM);
            if (!egg.Hatchable)
            {
                lblTime.Text = String.Format(CultureInfo.InvariantCulture, "Walked", egg.TotalKM);
                Enabled      = false;
                return;
            }
            lblTime.Text = String.Format(CultureInfo.InvariantCulture, "{0:0.0}Km", egg.TotalKM);

            foreach (Control control in Controls)
            {
                control.MouseEnter += ChildMouseEnter;
                control.MouseLeave += ChildMouseLeave;
                control.MouseClick += delegate { HatchEgg_Click(egg); };
            }
        }
コード例 #2
0
        public void AddOrUpdate(PokemonData egg, Incubators incu = null)
        {
            var eggModel = new Eggs(egg)
            {
                Hatchable = incu == null
            };

            Eggs.Add(eggModel);
        }
コード例 #3
0
        private async void HatchEgg_Click(Eggs egg)
        {
            if (_incubator == null)
            {
                MessageBox.Show("Please select an incubator to hatch eggs", "Hatch Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            await UseIncubatorsTask.Execute(Session, Session.CancellationTokenSource.Token, egg.Id, _incubator.Id).ConfigureAwait(false);

            EggsForm.ActiveForm.Close();
        }
コード例 #4
0
ファイル: EggsForm.cs プロジェクト: zsg0601/NecroBot
        public void AddOrUpdate(PokemonData egg, Incubators incu = null)
        {
            var eggModel = new Eggs(egg)
            {
                Hatchable = incu == null,
            };

            if (!eggModel.Hatchable && incu != null)
            {
                eggModel.KM = incu.KM;
            }
            Eggs.Add(eggModel);
        }