Ejemplo n.º 1
0
        public SelectFGWindow(Window owner)
        {
            this.Owner = owner;

            InitializeComponent();

            displayMessage("Select Frame-Grabber");
            xamlButtonOK.IsEnabled = false;

            DeviceIdentity[] dis = FPScanner.GetDevices();
            xamlListBoxFG.ItemsSource = dis;
        }
Ejemplo n.º 2
0
        private async void NewMethod_InitializeComponent()
        {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;



            displayMessage("Select Frame-Grabber");
            xamlButtonOK.Enabled = false;

            DeviceIdentity[] dis = FPScanner.GetDevices();
            xamlListBoxFG.DataSource    = dis;
            xamlListBoxFG.SelectedIndex = 0;

            if (xamlListBoxFG.Items.Count > 1)
            {
                //Show();
                DeviceIdentity selectedDI = (DeviceIdentity)xamlListBoxFG.SelectedItem; //Get selected Frame-Grabber
                this.SelectedDeviceIdentity = selectedDI;
                xamlButtonOK.Enabled        = true;
                rDialogResult = true;
            }
            else if (xamlListBoxFG.Items.Count == 1)
            {
                Hide();
                //////////////////////////////////////////////////////////////
                //Dont alter this codes below, it will lead toerror
                int rr = await Task.Run(() =>
                {
                    DeviceIdentity selectedDI   = (DeviceIdentity)xamlListBoxFG.SelectedItem; //Get selected Frame-Grabber
                    this.SelectedDeviceIdentity = selectedDI;
                    xamlButtonOK.Visible        = false;
                    rDialogResult = true;
                    return(1);
                });

                this.Close();

                //////////////////////////////////////////////////////////////
            }
        }