public void Show(NextPanel mode) { this.Location = new Point(SystemInformation.VirtualScreen.Width / 2 - 320, SystemInformation.VirtualScreen.Height / 2 - 200); this.Size = new Size(640, 400); base.Show(Program.MainWindow); switchPanel(mode); }
void portToConfirmTextBox_LostFocused(IFocusable sender, FocusEventArgs args) { oneFramePassedAfterRemoveFocus = false; if (sender is DxTextBox textBox) { var errorString = textBox.Parent[2] as TextureString; try { port = int.Parse(textBox.Text); if (port < 0 || port > UInt16.MaxValue) { throw new ArgumentException(); } textBox.Parent.RemoveChild(textBox); generatePanel = NextPanel.Confirm; } catch { errorString.Text = Utility.Language["InvalidPort"]; if (textBox.Text != "") { shouldFocusTextBox = textBox; } } } }
void ipTextBox_LostFocused(IFocusable sender, FocusEventArgs args) { oneFramePassedAfterRemoveFocus = false; if (sender is DxTextBox textBox) { var errorString = textBox.Parent[2] as TextureString; try { if (!CheckIPText(textBox.Text)) { throw new ArgumentException(); } textBox.Parent.RemoveChild(textBox); ip = textBox.Text; generatePanel = NextPanel.Port; } catch { errorString.Text = Utility.Language["InvalidIP"]; if (textBox.Text != "") { shouldFocusTextBox = textBox; } } } }
void passwordTextBox_LostFocused(IFocusable sender, FocusEventArgs args) { oneFramePassedAfterRemoveFocus = false; if (sender is DxTextBox textBox) { var errorString = textBox.Parent[2] as TextureString; textBox.Parent.RemoveChild(textBox); password = textBox.Text; generatePanel = NextPanel.PortToConfrim; } }
public override void Update(InputInfoBase inputInfo, MouseInfo mouseInfo) { oneFramePassedAfterRemoveFocus = true; if (shouldFocusTextBox != null) { focusManager.Focus(shouldFocusTextBox); shouldFocusTextBox = null; } switch (generatePanel) { case NextPanel.Port: currentIndex++; CreatePortPanel(false); break; case NextPanel.Password: currentIndex++; CreatePasswordPanel(); break; case NextPanel.Confirm: currentIndex++; CreateConfirmPanel(); break; case NextPanel.PortToConfrim: currentIndex++; CreatePortPanel(true); break; } generatePanel = NextPanel.None; allSlideSprite.Position = new SharpDX.Vector2(AnimationUtility.GetAnimationValue(allSlideSprite.Position.X, -currentIndex * 800), allSlideSprite.Position.Y); focusManager.ProcessInput(inputInfo); UpdateMouseInfo(mouseInfo); base.Update(); }
private void switchPanel(NextPanel mode) { if (mode == NextPanel.Last) { mode = lastMode; } lastMode = curMode; if (mode != NextPanel.Last) { curMode = mode; } switch (mode) { case NextPanel.MainMenu: currentPanel = mainMenu; break; case NextPanel.GameMenu: currentPanel = gameMenu; break; case NextPanel.Options: currentPanel = options; break; case NextPanel.NewGame: currentPanel = newGame; break; case NextPanel.LoadGame: currentPanel = loadGame; break; case NextPanel.SaveGame: currentPanel = saveGame; break; } currentPanel.Location = new Point(0, 0); currentPanel.Size = this.Size; currentPanel.Visible = true; if (lastPanel != null && currentPanel != lastPanel) { lastPanel.Visible = false; } //Invalidate(); lastPanel = currentPanel; }