private void Save_Click(object sender, RoutedEventArgs e) { // Validate hostname. if (Alias.IsHostInvalid(MyHost.Text)) { var errorWindow = DialogWindow.ErrorWindow($"Please enter a valid host name."); errorWindow.Owner = this; errorWindow.ShowDialog(); MyHost.Focus(); MyHost.SelectAll(); return; } // Validate alias name. if (Alias.IsNameInvalid(MyAlias.Text)) { var errorWindow = DialogWindow.ErrorWindow($"Please enter a valid alias."); errorWindow.Owner = this; errorWindow.ShowDialog(); MyAlias.Focus(); MyAlias.SelectAll(); return; } // Checks passed. Add alias entry. Alias.AddAlias(MyHost.Text.ToUpper(), MyAlias.Text); DialogResult = true; }
private void Save_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(MyHost.Text)) { var dialogWindow = new DialogWindow( DialogWindow.DialogIcon.Warning, "Error", $"Please enter a valid host name.", "OK", false); dialogWindow.Owner = this; dialogWindow.ShowDialog(); MyHost.Focus(); MyHost.SelectAll(); return; } if (string.IsNullOrWhiteSpace(MyAlias.Text)) { var dialogWindow = new DialogWindow( DialogWindow.DialogIcon.Warning, "Error", $"Please enter a valid alias.", "OK", false); dialogWindow.Owner = this; dialogWindow.ShowDialog(); MyAlias.Focus(); MyAlias.SelectAll(); return; } Alias.AddAlias(MyHost.Text.ToUpper(), MyAlias.Text); DialogResult = true; }
public EditAliasWindow(string hostname, string alias) { InitializeComponent(); Header.Text = $"{Strings.EditAlias_AliasFor} {hostname}"; MyAlias.Text = alias; MyAlias.SelectAll(); _hostname = hostname; // Set initial focus to text box. Loaded += (sender, e) => MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); }
public EditAliasWindow(PingItem pingItem) { InitializeComponent(); Header.Text = "Alias for: " + pingItem.Hostname; MyAlias.Text = pingItem.Alias; MyAlias.SelectAll(); _CurrentPingItem = pingItem; // Set initial focus to text box. Loaded += (sender, e) => MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); }
public EditAliasWindow(string hostname, string alias) { InitializeComponent(); Header.Text = "Alias for: " + hostname; MyAlias.Text = alias; MyAlias.SelectAll(); _CurrentPingItem = new PingItem { Hostname = hostname, Alias = alias }; // Set initial focus to text box. Loaded += (sender, e) => MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); }
public void Method(MyAlias x) { }