Exemplo n.º 1
0
        private void InitProperties()
        {
            mainLayout.Controls.Clear();

            foreach (var prop in Enum.GetValues(typeof(CameraControlProperty)))
            {
                if (INI.KeyExists(prop.ToString(), webcam.DevicePath) && "True".Equals(INI.ReadINI(webcam.DevicePath, prop.ToString())))
                {
                    mainLayout.Controls.Add(CreatePropertyControl(prop));
                }
            }
            foreach (var prop in Enum.GetValues(typeof(VideoProcAmpProperty)))
            {
                if (INI.KeyExists(prop.ToString(), webcam.DevicePath) && "True".Equals(INI.ReadINI(webcam.DevicePath, prop.ToString())))
                {
                    mainLayout.Controls.Add(CreatePropertyControl(prop));
                }
            }

            string PropertyHIDButton1Selected = INI.ReadINI(webcam.DevicePath, "PropertyHIDButton1");
            string PropertyHIDButton2Selected = INI.ReadINI(webcam.DevicePath, "PropertyHIDButton2");

            for (int i = 0; i < mainLayout.Controls.Count; i++)
            {
                PropertyControl item = (PropertyControl)mainLayout.Controls[i];
                item.Dock         = DockStyle.Top;
                item.ValueUpdate += new EventHandler(PropertyValueUpdate);
                if (PropertyHIDButton1Selected.Equals(item.ToString()))
                {
                    PropertyHIDButton1Index = i;
                }
                if (PropertyHIDButton2Selected.Equals(item.ToString()))
                {
                    PropertyHIDButton2Index = i;
                }
            }
            if (hid != null)
            {
                SelectNextProperty();
            }
        }
Exemplo n.º 2
0
        private void ExternPropertyUpdate(object sender, EventArgs e)
        {
            Debug.WriteLine("PropertyUpdate");
            PropertyControl pc = (PropertyControl)sender;

            foreach (Control item in main.Controls)
            {
                if (item is PropertyControlSave)
                {
                    if (pc.ToString().Equals(((PropertyControlSave)item).ToString()))
                    {
                        ((PropertyControlSave)item).SyncValue(pc);
                    }
                }
            }
        }