Ejemplo n.º 1
0
        private static (TableLayoutPanel, ListBox) InitializeMapSelect(TableLayoutPanel menuTable)
        {
            var table = new TableLayoutPanel
            {
                Enabled  = false,
                Location = menuTable.Location,
                Size     = menuTable.Size
            };

            table.RowStyles.Add(new RowStyle(SizeType.Percent, 20));
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 80));
            table.Controls.Add(MyDefaultButton(@"Back", table.Size.Height / 20, () =>
            {
                table.Enabled = false;
                table.Hide();
                menuTable.Enabled = true;
                menuTable.Show();
            }));
            var mapList = new ListBox
            {
                Dock          = DockStyle.Fill,
                DataSource    = Map.AllMaps,
                DisplayMember = "Name"
            };

            table.Controls.Add(mapList);
            table.Hide();
            return(table, mapList);
        }
 public void emptyTable(TableLayoutPanel table)
 {
     table.RowCount = 1;
     table.Hide();
     table.Controls.Clear();
     table.Show();
 }
Ejemplo n.º 3
0
        public VwXls()
        {
            InitializeComponent();

            {
                FlowLayoutPanel flp = flperr = new FlowLayoutPanel();
                flp.Hide();
                flp.Dock = DockStyle.Fill;
                {
                    PictureBox pb = new PictureBox();
                    pb.Image    = Resources.eventlogError.ToBitmap();
                    pb.SizeMode = PictureBoxSizeMode.AutoSize;
                    flp.Controls.Add(pb);
                }
                {
                    Label la = laerr1 = new Label();
                    la.AutoSize = true;
                    flp.Controls.Add(la);
                    flp.SetFlowBreak(la, true);
                }
                {
                    Label la = laerr2 = new Label();
                    la.AutoSize = true;
                    flp.Controls.Add(la);
                }
                flp.Parent = this;
            }

            {
                TableLayoutPanel p = flpwip = new TableLayoutPanel();
                p.Hide();
                p.Dock = DockStyle.Fill;
                p.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
                p.RowStyles.Add(new RowStyle(SizeType.AutoSize));
                {
                    FlowLayoutPanel flp = new FlowLayoutPanel();
                    flp.Anchor       = AnchorStyles.None;
                    flp.AutoSize     = true;
                    flp.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                    flp.BackColor    = Color.WhiteSmoke;
                    flp.ForeColor    = Color.Black;
                    {
                        Label la = lawip = new Label();
                        la.AutoSize = true;
                        flp.Controls.Add(la);
                        flp.SetFlowBreak(la, true);
                    }
                    {
                        ProgressBar pb = new ProgressBar();
                        pb.Style = ProgressBarStyle.Marquee;
                        flp.Controls.Add(pb);
                    }
                    p.Controls.Add(flp);
                    flp.Show();
                }
                p.Parent = this;
            }

            Sync = SynchronizationContext.Current;
        }
Ejemplo n.º 4
0
        private void creat_layout_new()
        {
            try
            {
                tblMain.Visible = false;
                tblMain         = new TableLayoutPanel();
                panel1.Controls.Clear();
                panel1.Controls.Add(tblMain);
                tblMain.Hide();
                tblMain.Controls.Clear();
                tblMain.RowStyles.Clear();
                tblMain.ColumnStyles.Clear();
                tblMain.AutoScroll  = true;
                tblMain.AutoSize    = true;
                tblMain.ColumnCount = 1;

                tblMain.Dock = DockStyle.Fill;
                if (!_mc.Contains("S"))
                {
                    tblMain.RowCount = 3;
                    for (int x = 0; x < 3; x++)
                    {
                        tblMain.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute));
                        if (Convert.ToInt32(_mc) < 4)
                        {
                            UC.UC_Temp_PU_AUTO uc_info = new UC.UC_Temp_PU_AUTO();
                            tblMain.Controls.Add(uc_info, 0, x);
                            uc_info.Dock = DockStyle.Fill;
                            uc_info.Bindingdata(null, x + 1, null, null);
                        }
                        else
                        {
                            UC.UC_Temp_PU_MANUAL uc_info = new UC.UC_Temp_PU_MANUAL();
                            tblMain.Controls.Add(uc_info, 0, x);
                            uc_info.Dock = DockStyle.Fill;
                            uc_info.Bindingdata(null, x + 1, null, null);
                        }
                    }
                }
                else
                {
                    //tblMain.RowCount = 5;
                    //for (int x = 0; x < 5; x++)
                    //{
                    //    tblMain.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute));
                    //    UC.UC_Temp_PU_SPRAY uc_info = new UC.UC_Temp_PU_SPRAY();
                    //    tblMain.Controls.Add(uc_info, 0, x);
                    //    uc_info.Dock = DockStyle.Fill;
                    //    uc_info.Bindingdata(null, x + 1);
                    //}
                }
            }
            catch
            {
            }
            finally
            {
                tblMain.Show();
            }
        }
Ejemplo n.º 5
0
 private void ShowImage(object sender, EventArgs eventArgs)
 {
     tableLayoutPanel.Hide();
     Size = imageConfig.ImageSize;
     tagsCloudProcessor.CreateCloud(wordsConfig.Path, imageConfig.Path);
     using var image    = Image.FromFile(imageConfig.Path);
     using var graphics = CreateGraphics();
     graphics.DrawImage(image, new PointF(0, 0));
 }
Ejemplo n.º 6
0
 private void ShowImage(object sender, EventArgs eventArgs)
 {
     AcceptSettings();
     tableLayoutPanel.Hide();
     backSettingsButton.Show();
     tagsCloudProcessor.CreateCloud(wordsConfig.Path, imageConfig.Path)
     .Then(value => DrawCloud())
     .OnFail(ShowErrorBox);
 }
Ejemplo n.º 7
0
 public static void clearFeePaymentTable(bool reShow)
 {
     tableLayoutPanel1.Hide();
     tableLayoutPanel1.Controls.Clear();
     tableLayoutPanel1.RowStyles.Clear();
     tableLayoutPanel1.RowCount = 3;
     tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
     tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
     tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
     tableLayoutPanel1.Controls.Add(SelectAllCheckBox(), 0, 0);
     tableLayoutPanel1.Controls.Add(newLabel("No", System.Drawing.FontStyle.Bold, ContentAlignment.MiddleCenter), 1, 0);
     tableLayoutPanel1.Controls.Add(newLabel("Items", System.Drawing.FontStyle.Bold, ContentAlignment.MiddleCenter), 2, 0);
     tableLayoutPanel1.Controls.Add(newLabel("Month", System.Drawing.FontStyle.Bold, ContentAlignment.MiddleCenter), 3, 0);
     tableLayoutPanel1.Controls.Add(newLabel("Fee", System.Drawing.FontStyle.Bold, ContentAlignment.MiddleCenter), 4, 0);
     if (reShow)
     {
         tableLayoutPanel1.Show();
     }
 }
        public void Notify(ControllerCommand cmd)
        {
            if (controlledSpellbook != null)
            {
                switch (cmd)
                {
                case ControllerCommand.Spellbook_SelectNext:
                    descriptionList.SelectNext();
                    break;

                case ControllerCommand.Spellbook_SelectPrevious:
                    descriptionList.SelectPrevious();
                    break;

                case ControllerCommand.Spellbook_SelectNextPage:
                    descriptionList.SelectNextPage();
                    break;

                case ControllerCommand.Spellbook_SelectPreviousPage:
                    descriptionList.SelectPreviousPage();
                    break;

                case ControllerCommand.Spellbook_Close:
                    ValidIndex = false;
                    this.Hide();
                    gamePanel.Show();
                    FocusOnMap();
                    Opened = false;
                    break;

                case ControllerCommand.Spellbook_Pick:
                    ValidIndex = true;
                    this.Hide();
                    FocusOnMap();
                    Opened = false;
                    break;

                case ControllerCommand.Spellbook_Open:
                    Opened = true;
                    gamePanel.Hide();
                    this.Show();
                    descriptionList.Items = controlledSpellbook.ToList();
                    this.Refresh();
                    this.Focus();
                    break;
                }
            }

            descriptionList.Refresh();
        }
        public static void updateCoursesTable(bool forceUpdate)
        {
            if (!forceUpdate && initialized == false)
            {
                return;
            }
            tableLayoutPanel1.Hide();
            resetCoursesTable();
            tableLayoutPanel1.Controls.Add(newLabel("Course", System.Drawing.FontStyle.Bold, ContentAlignment.MiddleCenter), 0, 0);
            tableLayoutPanel1.Controls.Add(newLabel("Tutor Name", System.Drawing.FontStyle.Bold, ContentAlignment.MiddleCenter), 1, 0);
            tableLayoutPanel1.Controls.Add(newLabel("Fees", System.Drawing.FontStyle.Bold, ContentAlignment.MiddleCenter), 2, 0);
            tableLayoutPanel1.Controls.Add(newLabel("Enrollable", System.Drawing.FontStyle.Bold, ContentAlignment.MiddleCenter), 3, 0);
            Course.loadCourses();
            int rows = Course.courses().Count;

            tableLayoutPanel1.RowCount = rows + 2;
            int i = 1;

            foreach (var course in Course.courses())
            {
                tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
                tableLayoutPanel1.Controls.Add(newLabel(course.getCourseName(), System.Drawing.FontStyle.Regular, ContentAlignment.MiddleLeft), 0, i);
                string tutorName = course.getTutorName();
                if (tutorName == null)
                {
                    tutorName = "Invalid";
                }
                tableLayoutPanel1.Controls.Add(newLabel(tutorName, System.Drawing.FontStyle.Regular, ContentAlignment.MiddleCenter), 1, i);
                tableLayoutPanel1.Controls.Add(newLabel(course.getFee().ToString(), System.Drawing.FontStyle.Regular, ContentAlignment.MiddleCenter), 2, i);
                if (course.isEnrollable())
                {
                    tableLayoutPanel1.Controls.Add(newLinkLabel(course.getEnrollableStatus(), course.getCourseId()), 3, i);
                }
                else
                {
                    tableLayoutPanel1.Controls.Add(new Label()
                    {
                        Text = course.getEnrollableStatus(), Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), ForeColor = System.Drawing.Color.Red, TextAlign = ContentAlignment.MiddleCenter, Dock = System.Windows.Forms.DockStyle.Fill
                    }, 3, i);
                }
                i++;
            }
            tableLayoutPanel1.Show();
        }
        public static void updateStudentProfileTable(bool forceUpdate)
        {
            if (!forceUpdate && initialized == false)
            {
                return;
            }
            if (selectedTutor == null || selectedCourse == null)
            {
                return;
            }
            tableLayoutPanelStudents.Hide();
            clearStudentProfileTable();
            List <Profile> profiles = selectedTutor.getStudentProfile(selectedCourse.getCourseId());

            if (profiles == null || profiles.Count == 0)
            {
                tableLayoutPanelStudents.Show();
                return;
            }
            profiles.Sort((x, y) => string.Compare(x.getStudentName(), y.getStudentName()));
            int rows = profiles.Count;

            tableLayoutPanelStudents.RowCount = rows + 2;
            int i = 1;

            Course.loadCourses();
            foreach (Profile profile in profiles)
            {
                tableLayoutPanelStudents.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
                tableLayoutPanelStudents.Controls.Add(newLabel(i.ToString() + ".", System.Drawing.FontStyle.Regular, ContentAlignment.MiddleLeft), 0, i);
                string name = profile.getStudentName();
                if (name == null || name == "")
                {
                    name = "Invalid Name";
                }
                tableLayoutPanelStudents.Controls.Add(newLabel(name, System.Drawing.FontStyle.Regular, ContentAlignment.MiddleCenter), 1, i);
                tableLayoutPanelStudents.Controls.Add(newLabel(profile.getEnrollDate().Date.ToString("dd/MM/yyyy"), System.Drawing.FontStyle.Regular, ContentAlignment.MiddleCenter), 2, i);
                tableLayoutPanelStudents.Controls.Add(newLinkLabel("View Profile", profile.getStudentId()), 3, i);
                i++;
            }
            tableLayoutPanelStudents.Show();
        }
        public static void updateTimetable(bool forceUpdate)
        {
            if (!forceUpdate && initialized == false)
            {
                return;
            }
            if (selectedTutor == null)
            {
                return;
            }
            tableLayoutPanelSchedule.Hide();
            List <Timetable> timetables = selectedTutor.getTimetables();

            if (timetables == null || timetables.Count == 0)
            {
                tableLayoutPanelSchedule.Show();
                return;
            }
            int rows = timetables.Count;

            tableLayoutPanelSchedule.RowCount = rows + 2;
            int i = 1;

            Course.loadCourses();
            foreach (var timetable in timetables)
            {
                Course course = Course.getCourseById(timetable.getCourseId());
                if (course == null)
                {
                    continue;
                }
                tableLayoutPanelSchedule.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
                tableLayoutPanelSchedule.Controls.Add(newLabel(course.getCourseName(), System.Drawing.FontStyle.Regular, ContentAlignment.MiddleLeft), 0, i);
                tableLayoutPanelSchedule.Controls.Add(newLabel(timetable.Date.Date.ToString("dd MMM yyyy"), System.Drawing.FontStyle.Regular, ContentAlignment.MiddleCenter), 1, i);
                tableLayoutPanelSchedule.Controls.Add(newLabel(timetable.StartTime.ToString("hh:mm tt") + " - " + timetable.EndTime.ToString("hh:mm tt"), System.Drawing.FontStyle.Regular, ContentAlignment.MiddleCenter), 2, i);
                i++;
            }
            tableLayoutPanelSchedule.Show();
        }
Ejemplo n.º 12
0
        private void Form1_Load(object sender, EventArgs e)
        {
            #region Objects

            TableLayoutPanel mainScreen       = new TableLayoutPanel();
            TableLayoutPanel joinScreen       = new TableLayoutPanel();
            Panel            titleScreenInner = new Panel();
            Panel            gameScreenInner  = new Panel();
            Panel            hostScreenInner  = new Panel();


            Button startButton = new_Button("Start", new Point(0, 0));
            Button quitButton  = new_Button("Quit", new Point(0, 0));

            Button hostButton     = new_Button("Host game ", new Point(0, 0));
            Button joinButton     = new_Button("Join to a game ", new Point(0, 80));
            Button backToTSButton = new_Button("Back", new Point(0, 160));

            Button host7x7Game    = new_Button("7x7 game", new Point(0, 0));
            Button host9x9Game    = new_Button("9x9 game", new Point(0, 80));
            Button backToGSButton = new_Button("Back", new Point(0, 160));


            PictureBox logoPictureBox = new_PictureBox("../../", "logo.png");

            this.SuspendLayout();
            mainScreen.SuspendLayout();
            joinScreen.SuspendLayout();
            titleScreenInner.SuspendLayout();
            gameScreenInner.SuspendLayout();
            logoPictureBox.SuspendLayout();
            hostScreenInner.SuspendLayout();

            //make panels fill their parents
            mainScreen.Dock       = DockStyle.Fill;
            joinScreen.Dock       = DockStyle.Fill;
            titleScreenInner.Dock = DockStyle.Fill;
            gameScreenInner.Dock  = DockStyle.Fill;
            logoPictureBox.Dock   = DockStyle.Fill;
            hostScreenInner.Dock  = DockStyle.Fill;

            //Testing purposes
            TestForm testForm = new TestForm();
            //

            //Temporary Controls for Loacal
            NumericUpDown numofplayersCBox = new NumericUpDown();
            numofplayersCBox.Size     = new Size(50, 20);
            numofplayersCBox.Location = new Point(1100, 70);
            numofplayersCBox.Minimum  = 2;
            numofplayersCBox.Maximum  = 4;

            Button button1 = new Button();
            button1.Size     = new Size(50, 50);
            button1.Location = new Point(1100, 100);
            button1.Text     = "No. Players";

            testForm.Show();

            testForm.Controls.Add(button1);

            testForm.Controls.Add(numofplayersCBox);
            //
            #endregion

            //add rows and columns to tableLayoutPanel
            mainScreen.ColumnCount = 3;
            mainScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
            mainScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 300f));
            mainScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
            mainScreen.RowCount = 3;
            mainScreen.RowStyles.Add(new RowStyle(SizeType.Percent, 50f));
            mainScreen.RowStyles.Add(new RowStyle(SizeType.Absolute, 200f));
            mainScreen.RowStyles.Add(new RowStyle(SizeType.Percent, 50f));

            #region add objects to their screen
            //title screen
            titleScreenInner.Controls.Add(startButton);

            //before lobby screen

            gameScreenInner.Controls.Add(hostButton);
            gameScreenInner.Controls.Add(joinButton);

            //host screen

            hostScreenInner.Controls.Add(host7x7Game);
            hostScreenInner.Controls.Add(host9x9Game);
            #endregion

            //construct title screen
            this.ResumeLayout(false);
            mainScreen.ResumeLayout(false);
            titleScreenInner.ResumeLayout(false);
            mainScreen.Controls.Add(titleScreenInner, 1, 1);
            mainScreen.Controls.Add(quitButton, 1, 2);
            mainScreen.Controls.Add(logoPictureBox, 1, 0);
            this.Controls.Add(mainScreen);
            this.BackColor = Color.SandyBrown;


            //events

            startButton.Click += (s, ev) =>
            {
                gameScreenInner.ResumeLayout(false);
                mainScreen.Controls.Remove(titleScreenInner);
                mainScreen.Controls.Remove(quitButton);
                mainScreen.Controls.Add(gameScreenInner, 1, 1);
                mainScreen.Controls.Add(backToTSButton, 1, 2);
            };

            hostButton.Click += (s, ev) =>
            {
                hostScreenInner.ResumeLayout(false);
                mainScreen.Controls.Remove(gameScreenInner);
                mainScreen.Controls.Remove(backToTSButton);
                mainScreen.Controls.Add(hostScreenInner, 1, 1);
                mainScreen.Controls.Add(backToGSButton, 1, 2);
            };

            host7x7Game.Click += (s, ev) =>
            {
                BoardHandler.Board board = new BoardHandler.Board(7);

                button1.Enabled          = true;
                numofplayersCBox.Enabled = true;

                button1.Click += (s1, ev1) =>
                {
                    board.FillBoardWithTile();

                    board.AddPlayersToBoard((int)numofplayersCBox.Value);
                    board.PlaceGameControls(testForm);
                    board.PlaceTiles(testForm);

                    button1.Enabled          = false;
                    numofplayersCBox.Enabled = false;
                };
            };

            host9x9Game.Click += (s, ev) =>
            {
                BoardHandler.Board board = new BoardHandler.Board(9);

                button1.Enabled          = true;
                numofplayersCBox.Enabled = true;

                button1.Click += (s1, ev1) =>
                {
                    board.AddPlayersToBoard((int)numofplayersCBox.Value);

                    board.FillBoardWithTile();
                    board.PlaceGameControls(testForm);
                    board.PlaceTiles(testForm);

                    button1.Enabled          = false;
                    numofplayersCBox.Enabled = false;
                };
            };

            backToGSButton.Click += (s, ev) =>
            {
                mainScreen.Controls.Remove(hostScreenInner);
                mainScreen.Controls.Remove(backToGSButton);
                mainScreen.Controls.Add(gameScreenInner, 1, 1);
                mainScreen.Controls.Add(backToTSButton, 1, 2);
            };

            joinButton.Click += (s, ev) =>
            {
                //initalize row(s) for tableLayoutPanel

                if (GameHandler.playerIPs.Count != 0)
                {
                    mainScreen.Hide();

                    joinScreen.ColumnCount = 5;
                    joinScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 25f));
                    joinScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25f));
                    joinScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 300f));
                    joinScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 75f));
                    joinScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 25f));

                    joinScreen.RowCount = GameHandler.playerIPs.Count + 3;
                    joinScreen.RowStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
                    for (int i = 1; i < GameHandler.playerIPs.Count + 1; i++)
                    {
                        new_Label("label_Game" + i, GameHandler.playerIPs[i].ToString(), new Point(0, i * 80));
                    }
                    joinScreen.RowStyles.Add(new ColumnStyle(SizeType.Absolute, 150f));
                    joinScreen.RowStyles.Add(new ColumnStyle(SizeType.Percent, 50f));
                }
                else
                {
                    MessageBox.Show("Jelenleg egy host sincsen");
                }
            };

            backToTSButton.Click += (s, ev) =>
            {
                mainScreen.Controls.Remove(gameScreenInner);
                mainScreen.Controls.Remove(backToTSButton);
                mainScreen.Controls.Add(titleScreenInner, 1, 1);
                mainScreen.Controls.Add(quitButton, 1, 2);
            };

            quitButton.Click += (s, ev) => {
                this.Close();
            };
        }
Ejemplo n.º 13
0
        private void QChosen(object e, EventArgs args)
        {
            viewPanel.Hide();
            JeoButton btn = (JeoButton)e;

            btn.Text     = "";
            btn.Click   -= QChosen;
            btn.Answered = true;
            currentQ     = btn.Question;

            if (currentQ.Type == QType.Standard)
            {
                Form view = new Form();
                view.FormBorderStyle = FormBorderStyle.None;
                view.BackColor       = Color.LightGray;
                view.Size            = new Size(Screen.PrimaryScreen.WorkingArea.Width, (70 * 3));
                TableLayoutPanel parent = new TableLayoutPanel();
                parent.Dock        = DockStyle.Fill;
                parent.RowCount    = 3;
                parent.ColumnCount = 2;
                parent.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 140F));
                parent.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
                parent.RowStyles.Add(new RowStyle(SizeType.Absolute, 70));
                parent.RowStyles.Add(new RowStyle(SizeType.Absolute, 70));
                parent.RowStyles.Add(new RowStyle(SizeType.Absolute, 70));

                //create and add category heading button
                Button cat = new Button();
                FormatButton(ref cat);
                cat.Text = btn.Question.Category;
                parent.Controls.Add(cat);
                parent.SetColumnSpan(cat, 2);

                //create and add value display button
                Button val = new Button();
                FormatButton(ref val);
                val.Text = "$" + btn.Question.Value;
                parent.Controls.Add(val);

                //create and add clue display button. Set font to be smaller than default formatting
                Button clu = new Button();
                FormatButton(ref clu);
                clu.Font = new Font("Arial", 15, FontStyle.Bold);
                clu.Text = btn.Question.Clue;
                parent.Controls.Add(clu);

                //create and add submit button
                Button sub = new Button();
                FormatButton(ref sub);
                sub.Text   = "Submit";
                sub.Click += new EventHandler(QSubmited);
                parent.Controls.Add(sub);
                view.AcceptButton = sub;

                //create and add input text field
                input           = new TextBox();
                input.ForeColor = Color.Blue;
                input.BackColor = Color.Yellow;
                input.Font      = new Font("Arial", 20, FontStyle.Bold);
                input.Multiline = true;
                input.Dock      = DockStyle.Fill;
                input.TextAlign = HorizontalAlignment.Center;
                parent.Controls.Add(input);

                view.Controls.Add(parent);
                view.ActiveControl = input;
                view.ShowDialog();
            }
            else if (currentQ.Type == QType.Double)
            {
                Form view = new Form();
                view.Size            = new Size(Screen.PrimaryScreen.WorkingArea.Width, (70 * 4));
                view.BackColor       = Color.LightGray;
                view.FormBorderStyle = FormBorderStyle.None;
                TableLayoutPanel parent = new TableLayoutPanel();
                parent.Dock        = DockStyle.Fill;
                parent.RowCount    = 4;
                parent.ColumnCount = 2;
                parent.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 240F));
                parent.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
                parent.RowStyles.Add(new RowStyle(SizeType.Absolute, 70));
                parent.RowStyles.Add(new RowStyle(SizeType.Absolute, 70));
                parent.RowStyles.Add(new RowStyle(SizeType.Absolute, 70));
                parent.RowStyles.Add(new RowStyle(SizeType.Absolute, 70));

                //create and add category heading button
                Button cat = new Button();
                FormatButton(ref cat);
                cat.Text = btn.Question.Category;
                parent.Controls.Add(cat);
                parent.SetColumnSpan(cat, 2);

                //create and add value display button
                Button val = new Button();
                FormatButton(ref val);
                val.Text = "Daily Double!";
                parent.Controls.Add(val);

                //create and add clue display button. Set font to be smaller than default formatting
                Button clu = new Button();
                FormatButton(ref clu);
                clu.Font = new Font("Arial", 15, FontStyle.Bold);
                clu.Text = btn.Question.Clue;
                parent.Controls.Add(clu);

                //create and add bid button
                Button bidLabel = new Button();
                FormatButton(ref bidLabel);
                bidLabel.Font = new Font("Arial", 15, FontStyle.Bold);
                if (currentQ.Round == RoundType.First)
                {
                    ddMinMax = 1000;
                }
                if (currentQ.Round == RoundType.Second)
                {
                    ddMinMax = 2000;
                }
                bidLabel.Text = "Your Bid (Maximum $" + Math.Max(ddMinMax, game.Cash) + ")";
                parent.Controls.Add(bidLabel);

                //create and add bid text field
                bid           = new TextBox();
                bid.ForeColor = Color.Blue;
                bid.BackColor = Color.Yellow;
                bid.Font      = new Font("Arial", 20, FontStyle.Bold);
                bid.Multiline = true;
                bid.Dock      = DockStyle.Fill;
                bid.TextAlign = HorizontalAlignment.Center;
                parent.Controls.Add(bid);

                //create and add submit button
                Button sub = new Button();
                FormatButton(ref sub);
                sub.Text   = "Submit";
                sub.Click += new EventHandler(QSubmited);
                parent.Controls.Add(sub);
                view.AcceptButton = sub;

                //create and add input text field
                input           = new TextBox();
                input.ForeColor = Color.Blue;
                input.BackColor = Color.Yellow;
                input.Font      = new Font("Arial", 20, FontStyle.Bold);
                input.Multiline = true;
                input.Dock      = DockStyle.Fill;
                input.TextAlign = HorizontalAlignment.Center;
                parent.Controls.Add(input);

                view.Controls.Add(parent);
                view.ActiveControl = bid;
                view.ShowDialog();
            }
        }
Ejemplo n.º 14
0
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------

        public DialogEvent(SystemEvent ev)
        {
            InitializeComponent();

            Control = new DialogEventControl(ev.CreateCopy());
            ViewModelBindingSource.DataSource = Control;

            // Timers
            GraphicFrameTimer.Interval = 150;
            GraphicFrameTimer.Start();
            CommandUnderscoreTimer.Interval = 250;

            // Radios trigger
            RadiosTrigger[EventTrigger.ActionButton]    = radioButtonActionButton;
            RadiosTrigger[EventTrigger.PlayerTouch]     = radioButtonPlayerTouch;
            RadiosTrigger[EventTrigger.EventTouch]      = radioButtonEventTouch;
            RadiosTrigger[EventTrigger.Detection]       = radioButtonDetection;
            RadiosTrigger[EventTrigger.Autorun]         = radioButtonAutorun;
            RadiosTrigger[EventTrigger.ParallelProcess] = radioButtonParallelProcess;

            // Update pages
            UpdatePage(0);
            for (int i = 0; i < Control.Model.Pages.Count - 1; i++)
            {
                TabPage tabPage = new TabPage((i + 2).ToString());
                tabPage.Margin    = new Padding(3);
                tabPage.Padding   = new Padding(3);
                tabPage.BackColor = Color.White;
                tabControl1.TabPages.Add(tabPage);
            }
            buttonDeletePage.Enabled = tabControl1.TabPages.Count > 1;


            // Speed & frequency
            numericUpDownSpeed.DecimalPlaces     = 2;
            numericUpDownSpeed.Minimum           = (decimal)0.1;
            numericUpDownSpeed.Maximum           = (decimal)999.0;
            numericUpDownSpeed.Increment         = (decimal)0.5;
            numericUpDownSpeed.Value             = (decimal)1.0;
            numericUpDownFrequency.DecimalPlaces = 2;
            numericUpDownFrequency.Minimum       = (decimal)0.1;
            numericUpDownFrequency.Maximum       = (decimal)999.0;
            numericUpDownFrequency.Increment     = (decimal)0.5;
            numericUpDownFrequency.Value         = (decimal)1.0;

            // CommandsView
            CommandsView.ExpandAll();
            TableLayoutListCommandsPanel.AutoSize = true;
            TableLayoutListCommandsPanel.Hide();
            CommandsView.Controls.Add(TableLayoutListCommandsPanel);

            // Event name
            textBoxEventName.Select();
            textBoxEventName.Focus();

            // Events
            graphicControl1.ClosingDialogEvent += graphicControl1_ClosingDialogEvent;
            GraphicFrameTimer.Elapsed          += graphicFrameTimer_Elapsed;
            graphicControl1.GetComboBox().SelectedIndexChanged += DialogEvent_SelectedIndexChanged;
            CommandsView.LostFocus                 += CommandsView_LostFocus;
            CommandUnderscoreTimer.Tick            += CommandUnderscoreTimer_Tick;
            TableLayoutListCommandsPanel.CellPaint += TableLayoutListCommandsPanel_CellPaint;

            // Trigger
            foreach (EventTrigger trigger in Enum.GetValues(typeof(EventTrigger)))
            {
                RadiosTrigger[trigger].GroupName = "trigger";
                RadiosTrigger[trigger].AutoCheck = false;
                RadiosTrigger[trigger].Click    += radioTrigger_Clicked;
            }

            InitializeDataBindings();
        }
Ejemplo n.º 15
0
        public void Notify(ControllerCommand cmd)
        {
            var tryedExchange = false;

            if (ControlledBackpack[SelectedListIndex] != null)
            {
                switch (cmd)
                {
                case ControllerCommand.Merchant_SelectNext:
                    descriptionList[SelectedListIndex].SelectNext();
                    break;

                case ControllerCommand.Merchant_SelectPrevious:
                    descriptionList[SelectedListIndex].SelectPrevious();
                    break;

                case ControllerCommand.Merchant_SelectNextPage:
                    descriptionList[SelectedListIndex].SelectNextPage();
                    break;

                case ControllerCommand.Merchant_SelectPreviousPage:
                    descriptionList[SelectedListIndex].SelectPreviousPage();
                    break;

                case ControllerCommand.Merchant_SelectPreviousList:
                    descriptionList[SelectedListIndex].HideSelection();
                    SelectedListIndex = SelectedListIndex - 1;
                    descriptionList[SelectedListIndex].ShowSelection();
                    this.Refresh();
                    break;

                case ControllerCommand.Merchant_SelectNextList:
                    descriptionList[SelectedListIndex].HideSelection();
                    SelectedListIndex = SelectedListIndex + 1;
                    descriptionList[SelectedListIndex].ShowSelection();
                    this.Refresh();
                    break;

                case ControllerCommand.Merchant_Close:
                    ValidIndex = false;
                    this.Hide();
                    gamePanel.Show();
                    FocusOnMap();
                    Opened = false;
                    controlledMerchant.FarewellMessage();
                    break;

                case ControllerCommand.Merchant_PurchaseSell:
                    if (SelectedIndex != -1)
                    {
                        var locIx = SelectedIndex;
                        var item  = ControlledBackpack[SelectedListIndex][locIx];

                        if (SelectedListIndex == 0)     // Merchant buy from Pg
                        {
                            if (controlledMerchant.Purchase(item, controlledPg))
                            {
                                controlledMerchant.GoodPurchaseSpeech();
                                controlledMerchant.SaysWhatPurchased(controlledPg);
                            }
                            else
                            {
                                controlledMerchant.BadPurchaseSpeech();
                            }
                        }
                        else     // Merchant sell to Pg
                        {
                            if (controlledMerchant.Sell(item, controlledPg))
                            {
                                Notify(ControllerCommand.Merchant_SelectPrevious);
                                controlledMerchant.GoodSellSpeech();
                                controlledMerchant.SaysWhatSold(controlledPg);
                            }
                            else
                            {
                                controlledMerchant.BadSellSpeech();
                            }
                        }

                        tryedExchange = true;

                        var b = controlledBackpack[selectedListIndex];
                        var c = b.Count;
                        locIx = c == 0 ? -1 : Math.Min(locIx, c);

                        descriptionList[SelectedListIndex].SelectNext(locIx);
                    }
                    break;

                case ControllerCommand.Merchant_Open:
                    Opened = true;
                    gamePanel.Hide();
                    SelectedListIndex = 0;
                    this.Show();
                    for (int i = 0; i < controlledBackpack.Length; i++)
                    {
                        if (i == 0)
                        {
                            descriptionList[i].ShowSelection();
                        }
                        else
                        {
                            descriptionList[i].HideSelection();
                        }
                        descriptionList[i].Items = controlledBackpack[i].ToList();
                    }
                    this.Refresh();
                    this.Focus();
                    controlledMerchant.GreetingsMessage();
                    break;
                }
            }

            if (!tryedExchange)
            {
                var ix = descriptionList[SelectedListIndex].SelectedIndex;
                if (ix != -1)
                {
                    if (SelectedListIndex == 0)
                    {
                        controlledMerchant.ProposePurchase(controlledBackpack[SelectedListIndex][ix]);
                    }
                    else
                    {
                        controlledMerchant.ProposeSell(controlledBackpack[SelectedListIndex][ix]);
                    }
                }
                else
                {
                    controlledMerchant.NoProposal();
                }
            }

            tryedExchange = false;
            descriptionList[SelectedListIndex].Refresh();
        }
Ejemplo n.º 16
0
        public void Notify(ControllerCommand cmd)
        {
            RapidOperation = RapidOperation.None;

            if (controlledBackpack != null)
            {
                switch (cmd)
                {
                case ControllerCommand.Backpack_SelectNext:
                    descriptionList.SelectNext();
                    break;

                case ControllerCommand.Backpack_SelectPrevious:
                    descriptionList.SelectPrevious();
                    break;

                case ControllerCommand.Backpack_SelectNextPage:
                    descriptionList.SelectNextPage();
                    break;

                case ControllerCommand.Backpack_SelectPreviousPage:
                    descriptionList.SelectPreviousPage();
                    break;

                case ControllerCommand.Backpack_Close:
                    ValidIndex = false;
                    this.Hide();
                    gamePanel.Show();
                    FocusOnMap();
                    Opened = false;
                    break;

                case ControllerCommand.Backpack_Pick:
                    ValidIndex = true;
                    this.Hide();
                    FocusOnMap();
                    Opened = false;
                    break;

                case ControllerCommand.Backpack_Open:
                    Opened = true;
                    gamePanel.Hide();
                    this.Show();
                    descriptionList.Items = controlledBackpack.ToList();
                    this.Refresh();
                    this.Focus();
                    break;

                case ControllerCommand.Backpack_PutOnArmor:
                    RapidOperation = RapidOperation.PutOn;
                    ValidIndex     = true;
                    this.Hide();
                    FocusOnMap();
                    Opened = false;
                    break;

                case ControllerCommand.Backpack_EmbraceShield:
                    RapidOperation = RapidOperation.Embrace;
                    ValidIndex     = true;
                    this.Hide();
                    FocusOnMap();
                    Opened = false;
                    break;

                case ControllerCommand.Backpack_UseItem:
                    RapidOperation = RapidOperation.Use;
                    ValidIndex     = true;
                    this.Hide();
                    FocusOnMap();
                    Opened = false;
                    break;

                case ControllerCommand.Backpack_HandleWeapon:
                    RapidOperation = RapidOperation.Handle;
                    ValidIndex     = true;
                    this.Hide();
                    FocusOnMap();
                    Opened = false;
                    break;
                }
            }

            descriptionList.Refresh();
        }