public Notebook(bool isQwerty) { InitializeComponent(); notepage = new Notepage(isQwerty); indexBeingEdited = -1; //setup note list phrases = new List <String>(); populateList(); //this.Parent = parent; topRowButtons = new ALSButton[6]; topRowButtons[0] = new ALSAlarm(); for (int i = 1; i < topRowButtons.Length; i++) { topRowButtons[i] = new ALSButton(); } topRowButtons[1].Text = "Delete"; topRowButtons[2].Text = "Page\nLeft"; topRowButtons[3].Text = "Page\nRight"; topRowButtons[4].Text = "New\nNote"; topRowButtons[5].Text = "Main\nMenu"; topRowButtons[1].Click += new System.EventHandler(this.edit_Click); topRowButtons[2].Click += new System.EventHandler(this.pageLeft); topRowButtons[3].Click += new System.EventHandler(this.pageRight); topRowButtons[4].Click += new System.EventHandler(this.NewNote_Click); topRowButtons[5].Click += new System.EventHandler(this.btnMainMenu_Click); notepage.getBackBtn().Click += new System.EventHandler(this.Notebook_Show); //notepage.getSaveButton().Click += new EventHandler(this.addToList); // there is no save button... notepage.Back_Click += Notepage_Back_Click; topRowButtons[2].Enabled = false; if (NUM_NOTES > phrases.Count) { topRowButtons[3].Enabled = false; } foreach (ALSButton btn in topRowButtons) { Controls.Add(btn); btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 40F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); } notes = new ALSButton[2, NUM_NOTES]; for (int i = 0; i < notes.GetLength(0); i++) { for (int j = 0; j < notes.GetLength(1); j++) { notes[i, j] = new ALSButton(); Controls.Add(notes[i, j]); } } for (int i = 0; i < notes.GetLength(1); i++) { notes[0, i].Font = new System.Drawing.Font("Microsoft Sans Serif", 40F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); notes[0, i].Click += new EventHandler(this.EditNote); notes[0, i].Name = "btnNotepage" + i; } for (int i = 1; i < notes.GetLength(0); i++) { for (int j = 0; j < notes.GetLength(1); j++) { switch (i) { case 1: notes[i, j].BackgroundImage = Properties.Resources.trashcan; notes[i, j].Name = "btnDel" + j; notes[i, j].Click += new System.EventHandler(this.deleteItem); break; } notes[i, j].BackgroundImageLayout = ImageLayout.Zoom; notes[i, j].Visible = false; } } flipToPage(0); }
ALSButton[] topRowButtons; //[Alarm, Add, Edit, PageLeft, PageRight, Back] #endregion Fields #region Constructors public Notebook(bool isQwerty) { InitializeComponent(); notepage = new Notepage(isQwerty); indexBeingEdited = -1; //setup note list phrases = new List<String>(); populateList(); //this.Parent = parent; topRowButtons = new ALSButton[6]; topRowButtons[0] = new ALSAlarm(); for (int i = 1; i < topRowButtons.Length; i++) topRowButtons[i] = new ALSButton(); topRowButtons[1].Text = "Delete"; topRowButtons[2].Text = "Page\nLeft"; topRowButtons[3].Text = "Page\nRight"; topRowButtons[4].Text = "New\nNote"; topRowButtons[5].Text = "Main\nMenu"; topRowButtons[1].Click += new System.EventHandler(this.edit_Click); topRowButtons[2].Click += new System.EventHandler(this.pageLeft); topRowButtons[3].Click += new System.EventHandler(this.pageRight); topRowButtons[4].Click += new System.EventHandler(this.NewNote_Click); topRowButtons[5].Click += new System.EventHandler(this.btnMainMenu_Click); notepage.getBackBtn().Click += new System.EventHandler(this.Notebook_Show); //notepage.getSaveButton().Click += new EventHandler(this.addToList); // there is no save button... notepage.Back_Click += Notepage_Back_Click; topRowButtons[2].Enabled = false; if (NUM_NOTES > phrases.Count) topRowButtons[3].Enabled = false; foreach (ALSButton btn in topRowButtons) { Controls.Add(btn); btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 40F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); } notes = new ALSButton[2, NUM_NOTES]; for (int i = 0; i < notes.GetLength(0); i++) for (int j = 0; j < notes.GetLength(1); j++) { notes[i, j] = new ALSButton(); Controls.Add(notes[i, j]); } for (int i = 0; i < notes.GetLength(1); i++) { notes[0, i].Font = new System.Drawing.Font("Microsoft Sans Serif", 40F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); notes[0, i].Click += new EventHandler(this.EditNote); notes[0, i].Name = "btnNotepage" + i; } for (int i = 1; i < notes.GetLength(0); i++) for (int j = 0; j < notes.GetLength(1); j++) { switch (i) { case 1: notes[i, j].BackgroundImage = Properties.Resources.trashcan; notes[i, j].Name = "btnDel" + j; notes[i, j].Click += new System.EventHandler(this.deleteItem); break; } notes[i, j].BackgroundImageLayout = ImageLayout.Zoom; notes[i, j].Visible = false; } flipToPage(0); }