Esempio n. 1
0
 public DeviceControl(Device device, List <Device> deviceList, IDeviceControl specialControl, DeviceManager manager)
 {
     this.device  = device;
     devices      = deviceList;
     CTR          = specialControl;
     this.manager = manager;
     InitializeType();
     CTR.Initializer();
     InitializerBase();
 }
        public AudioSettingsControl(IUpdatableControl updatableControl)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            this.updatableControl = updatableControl;
            this.deviceControl = null;
        }
        public Dictionary <string, AssignmentCollection>[] ToAssignmentArray(IDeviceControl device = null)
        {
            Dictionary <string, AssignmentCollection>[] result = new[] {
                new Dictionary <string, AssignmentCollection>(),
                new Dictionary <string, AssignmentCollection>(),
                new Dictionary <string, AssignmentCollection>(),
                new Dictionary <string, AssignmentCollection>()
            };

            AddAssignments(result[0], MainAssignments, device);
            AddAssignments(result[1], RedAssignments, device);
            AddAssignments(result[2], BlueAssignments, device);
            AddAssignments(result[3], GreenAssignments, device);

            return(result);
        }
Esempio n. 4
0
        private void AddDeviceControl(IDeviceControl deviceCtrl)
        {
            Action EmptyDelegate = delegate(){ };

            if (deviceCtrl.ActiveDevices.Count == 0)
            {
                RadioButton radioButton = new RadioButton();
                radioButton.Checked   += DeviceSelected;
                radioButton.Unchecked += DeviceDeselected;

                radioButton.Content   = deviceCtrl.ToString();
                radioButton.IsChecked = false;
                radioButton.IsEnabled = true;

                radioButton.Style   = this.FindResource("IZRadioButton") as Style;
                radioButton.ToolTip = deviceCtrl.ToString();

                TestDevicePanel.Children.Add(radioButton);
                radioButton.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate);
            }
            else
            {
                for (var dev = 0; dev < deviceCtrl.ActiveDevices.Count; dev++)
                {
                    RadioButton radioButton = new RadioButton();
                    radioButton.Checked   += DeviceSelected;
                    radioButton.Unchecked += DeviceDeselected;

                    radioButton.Content   = deviceCtrl.ActiveDevices[dev];
                    radioButton.IsChecked = false;
                    radioButton.Style     = this.FindResource("IZRadioButton") as Style;
                    radioButton.ToolTip   = deviceCtrl.ActiveDevices[dev].Description.Replace(", ", "\n");
                    TestDevicePanel.Children.Add(radioButton);
                    radioButton.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate);
                }
            }
        }
Esempio n. 5
0
        private void AddDeviceControl(IDeviceControl deviceCtrl)
        {
            RadioButton radioButton = new RadioButton();

            radioButton.Checked   += DeviceSelected;
            radioButton.Unchecked += DeviceDeselected;
            if (deviceCtrl.ActiveDevices.Count == 0)
            {
                radioButton.Content   = deviceCtrl.ToString();
                radioButton.IsChecked = false;
                radioButton.IsEnabled = true;

                radioButton.Style = this.FindResource("IZRadioButton") as Style;

                TestDevicePanel.Children.Add(radioButton);
            }
            else
            {
                radioButton.Content   = deviceCtrl.ActiveDevices[0];
                radioButton.IsChecked = false;
                radioButton.Style     = this.FindResource("IZRadioButton") as Style;
                TestDevicePanel.Children.Add(radioButton);
            }
        }
        private void AddAssignments(Dictionary <string, AssignmentCollection> mapping, List <AssignmentPair> assignmentPairs, IDeviceControl device = null)
        {
            foreach (var pair in assignmentPairs)
            {
                var collection = pair.GetCollection();

                foreach (var assignment in collection)
                {
                    if (assignment is ShiftAssignment)
                    {
                        (assignment as ShiftAssignment).SetControl(device);
                    }
                }

                mapping.Add(pair.input, pair.GetCollection());
            }
        }
Esempio n. 7
0
 public ShiftAssignment(IDeviceControl control)
 {
     _control     = control;
     ToggleStates = new List <ShiftState>();
 }
Esempio n. 8
0
 public void SetControl(IDeviceControl control)
 {
     _control = control;
 }
Esempio n. 9
0
 public void InitializerControl(IDeviceControl specialControl)
 {
     CTR = specialControl;
     Controls.Add(CTR.Initializer());
 }
Esempio n. 10
0
        private void BiometricsEnrolled(Object sender,List <FingerTemplate> bios)
        {
            try
            {
                if (_controlType == ControlTypeEnum.PALM_CONTROL_TYPE)
                {
                    if (isVerifyingPalm == false)
                    {
                        enrollmentToVerify = bios;
                        isVerifyingPalm    = true;
                        currentDevice.Dispatch(COMMAND.SINGLECAPTURE_START);
                        return;
                    }
                }
                if (bios != null)
                {
                    // Check whether it is already enrolled

                    IDeviceControl        currDeviceControl = null;
                    List <FingerTemplate> matchedTemplates;
                    foreach (var devCtrl in Owner.PluginManager.DeviceControls)
                    {
                        if (devCtrl.ActiveDevices.Contains(currentDevice))
                        {
                            currDeviceControl = devCtrl;
                        }
                    }

                    if (isVerifyingPalm)
                    {
                        int matchesCount = currDeviceControl.Match(bios[0],enrollmentToVerify,out matchedTemplates);
                        isVerifyingPalm = false;
                    }
                    foreach (var user in Owner.Users)
                    {
                        if (user.SID == Owner.SID)
                        {
                            continue;
                        }
                        foreach (var fingerCred in user.credentials_List.OfType <FingerCredential>())
                        {
                            if (fingerCred.device.Equals(currentDevice.ToString()))
                            {
                                var candidates = new ComparsionCandidates(fingerCred.fingers);
                                foreach (var bio in bios)
                                {
//                                    int fingerIndex = currentDevice.Match(bio, candidates.Candidates);
                                    int matchesCount = currDeviceControl.Match(bio,candidates.Candidates,out matchedTemplates);
                                    if (matchesCount != 0)
                                    {
                                        Dispatcher.Invoke(new Action(() => showMessagePopup("Already registered as "
                                                                                            + FingerCredential.GetFingerName(candidates.PositionOf(matchedTemplates[0])) +
                                                                                            (_controlType == ControlTypeEnum.PALM_CONTROL_TYPE ? " " : " finger") +
                                                                                            " of user " +
                                                                                            user.ToString())));
                                        goto end;
                                    }
                                }
                            }
                        }
                    }
                    ////check if it is first time enrollment
                    if (currentCredential != null)
                    {
                        var candidates = new ComparsionCandidates(currentCredential.fingers);
                        foreach (var bio in bios)
                        {
                            //int fingerIndex = currentDevice.Match(bio, candidates.Candidates);
                            //if (fingerIndex != -1)
                            int matchesCount = currDeviceControl.Match(bio,candidates.Candidates,out matchedTemplates);
                            if (matchesCount != 0)
                            {
                                Dispatcher.Invoke(new Action(() => showMessagePopup("Already registered as "
                                                                                    + FingerCredential.GetFingerName(candidates.PositionOf(matchedTemplates[0])) +
                                                                                    (_controlType == ControlTypeEnum.PALM_CONTROL_TYPE ? " " : " finger") +
                                                                                    " of user " +
                                                                                    Owner.Username)));
                                goto end;
                            }
                        }
                    }
                    ////
                    if (_controlType == ControlTypeEnum.FINGERPRINT_CONTROL_TYPE)
                    {
                        foreach (var tmpl in bios)
                        {
                            String str = Convert.ToBase64String(tmpl.Serialize());
                            currentCredential.AddFinger(new Finger(fingerNum,str,tmpl));
                        }
                    }
                    else if (_controlType == ControlTypeEnum.PALM_CONTROL_TYPE)
                    {
                        showMessagePopup((fingerNum == 10 ? "Left palm" : "Right palm") + " has been successfully registered");
                        foreach (var tmpl in enrollmentToVerify)
                        {
                            String str = Convert.ToBase64String(tmpl.Serialize());
                            currentCredential.AddFinger(new Finger(fingerNum,str,tmpl));
                        }
                    }
                }

end:
                Task.Factory.StartNew(() =>
                {
                    Dispatcher.Invoke(new Action(() => endEnrollment()));
                });
            }
            catch (Exception ex)
            {
                Log.Error("enrollment exception" + ex);
            }
        }
 void DriverTypeComboBoxSelectedIndexChanged(object sender, EventArgs e)
 {
     HostApiItem selectedItem = (HostApiItem) driverTypeComboBox.SelectedItem;
     audioSettingsPanel.Controls.Clear();
     this.deviceControl = (IDeviceControl) selectedItem.HostApiDeviceControl;
     audioSettingsPanel.Controls.Add(selectedItem.HostApiDeviceControl);
     update();
 }
Esempio n. 12
0
        public void Button_Click(object sender, EventArgs e)
        {
            IDeviceControl deviceControl = DependencyService.Get <IDeviceControl>();

            deviceControl.BluetoothManager();
        }