public void TestBoolParam() { var sparam = new BoolParam("myname", false); var sparam2 = (BoolParam) sparam.ToXmlAndBack(); Assert.AreEqual(sparam.Value, sparam2.Value); Assert.AreEqual(sparam.Name, sparam2.Name); }
private void Awake() { transitioner = GetComponent <Transitioner>(); mainTrans = mainCanvas.GetComponent <Transitionable>(); connectTrans = connectCanvas.GetComponent <Transitionable>(); onLobbyErrorListener = new Action <IEventParam>( (e) => { connectText.text = "Error: " + ((StringParam)e).val; errorConfirmButton.gameObject.SetActive(true); }); onTryConnectListener = new Action <IEventParam>( (e) => { IpParam p = (IpParam)e; connectText.text = (p.host) ? "Hosting match" : "Connecting to " + p.ip; }); onTryConnectTimeoutListener = new Action <IEventParam>( (e) => { BoolParam p = (BoolParam)e; connectText.text = "Failed to Connect"; errorConfirmButton.gameObject.SetActive(true); }); connectListener = new Action <IEventParam>( (e) => { connectText.text = "Starting match..."; EventManager.Instance.Raise("request-scene", new IntParam(2)); }); }
public DebugMonitor() { filterPid = new NumberParam("Filter PID", 0); filterText = new TextParam("Filter Text", ""); listen = new BoolParam("Listen", true); parameters = new IParam[] { listen, filterPid, filterText }; }
public void Set(NetAnimator animator) { if (Animations == null) { FDebug.Log.Message("animator was null, trying to reset it"); Animations = GetComponent <Animator>(); return; } foreach (NetAnimationParam component in animator.Parameters) { if (component is BoolParam) { BoolParam boolio = component as BoolParam; Animations.SetBool(boolio.Name, boolio.State); } else if (component is FloatParam) { FloatParam floatio = component as FloatParam; Animations.SetFloat(floatio.Name, floatio.State); } else if (component is IntigerParam) { IntigerParam intelio = component as IntigerParam; Animations.SetInteger(intelio.Name, intelio.State); } else if (component is TriggerParam) { TriggerParam triggero = component as TriggerParam; Animations.SetTrigger(triggero.Name); } } }
public BoolControl(BoolParam param) : base(param) { this.param = param; InitializeComponent(); this.checkBox1.Text = this.param.Label; UpdateControlValue(); }
public void TestBoolParam() { BoolParam sparam = new BoolParam("myname", false); BoolParam sparam2 = (BoolParam)sparam.ToXmlAndBack(); Assert.AreEqual(sparam.Value, sparam2.Value); Assert.AreEqual(sparam.Name, sparam2.Name); }
public TestWindows() { windows = new List <WindowInfo>(); xyParam = new CoOrdinatesParam(); printParent = new BoolParam("Print Parent", false); printChildren = new BoolParam("Print Children", false); filter = new TextParam("Filter", ""); allTopWins = new BoolParam("-Only Print TopWindows", false); parameters = new IParam[] { xyParam, printParent, printChildren, allTopWins, filter }; }
public BoolParam AddBoolParam(string paramName, bool paramValue) { if (!DoseParamExist(paramName)) { var newParam = new BoolParam(paramName, paramValue); _parameters.Add(paramName, newParam); return(newParam); } LogKeyConfliction(paramName); return(null); }
public TestProcess() { //pidParam = new NumberParam("PID", 0); filterModuleParam = new TextParam("Filter", ""); showFilePath = new BoolParam("File Path", false); showDesc = new BoolParam("Description", false); showComments = new BoolParam("Comments", false); showVersion = new BoolParam("Version", false); showCompany = new BoolParam("Company", false); showMemory = new BoolParam("Memory", false); parameters = new IParam[] { xyParam, /*pidParam,*/ filterModuleParam, showFilePath, showVersion, showDesc, showCompany, showMemory, showComments }; }
public static NetAnimator Animator(Animator animator) { NetAnimator netAnimator = new NetAnimator(); netAnimator.Parameters = new NetAnimationParam[animator.parameters.Length]; for (int j = 0; j < animator.parameters.Length; j++) { switch (animator.parameters[j].type) { case AnimatorControllerParameterType.Bool: { BoolParam animBool = new BoolParam(); animBool.Name = animator.parameters[j].name; animBool.State = animator.GetBool(animator.parameters[j].name); netAnimator.Parameters[j] = animBool; continue; } case AnimatorControllerParameterType.Float: { FloatParam animfloat = new FloatParam(); animfloat.Name = animator.parameters[j].name; animfloat.State = animator.GetFloat(animator.parameters[j].name); netAnimator.Parameters[j] = animfloat; continue; } case AnimatorControllerParameterType.Trigger: { TriggerParam animtrigger = new TriggerParam(); animtrigger.Name = animator.parameters[j].name; animtrigger.State = animator.parameters[j].defaultBool; netAnimator.Parameters[j] = animtrigger; continue; } case AnimatorControllerParameterType.Int: { IntigerParam animint = new IntigerParam(); animint.Name = animator.parameters[j].name; animint.State = animator.GetInteger(animator.parameters[j].name); netAnimator.Parameters[j] = animint; continue; } } } return(netAnimator); }
private void buttonPrepareExport_Click(object sender, EventArgs e) { if (cbProcNames.Items.Count > 0) { List <ReportParamV2> paramList = new List <ReportParamV2>(); Dictionary <string, string> parameters = ServicesProvider.GetInstance().GetAccountingServices().SelectExportAccountingProcParams("ExportAccounting_" + cbProcNames.Text); if (parameters != null && parameters.Count > 0) { foreach (var parameter in parameters) { ReportParamV2 reportParam; string paramName = parameter.Key.TrimStart('@'); if (paramName.Equals("branch_id", StringComparison.CurrentCultureIgnoreCase)) { reportParam = new BranchParam(string.Empty); } else { string paramType = parameter.Value; switch (paramType) { case "bit": reportParam = new BoolParam(false); break; case "datetime": reportParam = new DateParam(DateTime.Today); break; case "char": reportParam = new CharParam(' '); break; case "nvarchar": case "varchar": case "text": reportParam = new StringParam(string.Empty); break; case "int": reportParam = new IntParam(1); break; case "float": reportParam = new DoubleParam(1d); break; case "money": reportParam = new DecimalParam(1m); break; default: throw new NotImplementedException(string.Format("Sql type:{0} is not handled.", paramName)); } } reportParam.Label = paramName; reportParam.Name = paramName; paramList.Add(reportParam); } ReportParamsForm frm = new ReportParamsForm(paramList, cbProcNames.Text); frm.ShowDialog(); } _dataTable = ServicesProvider.GetInstance().GetAccountingServices().FindElementaryMvtsToExport( "ExportAccounting_" + cbProcNames.Text, paramList, out _idTable); _total = _dataTable.Rows.Count; _bwSelect = new BackgroundWorker { WorkerSupportsCancellation = true }; _bwSelect.DoWork += BwSelect_DoWork; ExportBookings_Load(this, null); } }
private static extern void checkbox(string label, ref BoolParam param);
/// <summary> /// Convert <see cref="BaseLib.Param"/> to <see cref="BaseLibS.Param"/> /// </summary> /// <param name="p"></param> /// <returns></returns> public static Parameter Convert(Parameter p) { if (p.Type == ParamType.Server) { return(p); } if (p is RegexReplaceParamWf) { RegexReplaceParamWf q = (RegexReplaceParamWf)p; RegexReplaceParam b = new RegexReplaceParam(q.Name, q.Value.Item1, q.Value.Item2, q.Previews) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is RegexMatchParamWf) { RegexMatchParamWf q = (RegexMatchParamWf)p; RegexMatchParam b = new RegexMatchParam(q.Name, q.Value, q.Previews) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is BoolParamWf) { BoolParamWf q = (BoolParamWf)p; BoolParam b = new BoolParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is BoolWithSubParamsWf) { BoolWithSubParamsWf q = (BoolWithSubParamsWf)p; q.SubParamsFalse?.Convert(Convert); q.SubParamsTrue?.Convert(Convert); BoolWithSubParams b = new BoolWithSubParams(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, SubParamsFalse = q.SubParamsFalse, SubParamsTrue = q.SubParamsTrue, Default = q.Default, ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is DictionaryIntValueParamWf) { DictionaryIntValueParamWf q = (DictionaryIntValueParamWf)p; DictionaryIntValueParam b = new DictionaryIntValueParam(q.Name, q.Value, q.Keys) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is DoubleParamWf) { DoubleParamWf q = (DoubleParamWf)p; DoubleParam b = new DoubleParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is FileParamWf) { FileParamWf q = (FileParamWf)p; FileParam b = new FileParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Filter = q.Filter, ProcessFileName = q.ProcessFileName, Save = q.Save, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is FolderParamWf) { FolderParamWf q = (FolderParamWf)p; FolderParam b = new FolderParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is IntParamWf) { IntParamWf q = (IntParamWf)p; IntParam b = new IntParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is LabelParamWf) { LabelParamWf q = (LabelParamWf)p; LabelParam b = new LabelParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiChoiceMultiBinParamWf) { MultiChoiceMultiBinParamWf q = (MultiChoiceMultiBinParamWf)p; MultiChoiceMultiBinParam b = new MultiChoiceMultiBinParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Values = q.Values, Bins = q.Bins, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiChoiceParamWf) { MultiChoiceParamWf q = (MultiChoiceParamWf)p; MultiChoiceParam b = new MultiChoiceParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Repeats = q.Repeats, Values = q.Values, Default = q.Default, DefaultSelections = q.DefaultSelections, DefaultSelectionNames = q.DefaultSelectionNames, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiFileParamWf) { MultiFileParamWf q = (MultiFileParamWf)p; MultiFileParam b = new MultiFileParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Filter = q.Filter, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is MultiStringParamWf) { MultiStringParamWf q = (MultiStringParamWf)p; MultiStringParam b = new MultiStringParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is SingleChoiceParamWf) { SingleChoiceParamWf q = (SingleChoiceParamWf)p; SingleChoiceParam b = new SingleChoiceParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is SingleChoiceWithSubParamsWf) { SingleChoiceWithSubParamsWf q = (SingleChoiceWithSubParamsWf)p; foreach (Parameters param in q.SubParams) { param?.Convert(Convert); } SingleChoiceWithSubParams b = new SingleChoiceWithSubParams(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, SubParams = new Parameters[q.SubParams.Count], ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; for (int i = 0; i < q.SubParams.Count; i++) { b.SubParams[i] = q.SubParams[i]; } foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is StringParamWf) { StringParamWf q = (StringParamWf)p; StringParam b = new StringParam(q.Name, q.Value) { Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } if (p is Ms1LabelParamWf) { Ms1LabelParamWf q = (Ms1LabelParamWf)p; Ms1LabelParam b = new Ms1LabelParam(q.Name, q.Value) { Values = q.Values, Multiplicity = q.Multiplicity, Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()) { b.ValueChanged += act; } return(b); } throw new Exception("Could not convert ParamWfeter"); }
/// <summary> /// Convert <see cref="BaseLib.Param"/> to <see cref="BaseLibS.Param"/> /// </summary> /// <param name="p"></param> /// <returns></returns> public static Parameter Convert(Parameter p) { if (p.Type == ParamType.Server){ return p; } if (p is RegexReplaceParamWf){ RegexReplaceParamWf q = (RegexReplaceParamWf) p; RegexReplaceParam b = new RegexReplaceParam(q.Name, q.Value.Item1, q.Value.Item2, q.Previews){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is RegexMatchParamWf){ RegexMatchParamWf q = (RegexMatchParamWf) p; RegexMatchParam b = new RegexMatchParam(q.Name, q.Value, q.Previews){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is BoolParamWf){ BoolParamWf q = (BoolParamWf) p; BoolParam b = new BoolParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is BoolWithSubParamsWf){ BoolWithSubParamsWf q = (BoolWithSubParamsWf) p; q.SubParamsFalse?.Convert(Convert); q.SubParamsTrue?.Convert(Convert); BoolWithSubParams b = new BoolWithSubParams(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, SubParamsFalse = q.SubParamsFalse, SubParamsTrue = q.SubParamsTrue, Default = q.Default, ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is DictionaryIntValueParamWf){ DictionaryIntValueParamWf q = (DictionaryIntValueParamWf) p; DictionaryIntValueParam b = new DictionaryIntValueParam(q.Name, q.Value, q.Keys){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is DoubleParamWf){ DoubleParamWf q = (DoubleParamWf) p; DoubleParam b = new DoubleParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is FileParamWf){ FileParamWf q = (FileParamWf) p; FileParam b = new FileParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Filter = q.Filter, ProcessFileName = q.ProcessFileName, Save = q.Save, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is FolderParamWf){ FolderParamWf q = (FolderParamWf) p; FolderParam b = new FolderParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is IntParamWf){ IntParamWf q = (IntParamWf) p; IntParam b = new IntParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is LabelParamWf){ LabelParamWf q = (LabelParamWf) p; LabelParam b = new LabelParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiChoiceMultiBinParamWf){ MultiChoiceMultiBinParamWf q = (MultiChoiceMultiBinParamWf) p; MultiChoiceMultiBinParam b = new MultiChoiceMultiBinParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Values = q.Values, Bins = q.Bins, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiChoiceParamWf){ MultiChoiceParamWf q = (MultiChoiceParamWf) p; MultiChoiceParam b = new MultiChoiceParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Repeats = q.Repeats, Values = q.Values, Default = q.Default, DefaultSelections = q.DefaultSelections, DefaultSelectionNames = q.DefaultSelectionNames, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiFileParamWf){ MultiFileParamWf q = (MultiFileParamWf) p; MultiFileParam b = new MultiFileParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Filter = q.Filter, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is MultiStringParamWf){ MultiStringParamWf q = (MultiStringParamWf) p; MultiStringParam b = new MultiStringParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is SingleChoiceParamWf){ SingleChoiceParamWf q = (SingleChoiceParamWf) p; SingleChoiceParam b = new SingleChoiceParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is SingleChoiceWithSubParamsWf){ SingleChoiceWithSubParamsWf q = (SingleChoiceWithSubParamsWf) p; foreach (Parameters param in q.SubParams){ param?.Convert(Convert); } SingleChoiceWithSubParams b = new SingleChoiceWithSubParams(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Values = q.Values, Default = q.Default, SubParams = new Parameters[q.SubParams.Count], ParamNameWidth = q.ParamNameWidth, TotalWidth = q.TotalWidth, Url = q.Url }; for (int i = 0; i < q.SubParams.Count; i++){ b.SubParams[i] = q.SubParams[i]; } foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is StringParamWf){ StringParamWf q = (StringParamWf) p; StringParam b = new StringParam(q.Name, q.Value){ Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } if (p is Ms1LabelParamWf){ Ms1LabelParamWf q = (Ms1LabelParamWf) p; Ms1LabelParam b = new Ms1LabelParam(q.Name, q.Value){ Values = q.Values, Multiplicity = q.Multiplicity, Help = q.Help, Visible = q.Visible, Default = q.Default, Url = q.Url }; foreach (ValueChangedHandler act in q.GetPropertyChangedHandlers()){ b.ValueChanged += act; } return b; } throw new Exception("Could not convert ParamWfeter"); }
public ClockTest() { start = new BoolParam("Run Clock", true); parameters = new IParam[] { start }; }