public SandboxControl(IKeyTableFactory tableFactory, IAsynchQueueFactory queueFactory, IPrimFactory primFactory, IModel model, IConfigSource config) : base(tableFactory, queueFactory, primFactory, model, config) { _tableFactory = tableFactory; //IsOn int chatChannel = ControlConfig.GetInt("PublicInputChannel", 46); if (chatChannel < 0) { chatChannel = 46; } Dialog.SetChatChannel(chatChannel); //Misc _reposition = ControlConfig.GetBoolean("RepositionControls", false); float scale = ControlConfig.GetFloat("DefaultScale", .5f); if (ControlConfig.GetBoolean("AutoRecord", false)) { Record.StartRecording(); } InitControls(); }
private void FrmMain_Load(Object sender, EventArgs e) { _config = new ControlConfig { Control = this, FileName = "ApiDiscover.json" }; _config.Load(); }
private void FrmMain_Load(Object sender, EventArgs e) { _config = new ControlConfig { Control = this, FileName = "mqtt.json" }; _config.Load(); _log = new TextControlLog { Control = txtReceive }; if (cbRemote.Items.Count == 0) { cbRemote.Items.Add("127.0.0.1:1883"); } if (txtClientId.Text.IsNullOrEmpty()) { txtClientId.Text = Environment.MachineName; } if (cbQos.SelectedIndex < 0) { cbQos.SelectedIndex = 0; } if (cbQos2.SelectedIndex < 0) { cbQos2.SelectedIndex = 0; } //txtReceive.UseWinFormControl(); txtReceive.Clear(); txtReceive.SetDefaultStyle(12); txtSend.SetDefaultStyle(12); }
/// <summary> /// 创建控件 /// </summary> /// <returns></returns> UIElement CreateControl() { if (null == this.lbControls.SelectedItem) { return(null); } ControlConfig config = (this.lbControls.SelectedItem as ListBoxItem).Tag as ControlConfig; List <String> assItem = new List <string>(); assItem.AddRange(TempletConfig.AssemblyCollection); //-->判断是不是复合控件 if (config.IsCompositeCtrl && !config.AssemblyQualifiedName.IsNullOrEmpty()) { assItem.Add(config.AssemblyQualifiedName.Trim()); } string ass = string.Join(" ", assItem); ass = string.Format(config.xaml, ass); ass = ass.Replace("??", config.Name + DateTime.Now.ToString("ffffff")); ass = ass.Trim(); FrameworkElement ui = Wrapper.LoadXaml <FrameworkElement>(ass); ui.Tag = config; return(ui); }
private DataModelControl BuildDataModelControl(ControlConfig controlConfig) { Model model = _modelRepository.GetModel(controlConfig.ModelId); Endpoint endpoint = _modelRepository.GetEndpoint(controlConfig.EndpointId); return(new DataModelControl() { ControlType = controlConfig.ControlType, Name = controlConfig.PartialName, ModelId = model.ModelId, Namespace = model.Namespace, Model = model.Name, EndpointId = endpoint.EndpointId, Method = endpoint.Method, Classes = controlConfig.Classes, PrimaryInt = GetParameterString(controlConfig.PrimaryInt, BasicType.Int), SecondaryInt = GetParameterString(controlConfig.SecondaryInt, BasicType.Int), PrimaryString = GetParameterString(controlConfig.PrimaryString, BasicType.String), SecondaryString = GetParameterString(controlConfig.SecondaryString, BasicType.String), PrimaryBool = GetParameterString(controlConfig.PrimaryBool, BasicType.Bool), SecondaryBool = GetParameterString(controlConfig.SecondaryBool, BasicType.Bool), PrimaryDateTime = GetParameterString(controlConfig.PrimaryDateTime, BasicType.DateTime), SecondaryDateTime = GetParameterString(controlConfig.SecondaryDateTime, BasicType.DateTime) }); }
private void FrmSecurity_Load(Object sender, EventArgs e) { _config = new ControlConfig { Control = this, FileName = "security.json" }; _config.Load(); }
private IControl BuildRenderBodyControl(ControlConfig controlConfig) { return(new RenderBodyControl() { ControlType = ControlType.RenderBody, }); }
private IControl BuildLinkControl(ControlConfig controlConfig) { var control = new LinkControl() { ControlType = ControlType.Link, OpenNewPage = controlConfig.OpenNewPage, ExternalUrl = controlConfig.ExternalUrl, Text = controlConfig.Text, View = controlConfig.View, ModelId = controlConfig.ModelId, }; if (controlConfig.EndpointId != EndpointId.None) { control.Method = _modelRepository.GetEndpoint(controlConfig.EndpointId).Method; control.PrimaryInt = GetParameterString(controlConfig.PrimaryInt, BasicType.Int); control.SecondaryInt = GetParameterString(controlConfig.SecondaryInt, BasicType.Int); control.PrimaryString = GetParameterString(controlConfig.PrimaryString, BasicType.String); control.SecondaryString = GetParameterString(controlConfig.SecondaryString, BasicType.String); control.PrimaryBool = GetParameterString(controlConfig.PrimaryBool, BasicType.Bool); control.SecondaryBool = GetParameterString(controlConfig.SecondaryBool, BasicType.Bool); control.PrimaryDateTime = GetParameterString(controlConfig.PrimaryDateTime, BasicType.DateTime); control.SecondaryDateTime = GetParameterString(controlConfig.SecondaryDateTime, BasicType.DateTime); } return(control); }
/// <summary> /// Initializes a new instance of the /// <see cref="ClockPanel" /> /// class. /// </summary> public ClockPanel() { BackColor = ColorConfig.FormBackColorDark; BorderColor = BackColor; ForeColor = ColorConfig.ForeColorGray; Font = FontConfig.FontSizeSmall; Margin = ControlConfig.Margin; Padding = ControlConfig.Padding; ClockShape = ClockShapes.Rectangle; ClockType = ClockTypes.Digital; DisplayDates = true; Now = DateTime.Now; ShowBorder = false; ShowClockFrame = false; ShowHourDesignator = true; ShowMinute = true; ShowSecondHand = true; HourHandColor = ColorConfig.ForeColorGray; MinuteColor = ColorConfig.ForeColorGray; SecondHandColor = ColorConfig.ForeColorGray; VisualStyle = ClockVisualStyle.None; Location = ControlConfig.GetLocation(); Dock = ControlConfig.GetDockStyle(); Anchor = ControlConfig.GetAnchorStyle(); Visible = true; Enabled = true; }
void cbb_SelectionChanged(object sender, SelectionChangedEventArgs e) { MetaDataColumnInfo mdi = dgTable.SelectedItem as MetaDataColumnInfo; if (null == mdi) { return; } ComboBox cbb = sender as ComboBox; ControlConfig cc = cbb.SelectedItem as ControlConfig; if (null == cc) { return; } if (!cc.DataType.IsNullOrEmpty()) { //-->判断数据类型是否匹配 if (cc.DataType.ToLower().Contains(mdi.data_type.ToLower())) { mdi.control_type = cc.Name; } else { Wrapper.ShowDialog("数据类型不匹配,请重新选择!"); } } else { mdi.control_type = cc.Name; } }
/// <summary> /// Initializes a new instance of the /// <see cref = "CalendarPanel"/> /// class. /// </summary> public CalendarPanel() { Size = SizeConfig.GetSize(530, 375); Location = ControlConfig.GetLocation(); Font = FontConfig.FontSizeSmall; Margin = ControlConfig.Margin; ForeColor = ColorConfig.ForeColorGray; BackColor = ColorConfig.FormBackColorDark; Dock = ControlConfig.GetDockStyle(); Anchor = ControlConfig.GetAnchorStyle(); Visible = true; Enabled = true; Style = VisualStyle.Office2010; Office2010Theme = Office2010Theme.Blue; Border3DStyle = Border3DStyle.Flat; BorderColor = Color.Transparent; BorderStyle = BorderStyle.FixedSingle; FirstDayOfWeek = Day.Monday; BottomHeight = 30; DayNamesColor = ColorConfig.FormBackColorDark; DayNamesFont = new Font("Roboto", 10, FontStyle.Bold); DaysFont = FontConfig.FontSizeMedium; DaysColor = ColorConfig.FormBackColorDark; DaysHeaderInterior = new BrushInfo(SystemColors.ControlDark); HeadForeColor = Color.White; HeaderHeight = 40; HeadGradient = false; HeaderFont = new Font("Roboto", 12, FontStyle.Bold); HeaderStartColor = Color.FromArgb(70, 70, 70); }
private void CopyConfig(ControlConfig source, ControlConfig destination) { var triggerBinding = source as TriggerConfig; var destTriggerBinding = destination as TriggerConfig; var stickConfig = source as StickConfig; var destStickConfig = destination as StickConfig; if (triggerBinding != null && destTriggerBinding != null) { destTriggerBinding.deadzone = triggerBinding.deadzone; } else if (stickConfig != null && destStickConfig != null) { destStickConfig.moveDeadzone = stickConfig.moveDeadzone; destStickConfig.actionDeadzone = stickConfig.actionDeadzone; destStickConfig.mode = stickConfig.mode; } destination.bindings.Clear(); foreach (var sourceBinding in source.bindings) { destination.bindings.Add(sourceBinding.Clone()); } }
/// <summary> /// Initializes a new instance of the /// <see cref="GroupBoxPanel" /> /// class. /// </summary> /// <param name="size">The size.</param> /// <param name="location">The location.</param> /// <param name="parent">The parent.</param> public GroupBoxPanel(Size size, Point location, Control parent) : this() { Size = SizeConfig.GetSize(size); Location = ControlConfig.GetLocation(location); Parent = ControlConfig.GetParent(parent); Parent.Controls.Add(this); }
private IControl BuildTextControl(ControlConfig controlConfig) { return(new TextControl() { ControlType = ControlType.Text, Text = controlConfig.Text }); }
public BindingConfigForm(Form _parentForm, ControlConfig _controlConfig) { InitializeComponent(); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); parentForm = _parentForm; controlConfig = _controlConfig; m_DefaultSize = new Size( Size.Width, Size.Height - defaultBindingControl.Size.Height - defaultBindingControl.Margin.Bottom * 2); InitializeTempConfig(); CopyConfig(controlConfig, m_TempControlConfig); UpdateBindingControls(); ProperResize(); var triggerBinding = m_TempControlConfig as TriggerConfig; var stickConfig = m_TempControlConfig as StickConfig; if (triggerBinding != null || stickConfig != null) { deadZoneLabel.Visible = true; deadZoneValueLabel.Visible = true; deadZoneTrackBar.Visible = true; deadZoneTrackBar.Value = (triggerBinding != null) ? (int)(triggerBinding.deadzone * 100f) : (int)Math.Round(stickConfig.moveDeadzone * 100f); deadZoneValueLabel.Text = deadZoneTrackBar.Value + @"%"; if (stickConfig != null) { actionZoneLabel.Visible = true; actionZoneValueLabel.Visible = true; actionZoneTrackBar.Visible = true; actionZoneTrackBar.Value = (int)(stickConfig.actionDeadzone * 100f); actionZoneValueLabel.Text = actionZoneTrackBar.Value + @"%"; modeLabel.Visible = true; modeComboBox.Visible = true; foreach (StickMode stickMode in Enum.GetValues(typeof(StickMode))) { modeComboBox.Items.Add(stickMode); } modeComboBox.SelectedItem = stickConfig.mode; } } m_Initialized = true; }
private IControl BuildHtmlControl(ControlConfig controlConfig) { return(new HtmlControl() { ControlType = ControlType.Html, Classes = controlConfig.Classes, HtmlElement = controlConfig.HtmlElement }); }
private IControl BuildListItemControl(ControlConfig controlConfig) { return(new ListItemControl() { ControlType = ControlType.ListItem, Classes = controlConfig.Classes, HtmlElement = controlConfig.HtmlElement }); }
/// <summary> /// Initializes a new instance of the /// <see cref="GroupBoxPanel" /> /// class. /// </summary> /// <param name="location">The location.</param> /// <param name="parent">The parent.</param> public GroupBoxPanel(Point location, Control parent = null) : this() { Location = ControlConfig.GetLocation(location); if (parent != null) { Parent = ControlConfig.GetParent(parent); Parent.Controls.Add(this); } }
private IControl BuildModelControl(ControlConfig controlConfig) { Property property = _modelRepository.GetProperty(controlConfig.PropertyId); return(new ModelControl() { ControlType = ControlType.Model, Model = property.Name, Classes = controlConfig.Classes }); }
private IControl BuildConditionalControl(ControlConfig controlConfig) { Conditional conditional = _modelRepository.GetConditional(controlConfig.ConditionalId); return(new ConditionalControl() { ControlType = ControlType.Conditional, FunctionName = conditional.Name, IsTrue = controlConfig.IsTrue }); }
/// <summary> /// Initializes a new instance of the /// <see cref="GroupBoxPanel" /> /// class. /// </summary> /// <param name="size">The size.</param> /// <param name="parent">The parent.</param> public GroupBoxPanel(Size size, Control parent = null) : this() { Size = SizeConfig.GetSize(size); if (parent != null) { Parent = ControlConfig.GetParent(parent); Parent.Controls.Add(this); } }
private void FrmSecurity_Load(Object sender, EventArgs e) { cmbCipher.DataSource = Enum.GetValues(typeof(CipherMode)); cmbPadding.DataSource = Enum.GetValues(typeof(PaddingMode)); cmbCipher.SelectedItem = CipherMode.CBC; cmbPadding.SelectedItem = PaddingMode.PKCS7; _config = new ControlConfig { Control = this, FileName = "Symmetric.json" }; _config.Load(); }
private IControl BuildPropertyControl(ControlConfig controlConfig) { Property property = _modelRepository.GetProperty(controlConfig.PropertyId); return(new PropertyControl() { ControlType = ControlType.Property, Property = property.Name, Classes = controlConfig.Classes, HtmlElement = controlConfig.HtmlElement }); }
void Start() { if (Instance) { return; } Instance = this; sensors = new SensorsConfig("sensors"); control = new ControlConfig("control"); DontDestroyOnLoad(this); }
private IControl BuildListControl(ControlConfig controlConfig) { Property property = _modelRepository.GetProperty(controlConfig.PropertyId); return(new ListControl() { ControlType = ControlType.List, ListName = property.Name, ItemName = property.Name.Substring(1, property.Name.Length - 1), Classes = controlConfig.Classes, }); throw new NotImplementedException(); }
/// <summary> /// /// </summary> public DBFramework() { InitializeComponent(); dbTable.SelectedItemChanged += dbTable_SelectedItemChanged; dgTable.LoadingRow += dgTable_LoadingRow; dgTable.CurrentCellChanged += dgTable_CurrentCellChanged; _ControlTypeItem.AddRange(ParseControlConfig.ControlItem.Where(p => p.IsDisplay).GetTList <ControlConfig>()); ControlConfig _cc = new ControlConfig(); _cc.Name = "--请选择--"; _cc.Description = "默认为(TextBox)控件"; _ControlTypeItem.Insert(0, _cc); }
/// <summary> /// Initializes a new instance of the <see cref="BudgetGridPanel"/> class. /// </summary> public BudgetGridPanel() { // Basic Properties ForeColor = Color.White; BackColor = ColorConfig.FormBackColorDark; Font = new Font("Roboto", 8, FontStyle.Bold); Margin = new Padding(0); Padding = new Padding(0); Size = SizeConfig.GetSize(700, 400); Location = ControlConfig.GetLocation(); Anchor = ControlConfig.GetAnchorStyle(); Dock = ControlConfig.GetDockStyle(); Font = FontConfig.FontSizeSmall; Visible = true; Enabled = true; // Model Properties Model.Rows.DefaultSize = 22; Model.ActiveGridView.PdfExport = true; Model.Properties.ThemedHeader = false; Model.Properties.GridLineColor = Color.FromArgb(64, 64, 64); // Style Properties ThemesEnabled = true; ApplyVisualStyles = true; GridVisualStyles = GridVisualStyles.Office2010Black; EnableAddNew = true; EnableEdit = true; EnableRemove = true; AllowResizeToFit = true; ExcelLikeSelectionFrame = true; ExcelLikeAlignment = true; AlphaBlendSelectionColor = ColorConfig.BorderColorYellow; Properties.BackgroundColor = ColorConfig.FormBackColorDark; Properties.CenterHorizontal = true; Properties.CenterVertical = true; Properties.ColHeaders = true; Properties.RowHeaders = true; Properties.Buttons3D = true; // Table Style Properties TableStyle.Themed = true; TableStyle.WrapText = false; TableStyle.HorizontalAlignment = GridHorizontalAlignment.Center; TableStyle.AutoFit = AutoFitOptions.Both; TableStyle.Font.Facename = "consolas"; TableStyle.Font.Size = 8; }
public bool LoadFromJson(int playerIndex) { if (File.Exists(this.jsonSaveFilePath + playerIndex + ".json")) { string jsonStringData = File.ReadAllText(this.jsonSaveFilePath + playerIndex + ".json"); this.controlConfing = JsonUtility.FromJson <ControlConfig>(jsonStringData); return(true); } else { this.controlConfing = new ControlConfig(); this.controlConfing.Initialisation(playerIndex); this.SaveToJson(playerIndex); return(false); } }
public void UpdateConfig(ControlConfig config) { if (!_ws.IsOpen) { Debug.LogWarning("WebSocket connection is not established."); return; } var payload = new ControlConfigWrapper { @event = Event.UPDATE_CONFIG, payload = config, }; _ws.Send(JsonConvert.SerializeObject(payload)); }
public static void LoadCurrentControlConfigIntoInputControl(ControlConfig config, InputControl2 inputControl) { if (config.Key != null) { inputControl.ControlLabel = string.Format("{0} + {1}", config.Key, config.MouseButton); } else { inputControl.ControlLabel = string.Format("{0}", config.MouseButton); } inputControl.AssignedKey = ConvertKey(config.Key); inputControl.AssignedButton = ConvertButton(config.MouseButton); }
private void LoadControlsFromFile(string path) { _path = path; string xml = File.ReadAllText(path); DataContractSerializer ser = new DataContractSerializer(typeof(ControlConfig)); MemoryStream mem = new MemoryStream(Encoding.ASCII.GetBytes(xml)); _controls = ser.ReadObject(mem) as ControlConfig; UpdateControlList(); }