Exemplo n.º 1
0
        private void MainWindow_OnClosing(object sender, CancelEventArgs e)
        {
            foreach (var item in IpAddresses)
            {
                item.Status = String.Empty;
                item.Time = 0;
            }

            DataInteract.SaveCollection(IpAddresses);
        }
Exemplo n.º 2
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            if (!File.Exists($@"{Directory.GetCurrentDirectory()}\config.json"))
            {
                File.Create($@"{Directory.GetCurrentDirectory()}\config.json").Close();
            }

            tm.Enabled = false;
            tm.Elapsed += (o, args) => Pinging();
        

            IpAddresses = DataInteract.GetCollection();
            if (IpAddresses == null) IpAddresses = new ObservableCollection<Address>();
            dg_data.ItemsSource = IpAddresses;
        }
Exemplo n.º 3
0
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(Ip_TextBox.Text) || string.IsNullOrWhiteSpace(Name_TextBox.Text))
            {
                MessageBox.Show("IP-адрес и наименование должны быть заполнены!", "Ошибка!", MessageBoxButton.OK);
                return;
            }

            var parse = DataInteract.IsIp(Ip_TextBox.Text);
            if (!parse)
            {
                MessageBox.Show("Проверьте правильность ввода IP адреса!");
                return;
            }

            IpAddresses.Add(new Address(Ip_TextBox.Text, Name_TextBox.Text));
            Ip_TextBox.Clear();
            Name_TextBox.Clear();
        }