Ejemplo n.º 1
0
        // Creates a drawing group for a given booth but it is not added to the overlay
        private DrawingGroup justDraw(Booth booth)
        {
            DrawingGroup boothDrawing = new DrawingGroup();
            // Draw rectangle
            GeometryDrawing borderRect = new GeometryDrawing();

            borderRect.Brush = Brushes.Transparent;
            Point topLeft = new Point(booth.Position.X - 15, booth.Position.Y - 10);
            Rect  border  = new Rect(topLeft, new Size(30, 20));

            borderRect.Geometry = new RectangleGeometry(border);
            borderRect.Pen      = new Pen(Brushes.Black, 1);
            boothDrawing.Children.Add(borderRect);

            // Draw formatted text of the name
            FormattedText boothName = new FormattedText(booth.Name, CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                        new Typeface("Arial"), 14, Brushes.Black);
            GeometryDrawing textDrawing = new GeometryDrawing();

            textDrawing.Brush = Brushes.Black;
            double nameWidth  = boothName.Width;
            double nameHeight = boothName.Height;
            Point  textPoint  = new Point((booth.Position.X), (booth.Position.Y));

            textPoint.X         -= nameWidth / 2;
            textPoint.Y         -= nameHeight / 2;
            textDrawing.Geometry = boothName.BuildGeometry(textPoint);
            boothDrawing.Children.Add(textDrawing);
            return(boothDrawing);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles adding a single booth, changing the name of a booth, or deleting a single booth on a mouse click
        /// </summary>
        /// <param name="point">The location the mouse is pressed</param>
        public void clickHandler(Point point)
        {
            BoothWrapper hitTestedBooth = hitTestPoint(point);

            if (clickSetting == ClickSetting.Add)
            {
                Booth addedBooth = new Booth(rowChar + "1", point);
                incrementRowChar();
                drawBooth(addedBooth);
                this.BoothMapModel.BoothList.Add(addedBooth);
            }
            else if (clickSetting == ClickSetting.Delete && hitTestedBooth != null)
            {
                this.overlay.Children.Remove(hitTestedBooth.DrawingGroup);
                this.drawnBooths.Remove(hitTestedBooth);
                hitTestedBooth.DragSet.Remove(hitTestedBooth);
                this.BoothMapModel.BoothList.Remove(hitTestedBooth.Booth);
                if (hitTestedBooth.Booth.Assignment != null)
                {
                    hitTestedBooth.Booth.Assignment.Assignment = null;
                }
            }
            else if (clickSetting == ClickSetting.Edit && hitTestedBooth != null)
            {
                EditForm editForm = new EditForm();
                editForm.DataContext = hitTestedBooth.Booth;
                editForm.ShowDialog();
                overlay.Children.Remove(hitTestedBooth.DrawingGroup);
                hitTestedBooth.DrawingGroup = justDraw(hitTestedBooth.Booth);
                overlay.Children.Add(hitTestedBooth.DrawingGroup);
            }
        }
Ejemplo n.º 3
0
 // 变倍 +
 private void btnNear_Click(object sender, EventArgs e)
 {
     Booth.fnZoomIn();
     Thread.Sleep(500);
     Booth.fnZoomIn();
     NoticeShow("进行放大。");
 }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Location")] Booth booth)
        {
            if (id != booth.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(booth);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BoothExists(booth.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(booth));
        }
        public async Task <ActionResult <Booth> > PostBooth(Booth booth)
        {
            _context.Booth.Add(booth);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBooth", new { id = booth.BoothID }, booth));
        }
Ejemplo n.º 6
0
        private void btnComment_Click(object sender, EventArgs e)
        {
            isDraw = !isDraw;
            if (isDraw)
            {
                Booth.fnOnLButtonDown();
                isPause = true;
                this.btnComment.Text = "结束批注";
                EnablePenControl();
                btnRecordControl.Enabled = false;
                btnNear.Enabled          = false;
                btnFar.Enabled           = false;
                gp = plCamera.CreateGraphics();
                gp.SmoothingMode      = SmoothingMode.AntiAlias; //使绘图质量最高,即消除锯齿
                gp.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                gp.CompositingQuality = CompositingQuality.HighQuality;

                ImageFromControl(ref gp1);
                NoticeShow("已经开始批注。");
            }
            else
            {
                this.btnComment.Text = "开始批注";
                DisablePenControl();
                btnRecordControl.Enabled = true;
                btnNear.Enabled          = true;
                btnFar.Enabled           = true;

                btnEnlargeReset_Click(null, null);
                NoticeShow("已经结束批注。");
            }
        }
Ejemplo n.º 7
0
        public ActionResult Create(FormCollection collection)
        {
            var booth = new Booth();

            try
            {
                this.RadynTryUpdateModel(booth);
                booth.CongressId           = this.Homa.Id;
                booth.CurrentUICultureName = collection["LanguageId"];
                if (CongressComponent.Instance.BaseInfoComponents.BoothFacade.Insert(booth))
                {
                    ShowMessage(Resources.Common.InsertSuccessMessage, Resources.Common.MessaageTitle,
                                messageIcon: MessageIcon.Succeed);
                    return(this.SubmitRedirect(collection, new { Id = booth.Id }));
                }
                ShowMessage(Resources.Common.ErrorInInsert, Resources.Common.MessaageTitle,
                            messageIcon: MessageIcon.Error);
                return(Redirect("~/Congress/Booth/Index"));
            }
            catch (Exception exception)
            {
                ShowExceptionMessage(exception);
                return(View(booth));
            }
        }
Ejemplo n.º 8
0
        public int UpdateBooth(Booth boothChanges)
        {
            var booth = _context.Booths.Attach(boothChanges);

            booth.State = EntityState.Modified;
            return(_context.SaveChanges());
        }
Ejemplo n.º 9
0
 // 变倍 -
 private void btnFar_Click(object sender, EventArgs e)
 {
     Booth.fnZoomOut();
     Thread.Sleep(500);
     Booth.fnZoomOut();
     NoticeShow("进行缩小。");
 }
Ejemplo n.º 10
0
 // 录制暂停/恢复
 // 录制暂停
 private void RecordPause()
 {
     isPause = true;
     Booth.fnOnLButtonDown();
     timer1.Stop();
     btnRecordPause.Text = "恢复录像";
 }
Ejemplo n.º 11
0
 // 继续录制
 private void RecordResume()
 {
     isPause = false;
     Booth.fnOnRButtonDown();
     timer1.Start();
     btnRecordPause.Text = "暂停录像";
 }
Ejemplo n.º 12
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Booth b = new Booth();

            b.updateBoothName(Convert.ToInt32(ViewState["editBoothNameID"]), TextBox1.Text);
            ScriptManager.RegisterStartupScript(this, typeof(string), "EditBoothSuccessScript", "alert('Booth name updated successfully!');window.open('SellerManageBooth.aspx', '_self');", true);
        }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userID"] != null)
            {
                int boothID = Convert.ToInt32(Request.QueryString["booth"]);
                sellerID = Booth.retrieveSellerID(boothID);
                User  seller = new User();
                Booth booth  = new Booth();

                seller          = seller.retrieveBoothOwnerInfo(sellerID);
                booth           = booth.retrieveBooth(sellerID);
                Image1.ImageUrl = HttpUtility.HtmlEncode(seller.getProfilePicture());
                Label2.Text     = HttpUtility.HtmlEncode(seller.getUsername());
                Label1.Text     = HttpUtility.HtmlEncode(Convert.ToString(seller.getRepPoints()));
                Label3.Text     = HttpUtility.HtmlEncode(booth.getBoothName());

                int     productID = Convert.ToInt32(Request.QueryString["product"]);
                Product p         = new Product();
                p.retrieveProduct(productID);
                Label4.Text   = HttpUtility.HtmlEncode(p.getProductName());
                Label5.Text   = HttpUtility.HtmlEncode(Convert.ToString(p.getPrice()));
                Label6.Text   = HttpUtility.HtmlEncode(Convert.ToString(p.getAvailableQuantity()));
                TextBox1.Text = HttpUtility.HtmlEncode(p.getInformation());
            }
            else
            {
                Session["login"] = false;
                Response.Redirect("~/MainPage.aspx");
            }
        }
        public async Task <IActionResult> PutBooth(int id, Booth booth)
        {
            if (id != booth.BoothID)
            {
                return(BadRequest());
            }

            _context.Entry(booth).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BoothExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 15
0
        public ActionResult DeleteConfirmed(int id)
        {
            Booth booth = db.Booths.Find(id);

            db.Booths.Remove(booth);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 16
0
 // 初始化
 private void Init()
 {
     LoadConfig();
     Booth.fnInit(this.Handle, plCamera.Handle);
     Preview();
     BuildDir();
     DisablePenControl();
 }
Ejemplo n.º 17
0
 // 初始化
 private void Init()
 {
     //Booth.fnInit(this.Handle, IntPtr.Zero);
     Booth.fnInit(config.CameraIP);
     Preview();
     BuildDir();
     btnForward.Enabled = false;
     btnBackward.Enabled = false;
 }
Ejemplo n.º 18
0
 public ActionResult Edit([Bind(Include = "BoothId,BoothName,BoothLocation,Operator,BoothIntroduction,CommodityId,NightmarketId")] Booth booth)
 {
     if (ModelState.IsValid)
     {
         db.Entry(booth).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(booth));
 }
Ejemplo n.º 19
0
 // 退出时保存录像
 private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (isRecord)
     {
         Booth.fnStopRecord();
         this.Dispose(true);
         Application.Exit();
     }
     CSAVFrameWork.uninitialize();
 }
Ejemplo n.º 20
0
        public VisitEditForm(Booth booth)
        {
            InitializeComponent();
            VisitEditFormVM vm = new VisitEditFormVM(booth);

            DataContext = vm;
            if (vm.CloseAction == null)
            {
                vm.CloseAction = new Action(this.Close);
            }
        }
Ejemplo n.º 21
0
        public ActionResult Create([Bind(Include = "BoothId,BoothName,BoothLocation,Operator,BoothIntroduction,CommodityId,NightmarketId")] Booth booth)
        {
            if (ModelState.IsValid)
            {
                db.Booths.Add(booth);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(booth));
        }
Ejemplo n.º 22
0
        public async Task <IActionResult> Create([Bind("Id,Name,Location")] Booth booth)
        {
            if (ModelState.IsValid)
            {
                _context.Add(booth);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(booth));
        }
Ejemplo n.º 23
0
        public void UpdateBoothTest()
        {
            TreatBooth newTreatBooth = new TreatBooth(99, 45);

            _partyTestList.UpdateBooth(new DateTime(2019, 6, 15), newTreatBooth, "treat");

            Booth      updatedBooth = _partyTestList.GetBooth(new DateTime(2019, 6, 15), "treat");
            TreatBooth actual       = (TreatBooth)updatedBooth;

            Assert.AreEqual(99, actual.IceCreamTickets);
            Assert.AreEqual(45, actual.PopcornTickets);
        }
Ejemplo n.º 24
0
    static void Main(string[] args)
    {
        //skapar en lista där olika instanser av ArcadeShop sparas
        List <ArcadeShop> cart = new List <ArcadeShop>();

        string choice;

        Console.WriteLine("We sell apple and pear write the one you want to buy. and when you are done write , done");
        choice = Console.ReadLine();


        while (choice != "done")
        {
            if (choice == "apple")
            {
                // lägger till instansen Apple i listan "cart" med texten Red framför
                cart.Add(new Apple("Red "));
            }
            else if (choice == "pear")
            {
                // lägger till instansen pear i listan "cart" med texten green framför
                cart.Add(new Pear("green "));
            }
            // en readline som låter dig välja så många frukter du vill tills du känner dig nöjd och skriver done.
            choice = Console.ReadLine();
        }

        int totalamount = 0;

        // en foreach loop som lägger till return värdet från varje item i cart Listan in i totalamount int
        foreach (ArcadeShop item in cart)
        {
            totalamount += item.shoop;
            Console.WriteLine(item.Name(), item.shoop);
        }

        Console.WriteLine(totalamount);
        Console.ReadLine();



        // instansierar basklassen och derive klassen
        NumberGuessBooth deriveklass = new NumberGuessBooth();
        Booth            basklass    = new Booth();

        // kör basklassens virtual void metod samt derive klassens overrided version av basklassens virtualvoid metod.
        basklass.virtualvoid();
        deriveklass.virtualvoid();

        Arcade highinstans = new Arcade();

        highinstans.high();
    }
Ejemplo n.º 25
0
 /// <summary>
 /// Initializes a new instance of the Zoo class.
 /// </summary>
 /// <param name="name">The name of the zoo.</param>
 /// <param name="capacity">The maximum number of guests the zoo can accommodate at a given time.</param>
 /// <param name="restroomCapacity">The capacity of the zoo's restrooms.</param>
 /// <param name="animalFoodPrice">The price of a pound of food from the zoo's animal snack machine.</param>
 /// <param name="ticketPrice">The price of an admission ticket to the zoo.</param>
 /// <param name="boothMoneyBalance">The initial money balance of the zoo's ticket booth.</param>
 /// <param name="attendant">The zoo's ticket booth attendant.</param>
 /// <param name="vet">The zoo's birthing room vet.</param>
 /// <param name="waterBottlePrice"> The price of the zoo's water bottles.</param>
 public Zoo(string name, int capacity, int restroomCapacity, decimal animalFoodPrice, decimal ticketPrice, decimal boothMoneyBalance, Employee attendant, Employee vet, decimal waterBottlePrice)
 {
     this.animals = new List<Animal>();
     this.animalSnackMachine = new VendingMachine(animalFoodPrice);
     this.b168 = new BirthingRoom(vet);
     this.capacity = capacity;
     this.guests = new List<Guest>();
     this.ladiesRoom = new Restroom(restroomCapacity, "Female");
     this.mensRoom = new Restroom(restroomCapacity, "Male");
     this.name = name;
     this.ticketBooth = new Booth(attendant, ticketPrice, waterBottlePrice);
     this.ticketBooth.AddMoney(boothMoneyBalance);
 }
Ejemplo n.º 26
0
        // Creates a boothwrapper class for a booth and adds it to a dragset and adds it to the overlay
        private BoothWrapper drawBooth(Booth booth, HashSet <BoothWrapper> dragSet)
        {
            DrawingGroup boothDrawing = justDraw(booth);

            overlay.Children.Add(boothDrawing);
            BoothWrapper bw = new BoothWrapper();

            bw.DrawingGroup = boothDrawing;
            bw.Booth        = booth;
            drawnBooths.Add(bw);
            bw.DragSet = dragSet;
            dragSet.Add(bw);
            return(bw);
        }
Ejemplo n.º 27
0
        // GET: Booth/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Booth booth = db.Booths.Find(id);

            if (booth == null)
            {
                return(HttpNotFound());
            }
            return(View(booth));
        }
Ejemplo n.º 28
0
        // 点击批注历史
        private void imglist1_PictureBoxClick(int i)
        {
            isDraw  = true;
            isPause = true;
            Booth.fnOnLButtonDown();
            this.btnComment.Text = "结束批注";
            EnablePenControl();
            btnRecordControl.Enabled = false;
            btnNear.Enabled          = false;
            btnFar.Enabled           = false;
            gp = plCamera.CreateGraphics();
            gp.SmoothingMode = SmoothingMode.AntiAlias;  //使绘图质量最高,即消除锯齿

            img = Image.FromFile(imglist1.GetImage(i));
            gp.DrawImage(img, 0, 0, plCamera.Width, plCamera.Height);
            ImageFromControl(ref gp1);
        }
Ejemplo n.º 29
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Booth b = new Booth();

            if (b.checkBoothExists(Convert.ToInt32(ViewState["userID"])) == false)
            {
                b.createBooth(Convert.ToInt32(ViewState["userID"]), TextBox1.Text);
                ScriptManager.RegisterStartupScript(this, typeof(string), "CreateBoothSuccessScript", "alert('Booth created successfully');window.open('SellerManageBooth.aspx', '_self');", true);
                System.Windows.Forms.MessageBox.Show("Booth created successfully");
                Response.Redirect("~/SellerManageBooth.aspx");
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("You already own a booth! Redirecting you to Market page");
                Response.Redirect("~/Panaroma.aspx");
            }
        }
Ejemplo n.º 30
0
 public VisitEditFormVM(Booth booth)
 {
     Msg = "";
     if (booth.Background == Brushes.Yellow)
     {
         VisitLog         = dc.VisitLogs.Where(x => x.BoothNumber == booth.Number && x.EndDate == null).First();
         VisitLog.EndDate = DateTime.Now;
         CardId           = VisitLog.CardId;
         CardFill         = false;
     }
     else
     {
         VisitLog = new VisitLog {
             BoothNumber = booth.Number, BeginDate = DateTime.Now
         };
         CardFill = true;
     }
 }