Пример #1
0
        //Sort of a factory function to create and set a controlType with a given value
        public void SetController(ControlTypeEnum controlType, int playerNum_in)
        {
            playerNum = playerNum_in;
            switch (controlType)
            {
            case ControlTypeEnum.None:
                control = new NoControl();
                transform.GetChild(0).gameObject.layer = LayerMask.NameToLayer("Decoy");
                break;

            case ControlTypeEnum.Human:
                PlayerControl newControl = new PlayerControl();
                newControl.ID = playerNum - 1;
                control       = newControl;
                transform.GetChild(0).gameObject.layer = LayerMask.NameToLayer("Player" + (playerNum_in.ToString()));
                transform.GetChild(1).gameObject.layer = LayerMask.NameToLayer("Player" + (playerNum_in.ToString()) + "Damage");
                break;

            case ControlTypeEnum.Decoy:
                control = new DecoyControl();
                transform.GetChild(0).gameObject.layer = LayerMask.NameToLayer("Decoy" + (playerNum_in.ToString()));
                transform.GetChild(1).gameObject.layer = LayerMask.NameToLayer("Player" + (playerNum_in.ToString()) + "Damage");

                break;
            }
            control.Awake();

            sprite.color = Singleton.globalValues.playerColors[playerNum];
        }
Пример #2
0
        public void ToggleFocus(string controlName, ControlTypeEnum type, bool focus)
        {
            if (View == null)
            {
                return;
            }

            var control = GetControl(controlName, type);

            if (control != null)
            {
                if (focus)
                {
                    if (control.IsFocused)
                    {
                        control.Unfocus();
                    }

                    control.Focus();
                }
                else
                {
                    control.Unfocus();
                }
            }
        }
Пример #3
0
        public static ControlTypeEnum GetControlType(IntPtr hWnd)
        {
            var className = GetClassName(hWnd);
            var classes   = className.Split('.');

            if (classes.Length <= 1)
            {
                return(ControlTypeEnum.Form);
            }
            string          type        = classes[1];
            ControlTypeEnum controlType = ControlTypeEnum.Form;

            switch (type.ToLower())
            {
            case "button":
                controlType = ControlTypeEnum.Button;
                break;

            case "edit":
                controlType = ControlTypeEnum.TextBox;
                break;

            case "window":
                controlType = ControlTypeEnum.Form;
                break;

            case "static":
                controlType = ControlTypeEnum.Label;
                break;
            }
            return(controlType);
        }
Пример #4
0
        public void Unregister(string controlName, ControlTypeEnum controlType)
        {
            if (controlType == ControlTypeEnum.BarItem)
            {
                if (barItemHookHolder.ContainsKey(controlName))
                {
                    var barItem = barItemHookHolder[controlName];
                    barItemHookHolder.Remove(controlName);
                }
            }
            else if (controlType == ControlTypeEnum.Panel)
            {
                if (panelHookHolder.ContainsKey(controlName))
                {
                    panelHookHolder.Remove(controlName);
                }
            }
            else if (controlType == ControlTypeEnum.UserControl)
            {
                if (userControlHookHolder.ContainsKey(controlName))
                {
                    var userControl = userControlHookHolder[controlName];
                    if (userControl is FanUserControl)
                    {
                        userControl.Dispose();
                    }
                    userControlHookHolder.Remove(controlName);

                    string typeName = nameAndTypeNameMap[controlName];
                    typeNameAndNameMap.Remove(typeName);
                    nameAndTypeNameMap.Remove(controlName);
                }
            }
        }
Пример #5
0
 public ControlMapping(ControlTypeEnum type = ControlTypeEnum.Disabled, ControlSubTypeEnum subType = ControlSubTypeEnum.Normal, byte inputIndex = 0, byte outputIndex = 0)
 {
     InputControl = new InputControl()
     {
         Type = type, SubType = subType, InputIndex = inputIndex
     };
     OutputIndex = outputIndex;
 }
Пример #6
0
 public JoystickButtonToColor(Color color, JoystickOffset button, ControlTypeEnum buttonType, byte pressedBrightness, byte releasedBrightness, int[] minCenterMaxValue)
 {
     this._color               = color;
     this._button              = button;
     this._control_type        = buttonType;
     this._pressed_brightness  = pressedBrightness;
     this._Centered_brightness = releasedBrightness;
     this._min_max_value       = minCenterMaxValue;
 }
Пример #7
0
        public void loaddata()
        {
            //初始化控制类型,是主控还是远控
            DataComponent.InitApplicationStartPath(Application.StartupPath);     //初始化应用程序根目录
            if (DataComponent.GetControlType() == ControlTypeEnum.RemoteControl) //判断主控还是远控
            {
                controlType = ControlTypeEnum.RemoteControl;                     //远控赋值
            }
            else
            {
                controlType = ControlTypeEnum.MainControl; //主控赋值
            }
            //数据组件初始化
            int rtn = dataComponent.Init();

            //用于遍历

            //获得所有台位
            testUnit = dataComponent.GetAllTestUnit();
            //获得录入条目
            prodInfoItem = dataComponent.GetProdInfoItem();
            //设置路径
            nameplateCoponent.setstartpath(Application.StartupPath);
            //遍历条目信息
            for (int i = 0; i < prodInfoItem.Length; i++)
            {
                //将条目信息赋值
                oneProdInfoItem = prodInfoItem[i];
                nameplateCoponent.setItemInfo(oneProdInfoItem.itemno, oneProdInfoItem.itemname, oneProdInfoItem.defaultcontent, oneProdInfoItem.inputmode, oneProdInfoItem.selectitem, oneProdInfoItem.changeable, oneProdInfoItem.datalength, oneProdInfoItem.itemtype, oneProdInfoItem.enitemname);
            }
            //  Console.WriteLine(prodInfoItem.Length);
            //遍历所有台位
            for (int j = 0; j < testUnit.Length; j++)
            {
                //台位赋值
                oneTestUnit = testUnit[j];
                nameplateCoponent.setMetaData(oneTestUnit.PrimaryKey, oneTestUnit.BelongedId, oneTestUnit.TestUnitNo, oneTestUnit.TestUnitName, oneTestUnit.TestNow, oneTestUnit.BeginDateTime, oneTestUnit.EndDateTime, ref oneTestUnit.ItemContent, oneTestUnit.ProjectMissionBookId);
            }
            //软件中文名称赋值
            nameplateCoponent.labname = dataComponent.GetSystemInfo().LabName;
            //软件英文名称赋值
            nameplateCoponent.EnlabName = dataComponent.GetSystemInfo().EnLabName;
            //将台位统称和labcode传到录入组件
            nameplateCoponent.SetTestUnitPrefix(dataComponent.GetSystemInfo().TestUnitNameConfig, dataComponent.GetSystemInfo().LabCode);
            //设置行列数
            nameplateCoponent.SetRowAndColumNum(2, 2);
            //控件填充方式,充满窗体
            nameplateCoponent.Dock = DockStyle.Fill;
            //当点击开测触发的事件
            nameplateCoponent.Open_Test += NameplateCoponent_Open_Test;
            //当点击停测触发的事件
            nameplateCoponent.Stop_Test += NameplateCoponent_Stop_Test;
            //当点击保存时触发的事件
            nameplateCoponent.Nameplate_Manage += NameplateCoponent_Nameplate_Manage;
            // 窗体添加上录入组件
            this.Controls.Add(nameplateCoponent);
        }
Пример #8
0
        private View GetControl(string controlName, ControlTypeEnum controlType)
        {
            View control = null;

            if (View == null)
            {
                return(control);
            }

            switch (controlType)
            {
            case ControlTypeEnum.ListView:
                control = View.FindByName <ListView>(controlName);
                break;

            case ControlTypeEnum.Picker:
                control = View.FindByName <Picker>(controlName);
                break;

            case ControlTypeEnum.EnhancedEntry:
                control = View.FindByName <CustomEntry>(controlName);
                break;

            case ControlTypeEnum.DatePicker:
                control = View.FindByName <DatePicker>(controlName);
                break;

            case ControlTypeEnum.TimePicker:
                control = View.FindByName <TimePicker>(controlName);
                break;

            case ControlTypeEnum.SearchBar:
                control = View.FindByName <SearchBar>(controlName);
                break;

            case ControlTypeEnum.StackLayout:
                control = View.FindByName <StackLayout>(controlName);
                break;

            case ControlTypeEnum.AbsoluteLayout:
                control = View.FindByName <AbsoluteLayout>(controlName);
                break;

            case ControlTypeEnum.Grid:
                control = View.FindByName <Grid>(controlName);
                break;

            default:
                break;
            }

            return(control);
        }
Пример #9
0
        public AddButton(Guid _guid, JoystickHelper helper, ControlTypeEnum _controlType)
        {
            InitializeComponent();

            joystick    = helper.HookJoystick(_guid);
            controlType = _controlType;
            toggle_ignore.DataContext = this;

            timer = new DispatcherTimer()
            {
                Interval = new TimeSpan(20)
            };
            timer.Tick += Timer_Tick;
            timer.Start();
        }
Пример #10
0
        /// <summary>
        /// Deserializes a JSON object back to a RGB.NET.Core.Color
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="objectType"></param>
        /// <param name="existingValue"></param>
        /// <param name="serializer"></param>
        /// <returns></returns>
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            JObject jo = JObject.Load(reader);

            Byte.TryParse(jo["Color"]["A"].Value <string>(), out byte a);
            Byte.TryParse(jo["Color"]["R"].Value <string>(), out byte r);
            Byte.TryParse(jo["Color"]["G"].Value <string>(), out byte g);
            Byte.TryParse(jo["Color"]["B"].Value <string>(), out byte b);

            //Enums are stored as int64 on the JSON, to read it properly converting the index is needed
            JoystickOffset  button     = (JoystickOffset)jo["Button"].Value <Int64>();
            ControlTypeEnum buttonType = (ControlTypeEnum)jo["ButtonType"].Value <Int64>();

            return(new JoystickButtonToColor(new Color(a, r, g, b), button, buttonType, jo["PressedBrightness"].Value <byte>(), jo["ReleasedBrightness"].Value <byte>(), jo["MinCenterMaxValue"].Value <int[]>()));
        }
Пример #11
0
        /// <summary> All coordinates are Local by default. positionLocal relative to curve's transform, controls are relative to positionLocal. Set useWorldCoordinates to true to use world coordinates</summary>
        public BGCurvePoint(BGCurve curve, Vector3 position, ControlTypeEnum controlType, Vector3 controlFirst, Vector3 controlSecond, bool useWorldCoordinates = false)
        {
            this.curve       = curve;
            this.controlType = controlType;

            if (useWorldCoordinates)
            {
                positionLocal      = curve.transform.InverseTransformPoint(position);
                controlFirstLocal  = curve.transform.InverseTransformDirection(controlFirst - position);
                controlSecondLocal = curve.transform.InverseTransformDirection(controlSecond - position);
            }
            else
            {
                positionLocal      = position;
                controlFirstLocal  = controlFirst;
                controlSecondLocal = controlSecond;
            }
        }
Пример #12
0
        /// <summary>
        /// 根据控件类型获得不同格式的控件model格式
        /// </summary>
        /// <param name="ctrType"></param>
        /// <returns></returns>
        public string GetControlGroupTemplateModel(ControlTypeEnum ctrType)
        {
            string valueJsonStr = string.Empty;

            //根据控件类型返回不同格式的控件值
            switch (ControlTypeEnum.input)
            {
            case ControlTypeEnum.input:

                break;

            case ControlTypeEnum.select:
                break;

            default:
                break;
            }
            return(valueJsonStr);
        }
Пример #13
0
 /// <summary>
 /// 注册控件
 /// </summary>
 /// <param name="controlName"></param>
 /// <param name="controlType"></param>
 public void Register(string controlName, Component component, ControlTypeEnum controlType)
 {
     if (controlType == ControlTypeEnum.BarItem)
     {
         if (!barItemHookHolder.ContainsKey(controlName))
         {
             barItemHookHolder.Add(controlName, component);
         }
         else
         {
             logger.Error(controlName + "控件已存在");
         }
     }
     else if (controlType == ControlTypeEnum.Panel)
     {
         if (!panelHookHolder.ContainsKey(controlName))
         {
             panelHookHolder.Add(controlName, component);
         }
         else
         {
             logger.Error(controlName + "面板已存在");
         }
     }
     else if (controlType == ControlTypeEnum.UserControl)
     {
         if (!userControlHookHolder.ContainsKey(controlName))
         {
             userControlHookHolder.Add(controlName, component);
             nameAndTypeNameMap.Add(controlName, component.GetType().FullName);
             typeNameAndNameMap.Add(component.GetType().FullName, controlName);
         }
         else
         {
             logger.Error(controlName + "控件已存在");
         }
     }
     else
     {
         logger.Error(controlName + "控件不符合类型,不能注册");
     }
 }
Пример #14
0
 public ControlTypeAttribute(ControlTypeEnum controlType)
 {
     ControlType = controlType;
 }
Пример #15
0
 public ControlPropAttribute(string LableName, string ControlName = "", bool AllowNull = true, string ClassStr = "", bool IsShow = true, string RegExp = "", ControlTypeEnum ControlType = ControlTypeEnum.无, string DefaultVal = null, string Option = null)
 {
     this.controlType = ControlType;
     this.allowNull   = AllowNull;
     this.lableName   = LableName;
     this.controlName = ControlName;
     this.classStr    = ClassStr;
     this.isShow      = IsShow;
     this.regExp      = RegExp;
     this.defaultVal  = DefaultVal;
     this.option      = Option;
 }
Пример #16
0
 public SizePolicy(Policy horizontal, Policy vertical, ControlTypeEnum type)
 {
     Handle = qt_sizepolicy_new_with_controltype(horizontal, vertical, type);
 }
Пример #17
0
 protected static extern IntPtr qt_sizepolicy_new_with_controltype(Policy horizontal, Policy vertical, ControlTypeEnum type);
Пример #18
0
 protected static extern void qt_sizepolicy_controltype_set(IntPtr raw, ControlTypeEnum controlType);
 public ControlTypeAttribute(ControlTypeEnum ControlType)
 {
     this.ControlType = ControlType;
 }
Пример #20
0
 public PropertyControlAttribute(ControlTypeEnum controlType)
 {
     this.ControlType = controlType;
 }
Пример #21
0
 /// <summary> All coordinates are Local by default. positionLocal relative to curve's transform, controls are relative to positionLocal. Set useWorldCoordinates to true to use world coordinates</summary>
 public BGCurvePoint(BGCurve curve, Vector3 position, ControlTypeEnum controlType, bool useWorldCoordinates = false)
     : this(curve, position, controlType, Vector3.zero, Vector3.zero, useWorldCoordinates)
 {
 }
Пример #22
0
 /// <summary> All coordinates are Local by default. positionLocal relative to curve's transform, controls are relative to positionLocal. Set useWorldCoordinates to true to use world coordinates</summary>
 public BGCurvePoint(BGCurve curve, Vector3 position, ControlTypeEnum controlType, Vector3 controlFirst, Vector3 controlSecond, bool useWorldCoordinates = false)
     : this(curve, null, position, controlType, controlFirst, controlSecond, useWorldCoordinates)
 {
 }
 public MissingControl(string name, ControlTypeEnum type)
 {
     this.Name        = name;
     this.ControlType = type;
 }
Пример #24
0
        private void ProviderBox_SelectionChanged(object sender,SelectionChangedEventArgs e)
        {
            if (currentCredential != null)
            {
                UpdateCredential();
            }
            currentCredential        = null;
            EnrollmentProgress.Value = 0;
            IFingerDevice device = (sender as ComboBox).SelectedItem as IFingerDevice;

            //if (currentDevice != null)
            if (isOnline)
            {
                Ambassador.ClearCallback();
                currentDevice.Dispatch(COMMAND.SINGLECAPTURE_STOP);
            }

            currentDevice = device;
            isOnline      = true;
            if (device.BSPCode == 24)
            {
                _controlType                 = ControlTypeEnum.PALM_CONTROL_TYPE;
                fingerChooser.Visibility     = Visibility.Collapsed;
                palmEnrollControl.Visibility = Visibility.Visible;
            }
            else
            {
                _controlType                 = ControlTypeEnum.FINGERPRINT_CONTROL_TYPE;
                fingerChooser.Visibility     = Visibility.Visible;
                palmEnrollControl.Visibility = Visibility.Collapsed;
            }

            Ambassador.SetCallback(DispatchMessage);
            currentDevice.Dispatch(COMMAND.SINGLECAPTURE_START);



            foreach (var iface in currentDevice.GetType().GetInterfaces())
            {
                foreach (var fingerCred in Owner.Credentials.OfType <FingerCredential>())
                {
                    if (fingerCred.device.Equals(currentDevice.ToString()))
                    {
                        currentCredential = new FingerCredential(fingerCred);
                    }
                }
            }

            if (currentCredential == null)
            {
                currentCredential            = new FingerCredential();
                currentCredential.device     = currentDevice.ToString();
                currentCredential.deviceName = currentDevice.ToString();
                //Owner.Credentials.Add(currentCredential);
            }

            fingerDisplay = new FingerDisplay();
            Scanner.Children.Clear();
            Scanner.Children.Add(fingerDisplay);
            fingerDisplay.ClearImage();
            Cancel.Visibility            = Visibility.Collapsed;
            UpdateBtn.Visibility         = Visibility.Visible;
            ProviderBox.IsEnabled        = true;
            EnrollmentProgress.IsEnabled = false;

            UpdateFingers();
//            showMessageBase("Please, select finger to enroll or touch the scanner to verify it");
            switch (_controlType)
            {
            case ControlTypeEnum.FINGERPRINT_CONTROL_TYPE:
                baseHint = "Please, select finger to enroll or touch the scanner to verify it";    //
                showMessageBase(baseHint);
                break;

            case ControlTypeEnum.PALM_CONTROL_TYPE:
                baseHint = "Please, select palm to enroll or place your hand above the scanner to verify it";    //
                showMessageBase(baseHint);
                break;

            default:
                break;
            }
        }
 public MissingControl(string name, ControlTypeEnum type, string description)
 {
     this.Name        = name;
     this.ControlType = type;
     this.Description = description;
 }
 public GuiPropertyAttribute(string displayName, ControlTypeEnum controlType)
 {
     DisplayName = displayName;
     ControlType = controlType;
 }
Пример #27
0
        public static MvcHtmlString Easyui(this HtmlHelper htmlHelper, string name, ControlTypeEnum controlType, string valueField, string textField, string url, ValidateTypeEnum validateType = ValidateTypeEnum.No, bool isRequired = false, string style = null, object value = null, object htmlAttributes = null, string cls = null, bool multiple = false, bool isAllowEdit = true)
        {
            Dictionary <string, object> Dictionarys = new Dictionary <string, object>();

            if (htmlAttributes != null)
            {
                Dictionarys = htmlAttributes.ToDictionary();
            }
            if (!string.IsNullOrWhiteSpace(style))
            {
                if (Dictionarys.Keys.Contains("style"))
                {
                    Dictionarys["style"] = Dictionarys["style"] + style;
                }
                else
                {
                    Dictionarys.Add("style", style);
                }
            }
            bool isCanEdit = isAllowEdit; //是否允许编辑

            if (!isCanEdit)               //不允许编辑
            {
                Dictionarys.Add("disabled", "disabled;");
                htmlAttributes = new { disabled = Dictionarys["disabled"], style = Dictionarys["style"] };
            }
            else
            {
                htmlAttributes = new { style = Dictionarys["style"] };
            }
            //文本框
            if (controlType == ControlTypeEnum.TextBox)
            {
                if (validateType != ValidateTypeEnum.No)
                {
                    return(EasyuiValidatebox(htmlHelper, name, validateType.ToString(), isRequired, value, null, htmlAttributes));
                }
                else
                {
                    return(EasyuiTextBox(htmlHelper, name, isRequired, value, htmlAttributes));
                }
            }
            //文本域
            if (controlType == ControlTypeEnum.TextAreaBox)
            {
                string defaultValue = value == null ? "" : value.ToString();
                return(htmlHelper.TextArea(name, defaultValue, 6, 100, htmlAttributes));
            }
            //下拉框
            if (controlType == ControlTypeEnum.ComboBox)
            {
                return(EasyuiComboBox(htmlHelper, name, valueField, textField, url, isRequired, false, value, null, Dictionarys["style"].ToString(), isCanEdit));
            }
            //弹出选择框
            if (controlType == ControlTypeEnum.DialogGrid)
            {
                return(EasyuiDialog(htmlHelper, name, url, textField, valueField, isRequired, htmlAttributes, value, isCanEdit));
            }
            //日期
            if (controlType == ControlTypeEnum.DateBox)
            {
                string format = "yyyy-MM-dd";
                if (value.ObjToDateNull().HasValue)
                {
                    value = value.ObjToDateNull().Value.ToString(format);
                }
                return(EasyuiDateBox(htmlHelper, name, isRequired, value, cls, Dictionarys["style"].ToString(), isCanEdit));
            }
            //时间
            if (controlType == ControlTypeEnum.DateTimeBox)
            {
                string format = "yyyy-MM-dd HH:mm:ss";
                if (value.ObjToDateNull().HasValue)
                {
                    value = value.ObjToDateNull().Value.ToString(format);
                }
                return(EasyuiDateTimeBox(htmlHelper, name, isRequired, value, cls, Dictionarys["style"].ToString(), isCanEdit));
            }
            else if (controlType == ControlTypeEnum.ComboTree)
            {
                return(EasyuiComboTree(htmlHelper, name, valueField, textField, url, isRequired, multiple, value, cls));
            }
            //其他
            TagBuilder tagBuilder = htmlHelper.InitTagBuilder(name, isRequired, value, htmlAttributes);

            return(new MvcHtmlString(tagBuilder.ToString(TagRenderMode.Normal)));
        }