Ejemplo n.º 1
0
        public override void Start(IPracticeWindow owner)
        {
            base.Start(owner);

            swap    = false;
            nav     = new Navigator(owner);
            navMenu = new NavigatorMenu(nav, true);

            MergeMenu(navMenu.Menu);

            phraseLabel                = new Label();
            translationLabel           = new Label();
            translationLabel.ForeColor = System.Drawing.SystemColors.GrayText;

            bigFont   = new System.Drawing.Font(GameArea.FindForm().Font.FontFamily, 24);
            smallFont = new System.Drawing.Font(GameArea.FindForm().Font.FontFamily, 16);

            foreach (var l in new[] { phraseLabel, translationLabel })
            {
                l.AutoSize  = true;
                l.Font      = bigFont;
                l.BackColor = Color.Transparent;
                GameArea.Controls.Add(l);
            }

            GameArea.Resize         += new EventHandler(GameArea_Resize);
            GameArea.PreviewKeyDown += new PreviewKeyDownEventHandler(GameArea_PreviewKeyDown);

            foreach (Control c in new Control[] { phraseLabel, translationLabel, GameArea })
            {
                c.MouseUp += new MouseEventHandler(GameArea_MouseUp);
            }

            navMenu.Back    += delegate { GoBack(); };
            navMenu.Forward += delegate { GoForward(); };
            navMenu.End     += delegate { GoToEnd(); };
            navMenu.Edit    += delegate {
                var newItem = Dialogs.EditPracticeItem.Show(nav.CurrentItem);
                if (newItem != null)
                {
                    nav.UpdateCurrentItem(newItem);
                }
                Update();
                Layout();
            };
            navMenu.Swap += delegate { SwapItems(); };

            translationLabel.Visible = false;
            Update();
            Layout();
        }
Ejemplo n.º 2
0
        public override void Start(IPracticeWindow owner)
        {
            base.Start(owner);

            GameArea.Resize += OnGameAreaResize;

            // State
            rounds = new List <IList <Attempt> >();
            StartRound();

            // UI
            var form       = GameArea.FindForm();
            var formFont   = form != null ? form.Font : SystemFonts.DefaultFont;
            var fontFamily = formFont.FontFamily;

            font           = new Font(fontFamily, 24);
            smallFont      = new Font(fontFamily, 16);
            extraSmallFont = new Font(fontFamily, 12);
            scoreFont      = new Font(fontFamily, 16);

            phrase = new Label {
                AutoSize = true, BackColor = Color.Transparent, Font = font
            };
            answer = new Label {
                AutoSize = true, BackColor = Color.Transparent, Font = font
            };
            scoreLabel = new Label {
                AutoSize = true, BackColor = Color.Transparent, Font = scoreFont, Dock = DockStyle.Bottom, TextAlign = ContentAlignment.BottomRight
            };
            history = new Label {
                AutoSize = true, BackColor = Color.Transparent, Font = extraSmallFont, Dock = DockStyle.Top, TextAlign = ContentAlignment.MiddleLeft
            };
            translation = new TextBox {
                Font = font
            };
            affirmation = new TextBox {
                Font = font
            };
            overrideButton = new Button {
                Font = formFont, Text = Resources.LearnMode.OverrideButton
            };
            editButton = new Button {
                Font = formFont, Text = Resources.LearnMode.EditButton
            };
            viewButton = new Button {
                Font = formFont, Text = Resources.LearnMode.ViewInListButton
            };
            deleteButton = new Button {
                Font = formFont, Text = Resources.LearnMode.DeleteButton
            };
            roundOverview = new RoundOverview {
                Dock = DockStyle.Fill
            };
            gameOverview = new GameOverview(this)
            {
                Dock = DockStyle.Fill
            };

            GameArea.Controls.Add(phrase);
            GameArea.Controls.Add(scoreLabel);
            GameArea.Controls.Add(answer);
            GameArea.Controls.Add(history);
            GameArea.Controls.Add(translation);
            GameArea.Controls.Add(affirmation);
            GameArea.Controls.Add(overrideButton);
            GameArea.Controls.Add(editButton);
            GameArea.Controls.Add(viewButton);
            GameArea.Controls.Add(deleteButton);
            GameArea.Controls.Add(roundOverview);
            GameArea.Controls.Add(gameOverview);

            translation.TextChanged += delegate { Layout(); };
            translation.KeyUp       += TranslationKeyUp;
            affirmation.TextChanged += AffirmationTextChanged;
            overrideButton.Click    += delegate { Override(items[index], lastGuess); };
            editButton.Click        += EditButtonClick;
            viewButton.Click        += ViewButtonClick;
            deleteButton.Click      += DeleteButtonClick;
            roundOverview.KeyUp     += RoundOverviewKeyUp;

            // Stop the beep sound being produced when Enter is pressed.
            // (Handling KeyUp is not sufficient to stop this.)
            translation.KeyPress += (s, e) => {
                if (e.KeyChar == '\r')
                {
                    e.Handled = true;
                }
            };

            MergeMenu(new OptionsMenu(this));

            Update();
            Layout();
        }
Ejemplo n.º 3
0
		public virtual void Start(IPracticeWindow owner) {
			Owner = owner;
		}
Ejemplo n.º 4
0
		public override void Start(IPracticeWindow owner) {
			base.Start(owner);

			swap = false;
			nav = new Navigator(owner);
			navMenu = new NavigatorMenu(nav, true);

			MergeMenu(navMenu.Menu);

			phraseLabel = new Label();
			translationLabel = new Label();
			translationLabel.ForeColor = System.Drawing.SystemColors.GrayText;

			bigFont = new System.Drawing.Font(GameArea.FindForm().Font.FontFamily, 24);
			smallFont = new System.Drawing.Font(GameArea.FindForm().Font.FontFamily, 16);

			foreach (var l in new[] { phraseLabel, translationLabel }) {
				l.AutoSize = true;
				l.Font = bigFont;
				l.BackColor = Color.Transparent;
				GameArea.Controls.Add(l);
			}

			GameArea.Resize += GameArea_Resize;
			GameArea.PreviewKeyDown += GameArea_PreviewKeyDown;

			foreach (Control c in new Control[] { phraseLabel, translationLabel, GameArea }) {
				c.MouseUp += GameArea_MouseUp;
			}

			navMenu.Back += delegate { GoBack(); };
			navMenu.Forward += delegate { GoForward(); };
			navMenu.End += delegate { GoToEnd(); };
			navMenu.Edit += delegate {
				var newItem = Dialogs.EditPracticeItem.Show(nav.CurrentItem);
				if (newItem != null)
					nav.UpdateCurrentItem(newItem);
				Update();
				Layout();
			};
			navMenu.Swap += delegate { SwapItems(); };

			translationLabel.Visible = false;
			Update();
			Layout();
		}
Ejemplo n.º 5
0
		public Navigator(IPracticeWindow source) {
			Source = source;

			CurrentItem = source.FetchNextItem();
		}
Ejemplo n.º 6
0
		public override void Start(IPracticeWindow owner) {
			base.Start(owner);
		}
Ejemplo n.º 7
0
		public override void Start(IPracticeWindow owner) {
			base.Start(owner);

			GameArea.Resize += OnGameAreaResize;

			// State
			rounds = new List<IList<Attempt>>();
			StartRound();

			// UI
			var form = GameArea.FindForm();
			var formFont = form != null ? form.Font : SystemFonts.DefaultFont;
			var fontFamily = formFont.FontFamily;

			font = new Font(fontFamily, 24);
			smallFont = new Font(fontFamily, 16);
			extraSmallFont = new Font(fontFamily, 12);
			scoreFont = new Font(fontFamily, 16);

			phrase = new Label { AutoSize = true, BackColor = Color.Transparent, Font = font };
			answer = new Label { AutoSize = true, BackColor = Color.Transparent, Font = font };
			scoreLabel = new Label { AutoSize = true, BackColor = Color.Transparent, Font = scoreFont, Dock = DockStyle.Bottom, TextAlign = ContentAlignment.BottomRight };
			history = new Label { AutoSize = true, BackColor = Color.Transparent, Font = extraSmallFont, Dock = DockStyle.Top, TextAlign = ContentAlignment.MiddleLeft };
			translation = new TextBox { Font = font };
			affirmation = new TextBox { Font = font };
			overrideButton = new Button { Font = formFont, Text = Resources.LearnMode.OverrideButton };
			editButton = new Button { Font = formFont, Text = Resources.LearnMode.EditButton };
			viewButton = new Button { Font = formFont, Text = Resources.LearnMode.ViewInListButton };
			deleteButton = new Button { Font = formFont, Text = Resources.LearnMode.DeleteButton };
			roundOverview = new RoundOverview { Dock = DockStyle.Fill };
			gameOverview = new GameOverview(this) { Dock = DockStyle.Fill };

			GameArea.Controls.Add(phrase);
			GameArea.Controls.Add(scoreLabel);
			GameArea.Controls.Add(answer);
			GameArea.Controls.Add(history);
			GameArea.Controls.Add(translation);
			GameArea.Controls.Add(affirmation);
			GameArea.Controls.Add(overrideButton);
			GameArea.Controls.Add(editButton);
			GameArea.Controls.Add(viewButton);
			GameArea.Controls.Add(deleteButton);
			GameArea.Controls.Add(roundOverview);
			GameArea.Controls.Add(gameOverview);

			translation.TextChanged += delegate { Layout(); };
			translation.KeyUp += TranslationKeyUp;
			affirmation.TextChanged += AffirmationTextChanged;
			overrideButton.Click += delegate { Override(items[index], lastGuess); };
			editButton.Click += EditButtonClick;
			viewButton.Click += ViewButtonClick;
			deleteButton.Click += DeleteButtonClick;
			roundOverview.KeyUp += RoundOverviewKeyUp;

			// Stop the beep sound being produced when Enter is pressed.
			// (Handling KeyUp is not sufficient to stop this.)
			translation.KeyPress += (s, e) => {
				if (e.KeyChar == '\r')
					e.Handled = true;
			};

			MergeMenu(new OptionsMenu(this));

			Update();
			Layout();
		}
Ejemplo n.º 8
0
 public virtual void Start(IPracticeWindow owner)
 {
     Owner = owner;
 }
Ejemplo n.º 9
0
        public Navigator(IPracticeWindow source)
        {
            Source = source;

            CurrentItem = source.FetchNextItem();
        }
Ejemplo n.º 10
0
 public override void Start(IPracticeWindow owner)
 {
     base.Start(owner);
 }