private void mnuAddToFavorites_Click(object sender, RoutedEventArgs e)
        {
            // Display add to favorites window.
            var currentHostList             = new List <string>();
            var haveAnyHostnamesBeenEntered = false;

            for (int i = 0; i < _ProbeCollection.Count; ++i)
            {
                currentHostList.Add(_ProbeCollection[i].Hostname);
                if (!string.IsNullOrWhiteSpace(_ProbeCollection[i].Hostname))
                {
                    haveAnyHostnamesBeenEntered = true;
                }
            }

            if (!haveAnyHostnamesBeenEntered)
            {
                var errorWindow = DialogWindow.ErrorWindow(Strings.Error_NoHostsForFavorite);
                errorWindow.Owner = this;
                errorWindow.ShowDialog();
                return;
            }

            var addToFavoritesWindow = new NewFavoriteWindow(currentHostList, (int)ColumnCount.Value);

            addToFavoritesWindow.Owner = this;
            if (addToFavoritesWindow.ShowDialog() == true)
            {
                LoadFavorites();
            }
        }
Exemple #2
0
        private void New_Click(object sender, RoutedEventArgs e)
        {
            var newFavoriteWindow = new NewFavoriteWindow(new List <string>(), 2);

            newFavoriteWindow.Owner = this;
            if (newFavoriteWindow.ShowDialog() == true)
            {
                RefreshFavoriteList();
            }
        }
Exemple #3
0
        private void CreateFavorite_Click(object sender, RoutedEventArgs e)
        {
            // Display new favorite window => Pass in current addresses and column count.
            // If window title ends with " - vmPing", then user currently has a
            // favorite loaded. Pass the title of that favorite to the new window.
            const string favTitle          = " - vmPing";
            var          newFavoriteWindow = new NewFavoriteWindow(
                hostList: _ProbeCollection.Select(x => x.Hostname).ToList(),
                columnCount: (int)ColumnCount.Value,
                title: Title.EndsWith(favTitle) ? Title.Remove(Title.Length - favTitle.Length) : string.Empty);

            newFavoriteWindow.Owner = this;
            if (newFavoriteWindow.ShowDialog() == true)
            {
                LoadFavorites();
            }
        }
Exemple #4
0
        private void mnuAddToFavorites_Click(object sender, RoutedEventArgs e)
        {
            // Display add to favorites window.
            var currentHostList = new List <string>();

            for (int i = 0; i < _ProbeCollection.Count; ++i)
            {
                currentHostList.Add(_ProbeCollection[i].Hostname);
            }

            var addToFavoritesWindow = new NewFavoriteWindow(currentHostList, (int)ColumnCount.Value);

            addToFavoritesWindow.Owner = this;
            if (addToFavoritesWindow.ShowDialog() == true)
            {
                LoadFavorites();
            }
        }
Exemple #5
0
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            if (Favorites.SelectedIndex < 0)
            {
                return;
            }

            var newFavoriteWindow = new NewFavoriteWindow(
                hostList: SelectedFavorite.Hostnames,
                columnCount: SelectedFavorite.ColumnCount,
                isEditExisting: true,
                title: Favorites.SelectedItem.ToString());

            newFavoriteWindow.Owner = this;
            if (newFavoriteWindow.ShowDialog() == true)
            {
                RefreshFavoriteList();
            }
        }