public ActionResult Edit(Guid id)
        {
            var standard     = _standardService.GetById(id);
            var standardForm = StandardForm.FromStandard(standard);

            return(View(standardForm));
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new Label in a StandardForm and passes by value (not as efficient)
        /// </summary>
        /// <param name="sf">Standard Form to link</param>
        /// <param name="name">The text to display</param>
        /// <returns>Value of label</returns>
        public Label CreateLabel(ref StandardForm sf, string text)
        {
            var lbl = new Label(_spriteBatch, _content, text, sf);

            lbl.Initialize(_spriteBatch, _content);
            return(lbl);
        }
Beispiel #3
0
        /// <summary>
        /// Creates a new StandardForm and passes by value (not as efficient)
        /// </summary>
        /// <param name="name">Name of form</param>
        /// <returns>Value of form</returns>
        public StandardForm CreateStandardForm(string name)
        {
            var sf = new StandardForm(InternalWindows, _spriteBatch, _content, name);

            sf.Initialize(_spriteBatch, _content); // Important because UI elements store references to both.
            return(sf);
        }
Beispiel #4
0
 private void SystemWindow_OnUpdateEvent(BaseUI sender, GameTime gameTime)
 {
     tempsf = (StandardForm)sender;
     if (MouseManager.CurrentPosition.X > tempsf.Location.X && MouseManager.CurrentPosition.Y > tempsf.Location.Y &&
         MouseManager.CurrentPosition.X < tempsf.Location.X + tempsf.BackgroundMaterial.Width &&
         MouseManager.CurrentPosition.Y < tempsf.Location.Y + 22 &&
         MouseManager.RightButtonDown)
     {
         RemoveWindowFromList(tempsf);
     }
 }
Beispiel #5
0
        public StandardForm CreateHUDButtons()
        {
            var sf = new StandardForm(InternalWindows, _spriteBatch, _content, "");

            sf.SetBackgroundMaterial(@"GUI\Windows\ButtonBackground");
            sf.Size = new WindowSize(sf.BackgroundMaterial.Width, sf.BackgroundMaterial.Height);
            sf.SetFont(_textureManager.HUD_Font);
            sf.SetTitleColor(Color.Transparent);
            sf.IsTextVisible  = false;
            sf.IsStatic       = true;
            sf.Location       = new Vector2(_spriteBatch.GraphicsDevice.Viewport.Width / 2, 0);
            sf.OnUpdateEvent += HUDButtonsWindow_OnUpdateEvent;


            //System Button
            Button systemButton = CreateButton("", sf);

            systemButton.SetBackgroundMaterial(@"GUI\Windows\Button_SystemIcon");
            systemButton.OnClickEvent  += systemButton_OnClickEvent;
            systemButton.OnUpdateEvent += systemButton_OnUpdateEvent;
            systemButton.Size           = new WindowSize(systemButton.BackgroundMaterial.Width,
                                                         systemButton.BackgroundMaterial.Height);
            systemButton.Location = new Vector2(sf.Location.X, sf.Location.Y + 4);
            systemButton.IsStatic = true;

            //Galaxy Button
            Button galaxyButton = CreateButton("", sf);

            galaxyButton.SetBackgroundMaterial(@"GUI\Windows\Button_GalaxyIcon");
            galaxyButton.OnClickEvent  += galaxyButton_OnClickEvent;
            galaxyButton.OnUpdateEvent += galaxyButton_OnUpdateEvent;
            galaxyButton.Size           = new WindowSize(galaxyButton.BackgroundMaterial.Width,
                                                         galaxyButton.BackgroundMaterial.Height);
            galaxyButton.Location = new Vector2((sf.Location.X) + 1 * galaxyButton.BackgroundMaterial.Width,
                                                sf.Location.Y + 4);
            galaxyButton.IsStatic = true;

            //Galaxy Button
            Button debugButton = CreateButton("", sf);

            debugButton.SetBackgroundMaterial(@"GUI\Windows\Button_GalaxyIcon");
            debugButton.OnClickEvent  += debugButton_OnClickEvent;
            debugButton.OnUpdateEvent += debugButton_OnUpdateEvent;
            debugButton.Size           = new WindowSize(debugButton.BackgroundMaterial.Width,
                                                        debugButton.BackgroundMaterial.Height);
            debugButton.Location = new Vector2((sf.Location.X) + 1 * debugButton.BackgroundMaterial.Width,
                                               sf.Location.Y + 4);
            debugButton.IsStatic = true;
            sf.Show();
            return(sf);
        }
        public ActionResult Edit(Guid id, StandardForm standardForm)
        {
            if (!ModelState.IsValid)
            {
                return(View(standardForm));
            }
            var available = _standardService.IsNameAvailable(standardForm.Name, id);

            if (!available)
            {
                return(View(standardForm).WithError("Ya existe un estandar con el nombre ingresado."));
            }

            _standardService.Edit(standardForm.ToStandard());

            return(RedirectToAction("Index", new StandardListFiltersModel().GetRouteValues()).WithSuccess("Estandar editado"));
        }
Beispiel #7
0
        public StandardForm CreateSystemWindow()
        {
            var sf = new StandardForm(InternalWindows, _spriteBatch, _content, "System");

            sf.SetFont(_textureManager.HUD_Font);
            sf.SetTitleColor(Color.Transparent);
            sf.Text = "Options";
            sf.SetBackgroundMaterial(_textureManager.Window700x560);
            sf.Size           = new WindowSize(sf.BackgroundMaterial.Width, sf.BackgroundMaterial.Height);
            sf.IsStatic       = false;
            sf.Centered       = true;
            sf.Transparency   = 5;
            sf.OnUpdateEvent += SystemWindow_OnUpdateEvent;
            sf.Location       = new Vector2(200, 50);
            sf.Show();
            return(sf);
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //initiate all forms
            standardForm    = new StandardForm();
            splashForm      = new SplashForm();
            startForm       = new StartForm();
            selectForm      = new SelectForm();
            productInfoForm = new ProductInfoForm();
            orderForm       = new OrderForm();
            aboutForm       = new AboutForm();

            product = new Product();

            Application.Run(splashForm);
        }
        public ActionResult Create(StandardForm standardForm)
        {
            if (!ModelState.IsValid)
            {
                return View(standardForm);
            }
            var available = _standardService.IsNameAvailable(standardForm.Name, Guid.Empty);
            if (!available)
            {
                return View(standardForm).WithError("Ya existe una standard con el nombre ingresado.");
            }

            var standard = standardForm.ToStandard();

            _standardService.Create(standard);

            return RedirectToAction("Index", new StandardListFiltersModel().GetRouteValues()).WithSuccess("Estandar creado");
        }
        public ActionResult Create(StandardForm standardForm)
        {
            if (!ModelState.IsValid)
            {
                return(View(standardForm));
            }
            var available = _standardService.IsNameAvailable(standardForm.Name, Guid.Empty);

            if (!available)
            {
                return(View(standardForm).WithError("Ya existe una standard con el nombre ingresado."));
            }

            var standard = standardForm.ToStandard();

            _standardService.Create(standard);

            return(RedirectToAction("Index", new StandardListFiltersModel().GetRouteValues()).WithSuccess("Estandar creado"));
        }
Beispiel #11
0
        public StandardForm CreateNotification(string context)
        {
            var sf = new StandardForm(InternalWindows, _spriteBatch, _content, "Notification");

            sf.SetFont(_textureManager.HUD_Font);
            sf.SetTitleColor(Color.Transparent);
            sf.Text     = context;
            sf.IsStatic = true;
            sf.Centered = true;
            sf.SetBackgroundMaterial(@"GUI\Windows\Notification250x100");
            sf.Size         = new WindowSize(sf.BackgroundMaterial.Width, sf.BackgroundMaterial.Height);
            sf.Location     = new Vector2(_spriteBatch.GraphicsDevice.Viewport.Width / 2 - sf.Size.Width / 2, 10);
            sf.WindowDown   = false;
            sf.Timer        = 1;
            sf.Transparency = 255;
            sf.Show();
            sf.OnUpdateEvent += NotificationUpdateEvent;
            return(sf);
        }
 public ActionResult Create()
 {
     var standardForm = new StandardForm();
     return View(standardForm);
 }
 /// <summary>
 /// Select the 'Standard' radio button
 /// </summary>
 public void ClickStandardFormRadioButton()
 {
     Console.Out.WriteLineAsync("Page: Attempting to Click Standard form Radio button");
     StandardForm.WaitAndClick(_driver);
 }
Beispiel #14
0
 /// <summary>
 /// Creates a new StandardForm and passes by reference (efficient)
 /// </summary>
 /// <param name="sf">Form to assign value</param>
 /// <param name="name">Name of form</param>
 public void CreateStandardForm(ref StandardForm sf, string name)
 {
     sf = new StandardForm(InternalWindows, _spriteBatch, _content, name);
     sf.Initialize(_spriteBatch, _content); // Important because UI elements store references to both.
 }
Beispiel #15
0
        public StandardForm CreateHealthShieldBars()
        {
            var sf = new StandardForm(InternalWindows, _spriteBatch, _content, "");

            sf.SetFont(_textureManager.HUD_Font);
            sf.SetTitleColor(Color.Transparent);
            sf.IsTextVisible = false;
            sf.SetBackgroundMaterial(@"GUI\Windows\3Bars");
            sf.Size     = new WindowSize(sf.BackgroundMaterial.Width, sf.BackgroundMaterial.Height);
            sf.IsStatic = false;
            sf.Centered = true;
            sf.Location = new Vector2(0, 0);

            //Static Button

            Button staticButton = CreateStaticButton("staticButton", sf);

            staticButton.Location = sf.Location;
            staticButton.Trigger  = true;
            staticButton.Size     = new WindowSize(staticButton.BackgroundMaterial.Width,
                                                   staticButton.BackgroundMaterial.Height);

            //Health Bar
            Bar b2 = CreateBar("", sf);

            b2.SetBackgroundMaterial(@"GUI\Windows\Bar_Health");
            b2.OnUpdateEvent += HealthBarUpdate;
            b2.Size           = new WindowSize(b2.BackgroundMaterial.Width, b2.BackgroundMaterial.Height);
            b2.Location       = new Vector2(0, 0);
            b2.IsStatic       = true;

            Label lbl = CreateLabel(ref sf, "Health");

            lbl.SetFont(_textureManager.HUD_Font);
            lbl.SetTextColor(Color.AntiqueWhite);
            lbl.OnUpdateEvent += HealthLabelUpdate;
            lbl.IsStatic       = true;
            lbl.Text           = "" + _shipManager.PlayerShip.CurrentHealth;
            //lbl.TextColor = Color.AntiqueWhite;
            lbl.Location =
                new Vector2(
                    (int)b2.Location.X + (b2.BackgroundMaterial.Width / 2f) -
                    (_debugTextManager.GetFont().MeasureString(b2.Text).X / 2f),
                    b2.Location.Y + (b2.BackgroundMaterial.Height / 4f));


            //Shields Bar
            Bar b = CreateBar("", sf);

            b.SetBackgroundMaterial(@"GUI\Windows\Bar_Shields");
            b.OnUpdateEvent += ShieldsBarUpdate;
            b.Size           = new WindowSize(b.BackgroundMaterial.Width, b.BackgroundMaterial.Height);
            b.IsStatic       = true;
            b.Location       = new Vector2(0, 33);

            Label lbl2 = CreateLabel(ref sf, "Shields");

            lbl2.SetFont(_textureManager.HUD_Font);
            lbl2.SetTextColor(Color.AntiqueWhite);
            lbl2.OnUpdateEvent += ShieldsLabelUpdate;
            lbl2.IsStatic       = true;
            lbl2.Text           = "" + _shipManager.PlayerShip.CurrentShields;
            //lbl2.TextColor = Color.LightBlue;
            lbl2.Location =
                new Vector2(
                    (int)b.Location.X + (b.BackgroundMaterial.Width / 2f) -
                    (_debugTextManager.GetFont().MeasureString(b.Text).X / 2f),
                    b.Location.Y + (b.BackgroundMaterial.Height / 4f));


            //Energy Bar
            Bar b3 = CreateBar("", sf);

            b3.SetBackgroundMaterial(@"GUI\Windows\Bar_Energy");
            b3.OnUpdateEvent += EnergyBarUpdate;
            b3.Size           = new WindowSize(b3.BackgroundMaterial.Width, b3.BackgroundMaterial.Height);
            b3.IsStatic       = true;
            b3.Location       = new Vector2(0, 66);

            Label lbl3 = CreateLabel(ref sf, "Energy");

            lbl3.SetFont(_textureManager.HUD_Font);
            lbl3.SetTextColor(Color.AntiqueWhite);
            lbl3.OnUpdateEvent += EnergyLabelUpdate;
            lbl3.IsStatic       = true;
            lbl3.Text           = "" + _shipManager.PlayerShip.CurrentShields;
            //lbl3.TextColor = Color.LightBlue;
            lbl3.Location =
                new Vector2(
                    (int)b3.Location.X + (b3.BackgroundMaterial.Width / 2f) -
                    (_debugTextManager.GetFont().MeasureString(b3.Text).X / 2f),
                    b3.Location.Y + (b3.BackgroundMaterial.Height / 4f));


            sf.Show();

            return(sf);
        }
        public ActionResult Create()
        {
            var standardForm = new StandardForm();

            return(View(standardForm));
        }
        public ActionResult Edit(Guid id, StandardForm standardForm)
        {
            if (!ModelState.IsValid)
            {
                return View(standardForm);
            }
            var available = _standardService.IsNameAvailable(standardForm.Name, id);
            if (!available)
            {
                return View(standardForm).WithError("Ya existe un estandar con el nombre ingresado.");
            }

            _standardService.Edit(standardForm.ToStandard());

            return RedirectToAction("Index", new StandardListFiltersModel().GetRouteValues()).WithSuccess("Estandar editado");
        }
Beispiel #18
0
        public StandardForm CreateAuxiliaryInformationPanels()
        {
            StandardForm sf = CreateStandardForm("Auxiliary");

            sf.SetFont(_textureManager.HUD_Font);
            sf.HasTitleBar   = false;
            sf.IsTextVisible = false;

            sf.SetBackgroundColor(Color.Transparent);
            sf.IsStatic       = true;
            sf.Centered       = true;
            sf.OnUpdateEvent += portDockedHud_OnUpdateEvent;
            sf.Location       = new Vector2(_spriteBatch.GraphicsDevice.Viewport.Width - _textureManager.DockableTextBar.Width,
                                            _spriteBatch.GraphicsDevice.Viewport.Height - _textureManager.DockableTextBar.Height);
            // F**k this shit, hardcoded for now.

            int bars = 0;
            // Money Bar //
            Bar b = CreateBar("Money Display", sf);

            b.SetBackgroundMaterial(_textureManager.DockableTextBar);
            b.Location       = new Vector2(sf.Location.X, sf.Location.Y + (b.BackgroundMaterial.Height * bars));
            b.OnUpdateEvent += BarAlign;
            b.Size           = new WindowSize(b.BackgroundMaterial.Width, b.BackgroundMaterial.Height);
            b.IsStatic       = true;

            Label bl = AddLabelToTextPanel(b, sf); // This is where the actual text is stored

            // Here we set all of the variables
            bl.OnUpdateEvent += portCashDisplay_OnUpdateEvent;
            bl.Text           = "Money: " + _shipManager.currentCash;
            bl.Location       =
                new Vector2(
                    (int)b.Location.X + b.BackgroundMaterial.Width - RightHandMargin -
                    (_debugTextManager.GetFont().MeasureString(bl.Text).X), b.Location.Y);


            bars++;
            // Money Bar //
            Bar b2 = CreateBar("Shields Display", sf);

            b2.SetBackgroundMaterial(_textureManager.DockableTextBar);
            b2.Location = new Vector2(sf.Location.X,
                                      sf.Location.Y - (b2.BackgroundMaterial.Height * bars) + ((numberOfBars) * 2) - 1);
            b2.OnUpdateEvent += BarAlign;
            b2.Size           = new WindowSize(b2.BackgroundMaterial.Width, b2.BackgroundMaterial.Height);
            b2.IsStatic       = true;

            Label bl2 = AddLabelToTextPanel(b2, sf); // This is where the actual text is stored

            // Here we set all of the variables
            bl2.OnUpdateEvent += CurrentShields_OnUpdateEvent;
            if (_shipManager.PlayerShip != null)
            {
                bl2.Text = GetConcatinatedString("Hull: " + _shipManager.PlayerShip.CurrentHealth,
                                                 "Shields: " + _shipManager.PlayerShip.CurrentShields,
                                                 bl2.Font, bl2.Owner.Size.Width - RightHandMargin, RightHandMargin);
            }
            bl2.Location =
                new Vector2(
                    (int)b2.Location.X + b2.BackgroundMaterial.Width - RightHandMargin -
                    (_debugTextManager.GetFont().MeasureString(bl2.Text).X), b2.Location.Y);


            // Keeps from going off screen on resize
            sf.Size = new WindowSize(_textureManager.DockableTextBar.Width, _textureManager.DockableTextBar.Height * bars);

            sf.Show();
            return(sf);
        }