Esempio n. 1
0
        /// <summary>
        /// Refresh which tabs are showing
        /// </summary>
        private void RefreshTabs()
        {
            tabcontrl.TabPages.Clear();
            weekctrls.Clear();


            for (int i = 0; i < Settings.Instance.rotaweekcount; i++)
            {
                //create a new work control
                WeekCtrl newone = new WeekCtrl();

                //create a tab page for it
                KRBTabControl.TabPageEx page = new KRBTabControl.TabPageEx("Week " + (i + 1).ToString())
                {
                    IsClosable = false
                };

                //add the new week contrl to the tabpage
                page.Controls.Add(newone);

                //set the week control to be fill docked
                newone.Dock = System.Windows.Forms.DockStyle.Fill;

                //add the tab page to the control
                tabcontrl.TabPages.Add(page);

                //add the week control to our list of em
                weekctrls.Add(newone);
            }

            tabcontrl.TabPages.Add(overviewTabPage);
        }
Esempio n. 2
0
        private void newToolStripButton_Click(object sender, EventArgs e)
        {
            KRBTabControl.TabPageEx newTabPage = new KRBTabControl.TabPageEx();
            newTabPage.ImageIndex = 2;
            krbTabControl1.TabPages.Add(newTabPage);
            Label newLabel = new Label();

            newLabel.Text     = newTabPage.Text;
            newLabel.Font     = new Font("Tahoma", 9.75f, FontStyle.Bold);
            newLabel.Location = new Point(10, 10);
            newTabPage.Controls.Add(newLabel);
        }
Esempio n. 3
0
        private void krbTabControl1_ContextMenuShown(object sender, KRBTabControl.KRBTabControl.ContextMenuShownEventArgs e)
        {
            ToolStripMenuItem menuItem = new ToolStripMenuItem()
            {
                Text = "Another menu item",
                ShortcutKeys = Keys.Control | Keys.N
            };

            menuItem.Click += (thrower, ea) =>
            {
                MessageBox.Show("Hello World!!!");
            };

            e.ContextMenu.Items.Insert(0, new ToolStripSeparator());
            e.ContextMenu.Items.Insert(0, menuItem);

            menuItem = new ToolStripMenuItem()
            {
                Text = "Open a new tab",
                Image = this.ımageList1.Images[2],
                ShortcutKeys = Keys.Control | Keys.O
            };

            menuItem.Click += (thrower, ea) =>
            {
                KRBTabControl.TabPageEx newTabPage = new KRBTabControl.TabPageEx();
                newTabPage.ImageIndex = 2;
                krbTabControl1.TabPages.Add(newTabPage);
                Label newLabel = new Label();
                newLabel.AutoSize = true;
                newLabel.Text = String.Format("I've created by the drop-down menu, {0}", newTabPage.Text);
                newLabel.Font = new Font("Tahoma", 9.75f, FontStyle.Bold);
                newLabel.Location = new Point(10, 10);
                newTabPage.Controls.Add(newLabel);
            };

            e.ContextMenu.Items.Insert(0, new ToolStripSeparator());
            e.ContextMenu.Items.Insert(0, menuItem);
            e.ContextMenu.Items.Add(new ToolStripSeparator());

            menuItem = new ToolStripMenuItem("My Menu Item");
            if (krbTabControl1.SelectedTab != null)
            {
                menuItem.Click += (thrower, ea) =>
                {
                    MessageBox.Show(String.Format("Selected Tab Page: {0}", krbTabControl1.SelectedTab));
                };
            }
            e.ContextMenu.Items.Add(menuItem);
        }
Esempio n. 4
0
        private void krbTabControl1_ContextMenuShown(object sender, KRBTabControl.KRBTabControl.ContextMenuShownEventArgs e)
        {
            ToolStripMenuItem menuItem = new ToolStripMenuItem()
            {
                Text         = "Another menu item",
                ShortcutKeys = Keys.Control | Keys.N
            };

            menuItem.Click += (thrower, ea) =>
            {
                MessageBox.Show("Hello World!!!");
            };

            e.ContextMenu.Items.Insert(0, new ToolStripSeparator());
            e.ContextMenu.Items.Insert(0, menuItem);

            menuItem = new ToolStripMenuItem()
            {
                Text         = "Open a new tab",
                Image        = this.ımageList1.Images[2],
                ShortcutKeys = Keys.Control | Keys.O
            };

            menuItem.Click += (thrower, ea) =>
            {
                KRBTabControl.TabPageEx newTabPage = new KRBTabControl.TabPageEx();
                newTabPage.ImageIndex = 2;
                krbTabControl1.TabPages.Add(newTabPage);
                Label newLabel = new Label();
                newLabel.AutoSize = true;
                newLabel.Text     = String.Format("I've created by the drop-down menu, {0}", newTabPage.Text);
                newLabel.Font     = new Font("Tahoma", 9.75f, FontStyle.Bold);
                newLabel.Location = new Point(10, 10);
                newTabPage.Controls.Add(newLabel);
            };

            e.ContextMenu.Items.Insert(0, new ToolStripSeparator());
            e.ContextMenu.Items.Insert(0, menuItem);
            e.ContextMenu.Items.Add(new ToolStripSeparator());

            menuItem = new ToolStripMenuItem("My Menu Item");
            if (krbTabControl1.SelectedTab != null)
            {
                menuItem.Click += (thrower, ea) =>
                {
                    MessageBox.Show(String.Format("Selected Tab Page: {0}", krbTabControl1.SelectedTab));
                };
            }
            e.ContextMenu.Items.Add(menuItem);
        }
Esempio n. 5
0
        /// <summary>
        /// Refresh the dates in the period selection combo
        /// </summary>
        private void RefreshDateWeekCombo()
        {
            weekSelectionCombo.Items.Clear();

            DateTime currentPeriodStart = DateCalculations.GetStartOfRotaPeriod(DateTime.Now);

            Color pastCol = ColorTranslator.FromHtml("#FFA8A8");
            Color currCol = ColorTranslator.FromHtml("#72FE95");
            Color futrCol = ColorTranslator.FromHtml("#75ECFD");

            int range = Settings.Instance.rotarange;

            DateTime dateFrom = currentPeriodStart.AddDays(-(7 * Settings.Instance.rotaweekcount * range));
            DateTime dateTo   = dateFrom.AddDays((Settings.Instance.rotaweekcount * 7) - 1);

            for (int i = 0; i < (range * 2) + 1; i++)
            {
                Color col = currCol;

                if (i < range)
                {
                    col = pastCol;
                }
                else if (i > range)
                {
                    col = futrCol;
                }

                weekSelectionCombo.Items.Add(new ComboItem()
                {
                    obj = new RotaPeriod()
                    {
                        dateFrom = dateFrom, dateTo = dateTo
                    }, color = col
                });

                dateFrom = dateFrom.AddDays(7 * Settings.Instance.rotaweekcount);
                dateTo   = dateTo.AddDays(7 * Settings.Instance.rotaweekcount);
            }

            //select the current period as being start one
            weekSelectionCombo.SelectedIndex = range;

            //also select current week tab
            int weeksgone = (int)((DateTime.Now - currentPeriodStart).TotalDays / 7);

            KRBTabControl.TabPageEx tab = weekctrls[weeksgone].Parent as KRBTabControl.TabPageEx;
            tabcontrl.SelectedTab = tab;
        }
Esempio n. 6
0
        /// <summary>
        /// Make a specific call visible.
        /// </summary>
        /// <param name="call"></param>
        public void ShowCall(Call call)
        {
            try
            {
                int weeksgone = (int)(call.time - CurrentPeriodDateStart).TotalDays / 7;
                KRBTabControl.TabPageEx tab = weekctrls[weeksgone].Parent as KRBTabControl.TabPageEx;
                tabcontrl.SelectedTab = tab;

                ServiceUserManager.Instance.SelectedServiceUsers.Clear();
                ServiceUserManager.Instance.SelectedServiceUsers.Add(call.ServiceUser);
            }
            catch (Exception ex)
            {
                Cura.Common.Common.LogError(ex);
            }
        }
Esempio n. 7
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     KRBTabControl.TabPageEx newTabPage = new KRBTabControl.TabPageEx();
     newTabPage.ImageIndex = 2;
     krbTabControl1.TabPages.Add(newTabPage);
     Label newLabel = new Label();
     newLabel.Text = newTabPage.Text;
     newLabel.Font = new Font("Tahoma", 9.75f, FontStyle.Bold);
     newLabel.Location = new Point(10, 10);
     newTabPage.Controls.Add(newLabel);
 }
Esempio n. 8
0
        private void NewMap()
        {
            newMap mapDialog = new newMap();
            mapDialog.ShowDialog();
            if (mapDialog.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                _mapDocuments.Add(new MapDocument(mapDialog.MapWidth, mapDialog.MapHeight,
                                        mapDialog.TileWidth, mapDialog.TileHeight));

                button1.Enabled = true;
                saveAsToolStripMenuItem.Enabled = true;
                saveToolStripMenuItem.Enabled = true;
                toolSave.Enabled = true;
                newTileSet.Enabled = true;

                // CREATE THE KRB TAB
                KRBTabControl.TabPageEx newTabPage = new KRBTabControl.TabPageEx();
                newTabPage.Text = "Untitled";
                newTabPage.ImageIndex = 2;
                krbTabControl1.TabPages.Add(newTabPage);

                PictureBox newPictureBox = new PictureBox();
                newPictureBox.Size = new Size(mapDialog.MapWidth * mapDialog.TileWidth, // WIDTH
                                            mapDialog.MapHeight * mapDialog.TileHeight); // HEIGHT
                newPictureBox.Location = new Point(0, 0);
                newPictureBox.BackColor = Color.LightSkyBlue;
                newPictureBox.Name = "pictureBox";
                newPictureBox.Paint += new PaintEventHandler(pictureBox2_Paint);
                newPictureBox.MouseClick += new MouseEventHandler(pictureBox2_MouseClick);

                Label newLabel = new Label();
                newLabel.Text = newTabPage.Text;
                newLabel.Font = new Font("Tahoma", 9.75f, FontStyle.Bold);
                newLabel.Location = new Point(10, 10);

                Panel newPanel = new Panel();
                newPanel.Controls.Add(newPictureBox);
                newPanel.Size = new Size(newTabPage.Size.Width - 20, newTabPage.Size.Height - 20);
                newPanel.Anchor = (AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top);
                newPanel.Location = new Point(10, 10);
                newPanel.AutoScroll = true;
                newPanel.Name = "panel";
                //newTabPage.Controls.Add(newLabel);
                newTabPage.Controls.Add(newPanel);
            }
        }