예제 #1
0
파일: Practice.cs 프로젝트: aata/szotar
        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();
        }
예제 #2
0
파일: Practice.cs 프로젝트: dbremner/szotar
		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();
		}