Ejemplo n.º 1
0
        public IControl GetEditForm()
        {
            var form = new Form();

            form.Style = "padding-left: 11px; padding-top: 5px;";
            var idHidden       = new MiniHidden("ID"); form.AddControl(idHidden);
            var parentIDHidden = new MiniHidden("ParentID"); form.AddControl(parentIDHidden);

            foreach (var attr in this.S_DOC_NodeAttr.Where(d => d.Visible == "False").ToList())
            {
                var hidden = new MiniHidden(attr.AttrField); form.AddControl(hidden);
            }
            var  table     = ControlGenrator.CreateDefaultFormTable();
            bool changeRow = true;

            foreach (var attr in this.S_DOC_NodeAttr.Where(d => d.Visible == "True").OrderBy(d => d.AttrSort).ToList())
            {
                if (attr.IsFullRow)
                {
                    var row  = new TableRow();
                    var cell = new TableCell();
                    cell.InnerText = attr.AttrName;
                    row.AddControl(cell);
                    var ctrlCell = new TableCell(); ctrlCell.ColSpan = 3;
                    ctrlCell.Style = "padding-right:40px;";
                    var control = attr.GetCtontrol();
                    ctrlCell.AddControl(control);
                    row.AddControl(ctrlCell);
                    table.AddControl(row); changeRow = true;
                }
                else
                {
                    var cell = new TableCell();
                    cell.InnerText = attr.AttrName;
                    var ctrlCell = new TableCell();
                    ctrlCell.Style = "padding-right:40px;";
                    var control = attr.GetCtontrol();
                    ctrlCell.AddControl(control);
                    if (changeRow)
                    {
                        var row = new TableRow();
                        row.AddControl(cell); row.AddControl(ctrlCell);
                        table.AddControl(row);
                        changeRow = false;
                    }
                    else
                    {
                        var row = table.Rows.LastOrDefault();
                        row.AddControl(cell); row.AddControl(ctrlCell);
                        changeRow = true;
                    }
                }
            }
            form.AddControl(table);
            return(form);
        }
Ejemplo n.º 2
0
        public void Notice(string message, string title = "")
        {
            Form form = new Form(title);

            ContentText msg = new ContentText(message);
            Button      btn = new Button("OK");

            form.AddControl(msg);
            form.AddControl(btn);

            SendForm(form);
        }
Ejemplo n.º 3
0
        public void PromptForCreation(string createType, EventHandler submit)
        {
            this.PromptName = new TextBox();

            var label = new Label();

            label.Text = "Enter the name of the new " + createType + ":";

            var form = new Form();

            form.AddControl("Name: ", this.PromptName);

            var submitButton = new Button();

            submitButton.Text   = "Create";
            submitButton.Click += (sender, e) =>
            {
                submit(sender, e);
                this.m_CanvasEntity.Windows.Remove(this.PromptWindow);
                this.PromptWindow = null;
                this.PromptName   = null;
            };

            var cancelButton = new Button();

            cancelButton.Text   = "Cancel";
            cancelButton.Click += (sender, e) =>
            {
                this.m_CanvasEntity.Windows.Remove(this.PromptWindow);
                this.PromptWindow = null;
                this.PromptName   = null;
            };

            var horizontalContainer = new HorizontalContainer();

            horizontalContainer.AddChild(submitButton, "50%");
            horizontalContainer.AddChild(cancelButton, "50%");

            var verticalContainer = new VerticalContainer();

            verticalContainer.AddChild(label, "24");
            verticalContainer.AddChild(form, "*");
            verticalContainer.AddChild(horizontalContainer, "24");

            this.PromptWindow        = new Window();
            this.PromptWindow.Modal  = true;
            this.PromptWindow.Bounds = new Microsoft.Xna.Framework.Rectangle(
                (int)this.m_CanvasEntity.Width / 2 - 150,
                (int)this.m_CanvasEntity.Height / 2 - 75,
                300,
                150);
            this.PromptWindow.SetChild(verticalContainer);
            this.m_CanvasEntity.Windows.Add(this.PromptWindow);

            this.MainMenu.Active = false;
            foreach (var item in this.MainMenu.Children.Cast <MenuItem>())
            {
                item.Active = false;
            }
        }
Ejemplo n.º 4
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FileSelect = new FileSelect {
                Path = this.m_Asset.SourcePath
            };
            this.m_FileSelect.Changed += (sender, e) =>
            {
                this.m_Asset.SourcePath = this.m_FileSelect.Path;
                using (var stream = new StreamReader(this.m_Asset.SourcePath, Encoding.UTF8))
                {
                    this.m_Asset.Value = stream.ReadToEnd();
                }
                assetManager.Save(this.m_Asset);
            };

            var form = new Form();

            form.AddControl("Source File:", this.m_FileSelect);

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");

            editorContainer.SetChild(vertContainer);
        }
Ejemplo n.º 5
0
        public void Main(string ApplicationPath, string[] Args)
        {
            Form frmPacman = new Form("frmPacman");
            frmPacman.ButtonPressed += frmPacman_ButtonPressed;

            Bitmap bmpGame;
            Picturebox pbGame;

            bmpGame = new Bitmap(320, 240);

            if (Prompt.Show("Resolution Adjust", "Would you like to play at 640x480?", Fonts.Calibri18Bold, Fonts.Calibri14, PromptType.YesNo) == PromptResult.Yes)
            {
                pbGame = new Picturebox("pbGame", bmpGame, frmPacman.Width / 2 - 320, frmPacman.Height / 2 - 240, 640, 480, BorderStyle.BorderNone);
                pbGame.ScaleMode = ScaleMode.Stretch;
            }
            else
                pbGame = new Picturebox("pbGame", bmpGame, frmPacman.Width / 2 - 160, frmPacman.Height / 2 - 140, BorderStyle.BorderNone);

            pbGame.Background = Colors.Black;
            game = new PacmanGame(bmpGame, pbGame);
            frmPacman.AddControl(pbGame);

            Graphics.ActiveContainer = frmPacman;

            Thread.Sleep(100);
            if (joystick != null)
            {
                game.InputManager.AddInputProvider(joystick);
                game.Initialize();
            }
        }
Ejemplo n.º 6
0
        public IControl GetQueryForm()
        {
            var form      = new Form(); form.ID = "queryForm";
            var queryList = this.S_DOC_Space.S_DOC_ListConfig.FirstOrDefault(d => d.RelationID == this.ID).S_DOC_QueryParam.OrderBy(d => d.QuerySort).ToList();
            var table     = ControlGenrator.CreateDefaultQueryFormTable();

            for (int i = 0; i < queryList.Count; i++)
            {
                var query = queryList[i];
                if (i % 3 == 0)
                {
                    var row = new TableRow();
                    table.AddControl(row);
                }
                var currentRow = table.Rows.LastOrDefault();
                var cell       = new TableCell();
                cell.InnerText = query.AttrName;
                cell.Style     = " text-align: center; ";
                var contronCell = new TableCell();
                contronCell.AddControl(query.GetCtontrol());
                currentRow.AddControl(cell); currentRow.AddControl(contronCell);
            }
            form.AddControl(table);
            return(form);
        }
Ejemplo n.º 7
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FileSelect          = new FileSelect();
            this.m_FileSelect.Changed += (sender, e) =>
            {
                using (var stream = new FileStream(this.m_FileSelect.Path, FileMode.Open))
                {
                    using (var reader = new BinaryReader(stream))
                    {
                        this.m_Asset.RawData = reader.ReadBytes((int)stream.Length);
                    }
                }
                assetManager.Recompile(this.m_Asset);
                assetManager.Save(this.m_Asset);
            };

            var form = new Form();

            form.AddControl("Source File:", this.m_FileSelect);

            //var textureViewer = new TextureViewer();
            //textureViewer.Texture = this.m_Asset;

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");
            //vertContainer.AddChild(textureViewer, "400");

            editorContainer.SetChild(vertContainer);
        }
Ejemplo n.º 8
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_TextureAssetName = new TextBox {
                Text = this.m_Asset.TextureName
            };
            this.m_TextureAssetName.TextChanged += (sender, e) =>
            {
                if (assetManager.TryGet <TextureAsset>(this.m_TextureAssetName.Text) != null)
                {
                    this.m_Asset.TextureName = this.m_TextureAssetName.Text;
                    assetManager.Save(this.m_Asset);
                }
            };
            this.m_CellWidth = new TextBox {
                Text = this.m_Asset.CellWidth.ToString()
            };
            this.m_CellWidth.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.CellWidth = Convert.ToInt32(this.m_CellWidth);
                    assetManager.Save(this.m_Asset);
                }
                catch { }
            };
            this.m_CellHeight = new TextBox {
                Text = this.m_Asset.CellHeight.ToString()
            };
            this.m_CellHeight.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.CellHeight = Convert.ToInt32(this.m_CellHeight);
                    assetManager.Save(this.m_Asset);
                }
                catch { }
            };

            var form = new Form();

            form.AddControl("Texture Name:", this.m_TextureAssetName);
            form.AddControl("Cell Width:", this.m_CellWidth);
            form.AddControl("Cell Height:", this.m_CellHeight);

            editorContainer.SetChild(form);
        }
Ejemplo n.º 9
0
        public RowanSeqStep(string text, Vector2 position, Scene scene, bool appearBadGuy = false, bool showtextscreen = true)
            : this()
        {
            scene.Camera.Zoom = 1f;
            _text             = text;
            _position         = position;
            _scene            = scene;
            _appearBadGuy     = appearBadGuy;
            _showtextscreen   = showtextscreen;
            TimePerMessage    = 0.5f;

            var theme = new Theme(scene.Pipeline.GetFont("font1", scene), scene.Pipeline.GetTexture("null"), Rectangle.Empty
                                  , scene.Pipeline.GetTexture("null"), Rectangle.Empty, scene.Pipeline.GetTexture("MessageWindow", scene), Rectangle.Empty);

            if (_gui == null)
            {
                _gui = new Gui();
            }
            var formSize = scene.Pipeline.GetTexture("MessageWindow").Bounds.Size.ToVector2() * new Vector2(1.25f, 1.25f);

            _form = new Form(theme)
            {
                ForceEntireTexture = true,
                ForceSelection     = true,
                IsMoveable         = false,
                Size     = formSize,
                Position = new Vector2(1080 / 2 - formSize.X / 2, 720 / 1.1f - formSize.Y)
            };
            Label l = new Label(theme)
            {
                Text                  = text,
                MultiLine             = true,
                CharacterCountPerLine = 64,
                LabelColor            = Color.Black
            };

            _form.AddControl("Label", l);
            l.Position = new Vector2(formSize.X / 2 - l.Size.X / 2, formSize.Y / 2 - l.Size.Y / 2);
            _gui.AddControl(text, _form);
            scene.Camera.ClampingEnabled = false;
            //scene.Camera.Zoom = 2.5f;
            _form.Hidden = true;

            // Need to put textures into Rowans content folder and redo theme init.
            // add multi line label to form etc... finish intro scene
            // add particle effects for bad guy appearance and disappearance
            // create levels, finish level changing make obstacles and create sound
            // preferably some swing music because I feel like that fits this game well
            // and game should be based in the 60's. Create timescale (just change the game time
            // value) for the ending scene, animate the kissing scene draw guy waking up in bed and
            // come to the realization its a dream, maybe make the time zone in the wake up scene modern
            // Finish commenting out engine and making code more readable. Where to go from here?
        }
Ejemplo n.º 10
0
        void Home()
        {
            frmMain = new Form("frmMain");
            frmMain.BackgroundImage = Resources.GetBitmap(Resources.BitmapResources.CP7Background);

            // Appbar
            frmMainAppbar = new Appbar("ab1", Fonts.Calibri9, Fonts.Calibri24);
            frmMainAppbar.AddMenuItems(new string[] { "Launch Pacman" });
            frmMainAppbar.AppMenuSelected += new OnAppMenuSelected((object sender, int id, string value) => new Thread(AppbarItemSelected).Start());
            frmMain.AddControl(frmMainAppbar);

            // Activate
            Graphics.ActiveContainer = frmMain;
        }
Ejemplo n.º 11
0
        public NetworkGameSelectScreen(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont, Texture2D backgorund)
            : base(game, spriteBatch)
        {
            Vector2 formSize = new Vector2(150, 200);
            Vector2 center   = new Vector2((this.windowSize.Width - formSize.X) / 2, (this.windowSize.Height - formSize.Y) / 2);

            formBackground = game.Content.Load <Texture2D>("alienmetal");
            buttonTexture  = game.Content.Load <Texture2D>("buttonTexture");

            networkGameTypeSelectForm = new Form("GameTypeMenu", "Network Game", new Rectangle((int)center.X, (int)center.Y, (int)formSize.X, (int)formSize.Y), formBackground, spriteFont, Color.White);
            backButton     = new Button("BackButton", @"Back", new Rectangle(27, 132, 95, 23), buttonTexture, spriteFont, Color.White);
            joinGameButton = new Button("JoinGame", @"Join Game", new Rectangle(27, 90, 95, 23), buttonTexture, spriteFont, Color.White);
            hostGameButton = new Button("HostGame", @"Host Game", new Rectangle(27, 42, 95, 23), buttonTexture, spriteFont, Color.White);


            networkGameTypeSelectForm.AddControl(hostGameButton);
            networkGameTypeSelectForm.AddControl(joinGameButton);
            networkGameTypeSelectForm.AddControl(backButton);

            hostGameButton.onClick += new EHandler(ButtonClick);
            joinGameButton.onClick += new EHandler(ButtonClick);
            backButton.onClick     += new EHandler(ButtonClick);
        }
Ejemplo n.º 12
0
        public JoinNetworkGameScreen(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont, Texture2D background)
            : base(game, spriteBatch)
        {
            this.background = background;
            formBackground  = game.Content.Load <Texture2D>("alienmetal");
            Vector2 formSize = new Vector2(350, 350);
            Vector2 center   = new Vector2((this.windowSize.Width - formSize.X) / 2, (this.windowSize.Height - formSize.Y) / 2);

            connectionMethodForm = new Form("Connect", "Connection Metod", new Rectangle((int)center.X, (int)center.Y, (int)formSize.X, (int)formSize.Y), formBackground, spriteFont, Color.White);

            buttonTexture  = game.Content.Load <Texture2D>("buttonTexture");
            textboxTexture = game.Content.Load <Texture2D>("textboxTexture");

            //figure out the width and heigh of the text on the buttons
            Vector2 lanButtonSize, connectButtonSize;

            lanButtonSize     = spriteFont.MeasureString("Scan Lan");
            connectButtonSize = spriteFont.MeasureString("Connect");
            lanButton         = new Button("ScanLan", "Scan LAN", new Rectangle(32, 30, (int)lanButtonSize.X + 10, (int)lanButtonSize.Y + 10), buttonTexture, spriteFont, Color.White);
            sendButton        = new Button("Connect", "Connect", new Rectangle(32, 151, (int)connectButtonSize.X + 10, (int)connectButtonSize.Y + 10), buttonTexture, spriteFont, Color.White);
            backButton        = new Button("BackButton", @"Back", new Rectangle(32, 192, 95, 23), buttonTexture, spriteFont, Color.White);
            textBoxIP         = new TextBox("Address", "", 100, new Rectangle(32, 110, 232, 20), textboxTexture, spriteFont, Color.Black);
            textBoxPort       = new TextBox("Port", "", 8, new Rectangle(288, 110, 60, 20), textboxTexture, spriteFont, Color.Black);

            connectionMethodForm.AddControl(lanButton);
            connectionMethodForm.AddControl(sendButton);
            connectionMethodForm.AddControl(backButton);
            connectionMethodForm.AddControl(textBoxIP);
            connectionMethodForm.AddControl(textBoxPort);

            lanButton.onClick  += new EHandler(ButtonClick);
            sendButton.onClick += new EHandler(ButtonClick);
            backButton.onClick += new EHandler(ButtonClick);


            imageRectangle = new Rectangle(0, 0, Game.Window.ClientBounds.Width, Game.Window.ClientBounds.Height);
        }
Ejemplo n.º 13
0
        public StartScreen(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont)
            : base(game, spriteBatch)
        {
            //screenSize = game.GraphicsDevice.Viewport.Bounds;
            //TAKE THE WIDTH AND HEIGHT MINUS THE MAIN FORM WIDTH AND HEIGHT DIVEDED BY 2 TO GET CENTER ON X AND Y
            Vector2 formSize = new Vector2(150, 200);
            Vector2 center   = new Vector2((this.windowSize.Width - formSize.X) / 2, (this.windowSize.Height - formSize.Y) / 2);

            formBackground = game.Content.Load <Texture2D>("alienmetal");
            buttonTexture  = game.Content.Load <Texture2D>("buttonTexture");

            mainMenuForm      = new Form("MainMenu", "Main Menu", new Rectangle((int)center.X, (int)center.Y, (int)formSize.X, (int)formSize.Y), formBackground, spriteFont, Color.White);
            quitGameButton    = new Button("QuitGame", @"Quit Game", new Rectangle(27, 132, 95, 23), buttonTexture, spriteFont, Color.White);
            networkGameButton = new Button("NetworkGame", @"Network Game", new Rectangle(27, 90, 95, 23), buttonTexture, spriteFont, Color.White);
            startGameButton   = new Button("StartGame", @"Start Game", new Rectangle(27, 42, 95, 23), buttonTexture, spriteFont, Color.White);

            mainMenuForm.AddControl(startGameButton);
            mainMenuForm.AddControl(networkGameButton);
            mainMenuForm.AddControl(quitGameButton);

            startGameButton.onClick   += new EHandler(ButtonClick);
            networkGameButton.onClick += new EHandler(ButtonClick);
            quitGameButton.onClick    += new EHandler(ButtonClick);
        }
Ejemplo n.º 14
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_TextBox = new TextBox {
                Text = this.m_Asset.Value
            };
            this.m_TextBox.TextChanged += (sender, e) =>
            {
                this.m_Asset.Value = this.m_TextBox.Text;
                assetManager.Save(this.m_Asset);
            };

            var form = new Form();

            form.AddControl("English:", this.m_TextBox);
            editorContainer.SetChild(form);
        }
Ejemplo n.º 15
0
        public TextScreen(TmxObject e, Scene scene)
            : base(e, scene)
        {
            _scene       = scene;
            pressedEnter = false;
            string text = e.Properties["Text"];

            _text = text;
            GameObject a = new GameObject("LevelLoader", scene, new Vector2((int)e.X + (int)e.Width / 2, (int)e.Y + (int)e.Height / 2));

            a.AddComponent("Collider", new RectangleCollider(0, 0, (int)e.Width, (int)e.Height, 0f));
            a.Body.IsStatic      = true;
            a.Body.IsSensor      = true;
            a.Body.OnCollision  += Body_OnCollision;
            a.Body.OnSeparation += Body_OnSeparation;
            playercolliders      = new List <Fixture>();
            if (_gui == null)
            {
                _gui = new Gui();
                var theme = new Theme(scene.Pipeline.GetFont("font1", scene), scene.Pipeline.GetTexture("null"), Rectangle.Empty
                                      , scene.Pipeline.GetTexture("null"), Rectangle.Empty, scene.Pipeline.GetTexture("MessageWindow", scene), Rectangle.Empty);
                _form = new Form(theme);
                var formSize = scene.Pipeline.GetTexture("MessageWindow").Bounds.Size.ToVector2() * new Vector2(1.25f, 1.25f);
                _form = new Form(theme)
                {
                    ForceEntireTexture = true,
                    ForceSelection     = true,
                    IsMoveable         = false,
                    Size     = formSize,
                    Position = new Vector2(1080 / 2 - formSize.X / 2, 720 / 1.1f - formSize.Y)
                };
                Label l = new Label(theme)
                {
                    Text                  = text,
                    MultiLine             = true,
                    CharacterCountPerLine = 64,
                    LabelColor            = Color.Black
                };
                _form.AddControl("Label", l);
                l.Position = new Vector2(formSize.X / 2 - l.Size.X / 2, formSize.Y / 2 - l.Size.Y / 2);
                _gui.AddControl(text, _form);
                _form.Hidden     = true;
                _form.IsMoveable = false;
            }
        }
Ejemplo n.º 16
0
    internal static void ChangeScene(string deleteControlName, string addControlName, InitFormType initFormType)
    {
        Form currForm = Form.ActiveForm;

        currForm.DeleteControl(deleteControlName);
        currForm.AddControl(addControlName);
        switch (initFormType)
        {
        case InitFormType.InitAfterMainMenu:
            currForm.InitAfterMainMenu();
            break;

        case InitFormType.InitForMainMenu:
            currForm.InitForMainMenu();
            break;

        default:
            break;
        }
    }
Ejemplo n.º 17
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FileSelect          = new FileSelect();
            this.m_FileSelect.Changed += (sender, e) =>
            {
                using (var reader = new StreamReader(this.m_FileSelect.Path))
                {
                    this.m_Asset.Code = reader.ReadToEnd();
                }
                assetManager.Recompile(this.m_Asset);
                assetManager.Save(this.m_Asset);
            };

            var form = new Form();

            form.AddControl("Source File:", this.m_FileSelect);

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");

            editorContainer.SetChild(vertContainer);
        }
Ejemplo n.º 18
0
        private void AuthenticationForm()
        {
            var frm = new Form("authentication");

            // Add panel
            var pnl = new Skewworks.Tinkr.Controls.Panel("pnl1", 0, 0, 800, 480)
                          {BackgroundImage = Resources.GetBitmap(Resources.BitmapResources.Zombies)};
            frm.AddControl(pnl);

            // Add the app bar.
            pnl.AddControl(BuildAppBar(frm.Name));

            // Add a title.
            var title = new Label("lblTitle", "Authentication is Required", _fntHuge, frm.Width / 2 - 175, frm.Height/2 - 5) { Color = Gadgeteer.Color.Red };
            pnl.AddControl(title);

            rfid.CardIDRecieved += (sender, id) =>
                                       {
                                           title.Text = "Welcome back, Mr. Lee.";
                                           Thread.Sleep(2000);
                                           ZombieCannonRemoteForm();
                                       };
            TinkrCore.ActiveContainer = frm;
        }
Ejemplo n.º 19
0
        public HostNetworkGameScreen(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont, Texture2D background)
            : base(game, spriteBatch)
        {
            this.background = background;
            formBackground  = game.Content.Load <Texture2D>("alienmetal");
            buttonTexture   = game.Content.Load <Texture2D>("buttonTexture");
            textboxTexture  = game.Content.Load <Texture2D>("textboxTexture");

            //center the form ont he screen
            Rectangle center = this.CenterGUIForm(242, 224);

            hostGameForm = new Form("Host", "Host a Game", new Rectangle(center.X, center.Y, center.Width, center.Height), formBackground, spriteFont, Color.White);

            //figure out the width and heigh of the text on the buttons
            Vector2 startButtonSize, backButtonSize;

            startButtonSize = spriteFont.MeasureString("Start Game");
            backButtonSize  = spriteFont.MeasureString("Back");

            startButton = new Button("Start", "Start Game", new Rectangle(6, 186, (int)startButtonSize.X + 10, (int)startButtonSize.Y + 10), buttonTexture, spriteFont, Color.White);
            backButton  = new Button("BackButton", @"Back", new Rectangle(132, 186, (int)startButtonSize.X + 10, (int)startButtonSize.Y + 10), buttonTexture, spriteFont, Color.White);

            textBoxMaxConnections = new TextBox("MaxConnections", "10", 100, new Rectangle(11, 42, 60, 20), textboxTexture, spriteFont, Color.Black);
            maxConnectionsLabel   = new Label("maxConnectionsLabel", @"Max Connections", new Vector2(8, 26), spriteFont, Color.White, 0, 0);

            textBoxPort = new TextBox("Port", "14242", 8, new Rectangle(11, 116, 60, 20), textboxTexture, spriteFont, Color.Black);
            portLabel   = new Label("portLabel", @"Port", new Vector2(8, 91), spriteFont, Color.White, 0, 0);

            hostGameForm.AddControl(startButton);
            hostGameForm.AddControl(backButton);
            hostGameForm.AddControl(textBoxMaxConnections);
            hostGameForm.AddControl(maxConnectionsLabel);
            hostGameForm.AddControl(textBoxPort);
            hostGameForm.AddControl(portLabel);

            startButton.onClick += new EHandler(ButtonClick);
            backButton.onClick  += new EHandler(ButtonClick);

            imageRectangle = new Rectangle(0, 0, Game.Window.ClientBounds.Width, Game.Window.ClientBounds.Height);
        }
Ejemplo n.º 20
0
        private void ZombieCannonRemoteForm()
        {
            var frm = new Form("zombie cannon remote");

            // Add panel
            var pnl = new Skewworks.Tinkr.Controls.Panel("pnl1", 0, 0, 800, 480);
            pnl.BackgroundImage = Resources.GetBitmap(Resources.BitmapResources.Zombies);
            frm.AddControl(pnl);

            // Add the app bar.
            pnl.AddControl(BuildAppBar(frm.Name));

            // Add a title.
            var title = new Label("lblTitle", "Zombie Cannon Remote", _fntHuge, frm.Width/2 - 175, 30)
                            {Color = Gadgeteer.Color.Yellow};
            pnl.AddControl(title);

            // Add a fire button.
            //var pic1 = new Picturebox("launchBtn", Resources.GetBitmap(Resources.BitmapResources.LaunchButton), frm.Width / 2 - 150, frm.Height/2 - 150, 300, 300);
            //pic1.ButtonPressed += (sender, id) => Debug.Print("FIRE!");
            //pnl.AddControl(pic1);
            var pic1 = new Skewworks.Tinkr.Controls.Panel("launchBtn",frm.Width / 2 - 150, frm.Height/2 - 150, 300, 300);
            pic1.BackgroundImage = Resources.GetBitmap(Resources.BitmapResources.LaunchButton);
            pic1.Tap += (sender, id) => Debug.Print("FIRE!");
            pnl.AddControl(pic1);

            TinkrCore.ActiveContainer = frm;
        }
Ejemplo n.º 21
0
        private void ZombieHealthMonitorForm()
        {
            var frm = new Form("zombie health monitor");

            // Add panel
            var pnl = new Skewworks.Tinkr.Controls.Panel("pnl1", 0, 0, 800, 480);
            pnl.BackgroundImage = Resources.GetBitmap(Resources.BitmapResources.Zombies);
            frm.AddControl(pnl);

            // Add the app bar.
            pnl.AddControl(BuildAppBar(frm.Name));

            // Add a title.
            var title = new Label("lblTitle", "Zombie Health Monitor", _fntHuge, frm.Width / 2 - 140, 30) { Color = Gadgeteer.Color.Yellow };
            pnl.AddControl(title);

            // Add Heart Rate Graph.
            var graph = new Picturebox("heartRateGraph", null, 100, 200, 600, 200);
               pnl.AddControl(graph);

            TinkrCore.ActiveContainer = frm;
        }
Ejemplo n.º 22
0
        private void ZombieTwitForm()
        {
            var tweets = new[]{
                                    @"@zombieHunter Zombies are coming!"
                                    , @"@zombieHunter Zombies are getting closer!"
                                    , @"@zombieHunter THEY'RE HERE!!!"
                                    , @"@zombieHunter Send the Gadgets!!!"
                                    , @"@zombieHunter Tell my wife and kids..."
                                    , @"@zombieHunter ...I'll eat them later!"
                                };

            var frm = new Form("zombie twit");

            // Add panel
            var pnl = new Skewworks.Tinkr.Controls.Panel("pnl1", 0, 0, 800, 480);
            pnl.BackgroundImage = Resources.GetBitmap(Resources.BitmapResources.Zombies);
            frm.AddControl(pnl);

            // Add the app bar.
            pnl.AddControl(BuildAppBar(frm.Name));

            // Add a title.
            var title = new Label("lblTitle", "Zombie Twit", _fntHuge, frm.Width / 2 - 100, 50) { Color = Gadgeteer.Color.Yellow };
            pnl.AddControl(title);

            // Add a listbox
            var lb = new Listbox("lb1", _fntArialBold11, frm.Width / 2 - 200, frm.Height / 2 - 100, 400, 200, null);
            pnl.AddControl(lb);

            TinkrCore.ActiveContainer = frm;

            byte lastTweet = 0;
            var timer = new GT.Timer(2000);
            timer.Tick += timer1 =>
                              {
                                  if(lastTweet >= tweets.Length)
                                  {
                                      timer.Stop();
                                      return;
                                  }
                                  //lb.InsertAt(tweets[lastTweet++], 1);
                                  lb.AddItem(tweets[lastTweet++]);
                              };
            timer.Start();
        }
        private static string GeneratePDF(UserDataJsonModel model, bool applyRedaction)
        {
            Library.Initialize(serialNo, key);

            try
            {
                // Create a new PDF with a blank page.
                using PDFDoc doc   = new PDFDoc();
                using Form form    = new Form(doc);
                using PDFPage page = doc.InsertPage(0, PDFPage.Size.e_SizeLetter);

                // Create a text field for each property of the user data json model.
                int iteration = 0;
                foreach (var prop in model.GetType().GetProperties())
                {
                    int offset = iteration * 60;
                    using Control control = form.AddControl(page, prop.Name, Field.Type.e_TypeTextField,
                                                            new RectF(50f, 600f - offset, 400f, 640f - offset));
                    using Field field = control.GetField();
                    var propValue = prop.GetValue(model);
                    field.SetValue($"{prop.Name}: {propValue}");
                    iteration++;
                }

                // Convert fillable form fields into readonly text labels.
                page.Flatten(true, (int)PDFPage.FlattenOptions.e_FlattenAll);

                if (applyRedaction)
                {
                    // Configure our text search to look at the first (and only) page in our PDF.
                    using var redaction = new Redaction(doc);
                    page.StartParse((int)foxit.pdf.PDFPage.ParseFlags.e_ParsePageNormal, null, false);
                    using TextPage textPage = new TextPage(page,
                                                           (int)foxit.pdf.TextPage.TextParseFlags.e_ParseTextUseStreamOrder);
                    using TextSearch search = new TextSearch(textPage);
                    RectFArray rectArray = new RectFArray();

                    // Mark text starting with the pattern "SIN:" to be redacted.
                    search.SetPattern("SIN:");
                    while (search.FindNext())
                    {
                        using var searchSentence = new TextSearch(textPage);
                        var sentence = search.GetMatchSentence();
                        searchSentence.SetPattern(sentence.Substring(sentence.IndexOf("SIN:")));

                        while (searchSentence.FindNext())
                        {
                            RectFArray itemArray = searchSentence.GetMatchRects();
                            rectArray.InsertAt(rectArray.GetSize(), itemArray);
                        }
                    }

                    // If we had matches to redact, then apply the redaction.
                    if (rectArray.GetSize() > 0)
                    {
                        using Redact redact = redaction.MarkRedactAnnot(page, rectArray);
                        redact.SetFillColor(0xFF0000);
                        redact.ResetAppearanceStream();
                        redaction.Apply();
                    }
                }

                // Save the file locally and return the file's location to the caller.
                string fileOutput = "./Output.pdf";
                doc.SaveAs(fileOutput, (int)PDFDoc.SaveFlags.e_SaveFlagNoOriginal);
                return(fileOutput);
            }
            finally
            {
                Library.Release();
            }
        }
Ejemplo n.º 24
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FontNameTextBox = new TextBox {
                Text = this.m_Asset.FontName
            };
            this.m_FontNameTextBox.TextChanged += (sender, e) =>
            {
                this.m_Asset.FontName = this.m_FontNameTextBox.Text;

                this.StartCompilation(assetManager);
            };
            this.m_FontSizeTextBox = new TextBox {
                Text = this.m_Asset.FontSize.ToString()
            };
            this.m_FontSizeTextBox.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.FontSize = Convert.ToInt32(this.m_FontSizeTextBox.Text);

                    this.StartCompilation(assetManager);
                } catch (FormatException) { }
            };
            this.m_UseKerningTextBox = new TextBox {
                Text = this.m_Asset.UseKerning.ToString()
            };
            this.m_UseKerningTextBox.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.UseKerning = Convert.ToBoolean(this.m_UseKerningTextBox.Text);

                    this.StartCompilation(assetManager);
                } catch (FormatException) { }
            };
            this.m_SpacingTextBox = new TextBox {
                Text = this.m_Asset.Spacing.ToString()
            };
            this.m_SpacingTextBox.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.Spacing = Convert.ToInt32(this.m_SpacingTextBox.Text);

                    this.StartCompilation(assetManager);
                } catch (FormatException) { }
            };

            var form = new Form();

            form.AddControl("Font Name:", this.m_FontNameTextBox);
            form.AddControl("Font Size:", this.m_FontSizeTextBox);
            form.AddControl("Use Kerning (true/false):", this.m_UseKerningTextBox);
            form.AddControl("Spacing:", this.m_SpacingTextBox);

            this.m_StatusLabel      = new Label();
            this.m_StatusLabel.Text = "";

            var fontViewer = new FontViewer();

            fontViewer.Font = this.m_Asset;

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");
            vertContainer.AddChild(this.m_StatusLabel, "20");
            vertContainer.AddChild(fontViewer, "200");

            editorContainer.SetChild(vertContainer);
        }
Ejemplo n.º 25
0
        public MainMenu(Rectangle screen, ContentManager content)
        {
            _background = content.Load<Texture2D>("Textures/UI/mars_bg");
            _background_f = content.Load<Texture2D>("Textures/UI/mars_bg_f");
            _backgroundSize = screen;

            Texture2D menuTexture = content.Load<Texture2D>("Textures/UI/menu");
            Point menuPos = new Point((screen.Width / 2) - (menuTexture.Width / 2), (screen.Height / 2) - (menuTexture.Height / 2));
            menuRectangle = new Rectangle(menuPos.X, menuPos.Y - 30, menuTexture.Width, menuTexture.Height);
            _menuForm = new Form("menuForm", "", menuRectangle, menuTexture, Fonts.Standard, Color.White);

            Texture2D buttonTexture = content.Load<Texture2D>("Textures/UI/button");
            Point buttonSize = new Point(240, 40);
            Point buttonPos = new Point(40, 40);
            SpriteFont buttonFont = Fonts.Get("Menu");

            // NEW GAME BUTTON
            Button _newGame = new Button("new_game", "New Game",
                new Rectangle(40, 90, buttonSize.X, buttonSize.Y),
                buttonTexture, buttonFont, Color.Black);

            _newGame.onClick += new EHandler(NewGame_Click);
            _newGame.onMouseEnter += new EHandler(Beep);
            _menuForm.AddControl(_newGame);

            // LOAD GAME BUTTON
            Button _loadGame = new Button("load_game", "Load Game",
                new Rectangle(40, 150, buttonSize.X, buttonSize.Y),
                buttonTexture, buttonFont, Color.Black);

            _loadGame.onClick += new EHandler(LoadGame_Click);
            _loadGame.onMouseEnter += new EHandler(Beep);
            _menuForm.AddControl(_loadGame);

            // SETTINGS BUTTON
            Button _settings = new Button("settings", "Settings",
                new Rectangle(40, 210, buttonSize.X, buttonSize.Y),
                buttonTexture, buttonFont, Color.Black);

            _settings.onClick += new EHandler(Settings_Click);
            _settings.onMouseEnter += new EHandler(Beep);
            _menuForm.AddControl(_settings);

            // EXIT BUTTON
            Button _exit = new Button("exit", "Exit",
                new Rectangle(40, 270, buttonSize.X, buttonSize.Y),
                buttonTexture, buttonFont, Color.Black);

            _exit.onClick += new EHandler(Exit_Click);
            _exit.onMouseEnter += new EHandler(Beep);
            _menuForm.AddControl(_exit);

            // VERSION LABEL
            Vector2 stringSizeVersion = Fonts.Get("Tiny").MeasureString(Version.GetVersion());
            Vector2 labelPosVersion = new Vector2(160 - (stringSizeVersion.X / 2), menuTexture.Height - 20);
            Label _labelVersion = new Label("version", Version.GetVersion(), labelPosVersion, Fonts.Get("Tiny"), Color.White, Version.GetVersion().Length, 0);
            _menuForm.AddControl(_labelVersion);

            // Quote
            string quote = "Copyright © DAM Games " + DateTime.Now.Year;
            string font = "Quote";
            float stringSize = Fonts.Get(font).MeasureString(quote).X;
            _quote = new Label("quote", quote, new Vector2((screen.Width / 2) - (stringSize / 2), screen.Height - 20), Fonts.Get(font), Color.White * 0.5f, quote.Length, 0);

            // Test music
            Audio.Repeat = true;
            Audio.PlayMusicTrack("main_menu");
        }
Ejemplo n.º 26
0
        private void ZombieDistractorForm()
        {
            const int gameWidth = 320;
            const int gameHeight = 240;

            var frm = new Form("zombie distractor");

            // Add panel
            var pnl = new Skewworks.Tinkr.Controls.Panel("pnl1", 0, 0, 800, 480);
            pnl.BackgroundImage = Resources.GetBitmap(Resources.BitmapResources.Zombies);
            frm.AddControl(pnl);

            // Add the app bar.
            pnl.AddControl(BuildAppBar(frm.Name));

            // Add a title.
            var title = new Label("lblTitle", "Zombie Distractor", _fntHuge, frm.Width / 2 - 140, 30) { Color = Gadgeteer.Color.Yellow };
            pnl.AddControl(title);

            TinkrCore.ActiveContainer = frm;

            // Add Pacman.
            var surface = TinkrCore.Screen;
            _pacmanGame = new PacmanGame(surface, frm.Width/2 - gameWidth/2, frm.Height/2 - gameHeight/2);
            _pacmanGame.InputManager.AddInputProvider(new GhiJoystickInputProvider(joystick));
            _pacmanGame.Initialize();
        }
Ejemplo n.º 27
0
        public IControl GetEditForm(bool showAttachment = true, bool isUpVersion = false)
        {
            var form = new Form();

            form.Style = "padding-left: 11px; padding-top: 5px;";
            var idHidden     = new MiniHidden("ID"); form.AddControl(idHidden);
            var nodeIDHidden = new MiniHidden("NodeID"); form.AddControl(nodeIDHidden);

            foreach (var attr in this.S_DOC_FileAttr.Where(d => d.Visible == "False").ToList())
            {
                var hidden = new MiniHidden(attr.FileAttrField);
                form.AddControl(hidden);
            }
            var AllType     = new string[] { "MainFile", "PdfFile", "PlotFile", "XrefFile", "DwfFile", "TiffFile", "SignPdfFile", "Attachments" };
            var archiveType = System.Configuration.ConfigurationManager.AppSettings["ArchiveType"];
            var ArchiveType = (string.IsNullOrEmpty(archiveType) ? "PdfFile" : archiveType).Split(',').ToList();
            var ShowType    = new List <string>();

            foreach (var type in AllType)
            {
                if (showAttachment && (type == "MainFile" || type == "Attachments" || ArchiveType.Contains(type)))
                {
                    ShowType.Add(type);
                }
                else
                {
                    var hidden = new MiniHidden(type);
                    form.AddControl(hidden);
                }
            }

            var  table     = ControlGenrator.CreateDefaultFormTable();
            bool changeRow = true;

            foreach (var attr in this.S_DOC_FileAttr.Where(d => d.Visible == "True").OrderBy(d => d.AttrSort).ToList())
            {
                if (attr.IsFullRow)
                {
                    var row  = new TableRow();
                    var cell = new TableCell();
                    cell.InnerText = attr.FileAttrName;
                    row.AddControl(cell);
                    var ctrlCell = new TableCell(); ctrlCell.ColSpan = 3;
                    ctrlCell.Style = "padding-right:40px;";
                    var control = attr.GetCtontrol(isUpVersion);
                    ctrlCell.AddControl(control);
                    row.AddControl(ctrlCell);
                    table.AddControl(row); changeRow = true;
                }
                else
                {
                    var cell = new TableCell();
                    cell.InnerText = attr.FileAttrName;
                    var ctrlCell = new TableCell();
                    var control  = attr.GetCtontrol(isUpVersion);
                    ctrlCell.Style = "padding-right:40px;";
                    ctrlCell.AddControl(control);
                    if (changeRow)
                    {
                        var row = new TableRow();
                        row.AddControl(cell); row.AddControl(ctrlCell);
                        table.AddControl(row);
                        changeRow = false;
                    }
                    else
                    {
                        var row = table.Rows.LastOrDefault();
                        row.AddControl(cell); row.AddControl(ctrlCell);
                        changeRow = true;
                    }
                }
            }
            if (showAttachment)
            {
                AddAttachmentsControl(table, ShowType);
            }

            form.AddControl(table);
            return(form);
        }