Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
 public void Method(MyAlias x)
 {
 }