Example #1
0
        private async void searchButton_Click(object sender, EventArgs e)
        {
            if (niComboBox.SelectedIndex < 0)
            {
                return;
            }

            statusStatusLabel.Text = STATUS_SEARCHING;

            int timeout = (int)timeoutNumericUpDown.Value;

            searchStatusProgressBar.Maximum = timeout;

            searchStatusProgressBar.Value   = 0;
            searchStatusProgressBar.Visible = true;
            searchProgressTimer.Enabled     = true;

            cxListView.Enabled   = false;
            searchButton.Enabled = timeoutNumericUpDown.Enabled = false;
            niComboBox.Enabled   = ethCheckBox.Enabled = wlanCheckBox.Enabled = lbCheckBox.Enabled = false;

            ComboBoxItem         si = (ComboBoxItem)niComboBox.SelectedItem;
            List <RemotePlcInfo> di =
                await AmsRouter.BroadcastSearchAsync(
                    (IPAddress)si.Value,
                    timeout * 1000);

            cxListView.Items.Clear();
            foreach (RemotePlcInfo info in di)
            {
                ListViewItem lvi =
                    new ListViewItem(
                        new string[]
                {
                    info.Name,
                    info.Address.ToString(),
                    info.AmsNetId.ToString(),
                    string.Concat(
                        info.TcVersion.Version.ToString(), ".",
                        info.TcVersion.Revision.ToString(), ".",
                        info.TcVersion.Build.ToString()),
                    info.OsVersion,
                    info.Comment
                });

                cxListView.Items.Add(lvi);
            }

            cxListView.Enabled   = true;
            searchButton.Enabled = timeoutNumericUpDown.Enabled = true;
            niComboBox.Enabled   = ethCheckBox.Enabled = wlanCheckBox.Enabled = lbCheckBox.Enabled = true;

            searchStatusProgressBar.Visible = false;
            searchProgressTimer.Enabled     = false;

            statusStatusLabel.Text = STATUS_READY;
        }
Example #2
0
 public DeviceInfoViewModel(AmsNetId target)
 {
     Target = target;
     try
     {
         TargetName = AmsRouter.ListRoutes().Where(x => x.NetId == Target.ToString()).FirstOrDefault().Name;
     }
     catch { }
 }
        private void OpenRemoteDesktop(object sender, EventArgs e)
        {
            var target = _systemManager.GetTargetNetId();

            var ipAddress = AmsRouter.ListRoutes()
                            .Where(route => route.NetId == target)
                            .FirstOrDefault()
                            .Address;

            if (!string.IsNullOrEmpty(ipAddress))
            {
                RemoteDesktop.Connect(ipAddress);
            }
        }
        public TcRteInstallViewModel(string target)
        {
            Target = target;

            try
            {
                TargetName = AmsRouter.ListRoutes().Where(x => x.NetId == Target).FirstOrDefault().Name;
            }
            catch { }

            InstallCommand = new AsyncRelayCommand(InstallAsync, CanInstall);
            SearchCommand  = new AsyncRelayCommand(SearchAsync, CanSearch);

            Connections = new ObservableCollection <LocalAreaConnection>();
        }