Пример #1
0
        public MonitorIPViewModel(string filePath, IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            SelectedFilePath     = filePath;
            IpData        = new ObservableCollectionPropertyNotify <IPDataModel>();
            IpAddressList = new List <IPAddress>();
            IpDataGrid    = new DataGrid();
            uiContext     = SynchronizationContext.Current;
            RefreshRateInputVisibility = Visibility.Hidden;
            //sets default refresh rate at 500 ms
            internalRefreshRate = 500;

            //add the ips from IpDataModel to the ipaddr list that is given to the asyncping command
            ParseHTML.ParseIpHTML(IpData, filePath);
            for (int i = 0; i < IpData.Count; i++)
            {
                IpAddressList.Add(IpData[i].Ip);
            }

            RefreshIP = true;

            //~~~~~~~~~~~!!DO NOT CHANGE THIS!!~~~~~~~~~~~~~~~~~~~~~~
            //There is a bug in .NET frameworks 4 and up that causes a PROCCESS_HAS_LOCKED_PAGES  Windows Blue Screen of Death
            //if you have a debugger attached and stop debugging while the ping is in process
            //If you want to test ping functionality you must build/run without debugging (CTRL-F5)
            if (!System.Diagnostics.Debugger.IsAttached)
            {
                StartIpPingThread();
            }
            //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        }