// Not operator with overloading public void NotOperatorWithOverloading() { Expression <Func <ActivityContext, DummyHelper> > expression = (env) => !DummyHelper.Instance; Activity <DummyHelper> expectedActivity = new InvokeMethod <DummyHelper>() { MethodName = "op_LogicalNot", TargetType = typeof(DummyHelper), Parameters = { new InArgument <DummyHelper>( new FieldValue <DummyHelper, DummyHelper>() { FieldName = "Instance" }) } }; TestExpression expr = new TestExpression() { ResultType = typeof(DummyHelper), ExpectedNode = expectedActivity, ExpressionTree = expression }; ExpressionTestRuntime.ValidateExpressionXaml <DummyHelper>(expr); ExpressionTestRuntime.ValidateExecutionResult(expr, null, typeof(DummyHelper)); }
/// <summary> /// 执行 /// </summary> /// <param name="paramValues"></param> /// <returns></returns> public object Invoke(object[] paramValues) { var instance = Activator.CreateInstance(InstanceType); //找到正确的参数对应顺序 var parameterlist = InvokeMethod.GetParameters().Select(p => p.Name.ToLower()).ToList(); var matchs = _reg_brace_p_.Matches(Route); var l = new List <string>(); foreach (Match m in matchs) { var key = m.Value.ToLower().Replace("{", "").Replace("}", ""); l.Add(key); } var newp = new List <object>(); foreach (var item in parameterlist) { if (l.Contains(item)) { newp.Add(paramValues[l.IndexOf(item)]); } } if (HasParentParameter) { newp.Add(paramValues.Last()); } return(InvokeMethod.Invoke(instance, newp.ToArray())); }
public FUnitMeasureConversion() { Module = "Cadastros Iniciais"; ObjectControl = new List <UnitMeasureConversion>(); InvokeMethod = new InvokeMethod(typeof(UnitMeasureConversionController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListUnitMeasureConversion" } }, typeof(UnitMeasureConversion)); InitializeComponent(); TypeOperation.SetEnumItems <TypeOperation>(Core.Domain.EnumBase.TypeOperation.Multiplication); SecondUnitMeasureId.FormType = typeof(FUnitMeasure); SecondUnitMeasureId.ObjetoApp = new InvokeMethod(typeof(UnitMeasureController), TypeExecute.SearchAll, "ListUnitMeasure", typeof(UnitMeasure)); SecondUnitMeasureId.ValueMember = "Id"; SecondUnitMeasureId.DisplayMember = "Initials"; FamilyId.FormType = typeof(FFamily); FamilyId.ObjetoApp = new InvokeMethod(typeof(FamilyController), TypeExecute.SearchAll, "SearchAll", typeof(Family)); FamilyId.ValueMember = "Id"; FamilyId.DisplayMember = "FamilyName"; StockItemId.FormType = typeof(FStockItem); StockItemId.ObjetoApp = new InvokeMethod(typeof(StockItemController), TypeExecute.SearchAll, "SearchAll", typeof(StockItem)); StockItemId.ValueMember = "Id"; StockItemId.DisplayMember = "CodeDescription"; ImageSource = Properties.Resources.icon_unitMeasure; }
private void Invoke(OptionNode node, InvokeMethod method) { if (node == null) { return; } if (node.Option != null) { switch (method) { case InvokeMethod.Apply: node.Option.Apply(); break; case InvokeMethod.Reset: node.Option.Reset(); break; } } foreach (var child in node.Children) { this.Invoke(child, method); } }
public FVehicle() { Module = "Gestão de Frotas"; InvokeMethod = new InvokeMethod(typeof(VehicleController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListVehicle" } }, typeof(Vehicle)); ObjectControl = new List <Vehicle>(); InitializeComponent(); VehicleModelVehicles.ObjetoApp = new InvokeMethod(typeof(VehicleModelVehicleController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Search, "Search" } }, typeof(VehicleModelVehicle)); VehicleModelVehicles.ScreenSecondary = true; VehicleModelVehicles.IsDependecyUkey = false; VehicleModelVehicles.FormType = typeof(FModelVehicle); VehicleModelVehicles.Caption = "Modelos"; ImageSource = Properties.Resources.icon_vehicle; }
//public static void EmitInfoke() //{ //} #endregion #region PrepareEnvironment private static MethodInfo CreateMethodInfo(InvokeMethod obj) { var t = typeof(InvokeMethod); var m = t.GetMethod("Do"); return(m); }
public FParkingAgreement() { Module = "Estacionamento"; ObjectControl = new List <ParkingAgreement>(); InvokeMethod = new InvokeMethod(typeof(ParkingAgreementController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListParkingAgreement" } }, typeof(ParkingAgreement)); InitializeComponent(); Situation.SetEnumItems <Situation>(Core.Domain.EnumBase.Situation.Active); LegalPersonId.DisplayMember = "PersonName"; LegalPersonId.ValueMember = "Id"; LegalPersonId.ObjetoApp = new InvokeMethod(typeof(LegalPersonController), TypeExecute.SearchAll, "ListLegalPerson", typeof(LegalPerson)); LegalPersonId.FormType = typeof(FLegalPerson); ImageSource = Properties.Resources.Icon_Agreement; }
private void Form1_Load(object sender, EventArgs e) { var queryString = new Dictionary <string, string>(); queryString.Add("QS1", "參數1"); queryString.Add("QS2", "參數2"); hubConnection = new HubConnection("http://localhost:55500/", queryString); // 建立 Hub Proxy proxy = hubConnection.CreateHubProxy("broadcastHub"); // 建立 Invoke內容 InvokeMethod invoker = (name, message) => content.AppendText($"{name}:{message}\n"); //註冊給伺服端呼叫的方法 var sendMessageProxy = proxy.On <string, string>("SendMessage", (name, message) => content.Invoke(invoker, name, message) ); //取消註冊呼叫的方法 //sendMessageProxy.Dispose(); //增加Header hubConnection.Headers.Add("headerParameter", "parameter"); //註冊事件發生執行的方法 hubConnection.StateChanged += (x) => { content.AppendText("狀態改變了...目前狀態是:" + x.NewState + "\n"); }; //連線 SignalR Server;同時更換連線方式 hubConnection.Start(new LongPollingTransport()).Wait(); }
public static void LambdaInvoke() { var obj = new InvokeMethod(); var action = CreateLambda(); action.Invoke(obj, InvokeTimes); }
public FFunction() { ObjectControl = new List <Function>(); InvokeMethod = new InvokeMethod(typeof(FunctionController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListFunction" } }, typeof(Function)); InitializeComponent(); CboId.DisplayMember = "CboDescription"; CboId.ValueMember = "Id"; CboId.ObjetoApp = new InvokeMethod(typeof(CboController), TypeExecute.SearchAll, "ListCbo", typeof(Cbo)); TypePositionFunctionId.DisplayMember = "TypeOfficeFunctionDescription"; TypePositionFunctionId.ValueMember = "Id"; TypePositionFunctionId.ObjetoApp = new InvokeMethod(typeof(TypePositionFunctionController), TypeExecute.SearchAll, "ListTypePositionFunction", typeof(TypePositionFunction)); TypePositionFunctionId.FormType = typeof(FTypePositionFunction); NaturePositionFunctionId.DisplayMember = "NaturePositionFunctionDescription"; NaturePositionFunctionId.ValueMember = "Id"; NaturePositionFunctionId.ObjetoApp = new InvokeMethod(typeof(NaturePositionFunctionController), TypeExecute.SearchAll, "ListNaturePositionFunction", typeof(NaturePositionFunction)); NaturePositionFunctionId.FormType = typeof(FNaturePositionFunction); ImageSource = Properties.Resources.icon_schoolbag; }
public override void DrawCommandGUI() { base.DrawCommandGUI(); targetMethod = target as InvokeMethod; if (targetMethod == null || targetMethod.TargetObject == null) return; SerializedObject objSerializedTarget = new SerializedObject(targetMethod); string component = ShowComponents(objSerializedTarget, targetMethod.TargetObject); // show component methods if selected if (!string.IsNullOrEmpty(component)) { var method = ShowMethods(objSerializedTarget, targetMethod.TargetObject, component); // show method parameters if selected if (method != null) { objSerializedTarget.ApplyModifiedProperties(); ShowParameters(objSerializedTarget, targetMethod.TargetObject, method); ShowReturnValue(objSerializedTarget, method); } } }
public static void ReflectionInvoke() { var obj = new InvokeMethod(); var m = CreateMethodInfo(obj); m.Invoke(obj, new object[] { InvokeTimes }); }
public void InvokeForPaint(InvokeMethod m) { if (m_Thread == null || !Running) { return; } // special logic for painting invokes. Normally we want these to // go off immediately, but if we have a remote connection active // there could be slow operations on the pipe or currently being // processed. // So we check to see if the paint is likely to finish soon // (0, or only other paint invokes on the queue, nothing active) // and if so do it synchronously. Otherwise we just append to the // queue and return immediately. bool waitable = true; InvokeHandle cmd = new InvokeHandle(m); cmd.paintInvoke = true; lock (m_renderQueue) { InvokeHandle current = m_current; if (current != null && !current.paintInvoke) { waitable = false; } // any non-painting commands on the queue? can't wait for (int i = 0; waitable && i < m_renderQueue.Count; i++) { if (!m_renderQueue[i].paintInvoke) { waitable = false; } } m_renderQueue.Add(cmd); } m_WakeupEvent.Set(); if (!waitable) { return; } while (!cmd.processed) { ; } if (cmd.ex != null) { throw cmd.ex; } }
// Indexer public void RValueIndexer() { Expression <Func <ActivityContext, string> > lambda = (env) => DummyHelper.StaticDictionary[1]; Activity <string> expectedActivity = new InvokeMethod <string>() { MethodName = "get_Item", Parameters = { new InArgument <int>(1) { EvaluationOrder = 1 } }, TargetObject = new InArgument <Dictionary <int, string> >() { EvaluationOrder = 0, Expression = new FieldValue <DummyHelper, Dictionary <int, string> >() { FieldName = "StaticDictionary" } } }; TestExpression expr = new TestExpression() { ResultType = typeof(string), ExpectedNode = expectedActivity, ExpressionTree = lambda }; ExpressionTestRuntime.ValidateExpressionXaml <string>(expr); ExpressionTestRuntime.ValidateExecutionResult(expr, null); }
public FQuery() { InvokeMethod = new InvokeMethod(typeof(QueryController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListQuery" } }, typeof(Query)); ObjectControl = new List <Query>(); InitializeComponent(); Filters.ObjetoApp = new InvokeMethod(typeof(FilterController), TypeExecute.Search, "FiltersSearch", typeof(Filter)); Filters.IsDependecyUkey = true; Filters.ScreenSecondary = true; Filters.FormType = typeof(FFilter); Reports.ObjetoApp = new InvokeMethod(typeof(ReportController), TypeExecute.Search, "ReportsSearch", typeof(Report)); Reports.ScreenSecondary = true; Reports.IsDependecyUkey = true; Reports.FormType = typeof(FReport); Consults.ObjetoApp = new InvokeMethod(typeof(ConsultController), TypeExecute.Search, "ConsultSearch", typeof(Consult)); Consults.ScreenSecondary = true; Consults.IsDependecyUkey = true; Consults.FormType = typeof(FConsult); ImageSource = Properties.Resources.icon_sql; }
// Add two strings public void AddTwoStrings() { Expression <Func <ActivityContext, string> > expression = (env) => DummyHelper.StaticStringField1 + DummyHelper.StaticStringField2 + DummyHelper.StaticStringField3; Activity <string> expectedActivity = new InvokeMethod <string>() { MethodName = "Concat", TargetType = typeof(string), Parameters = { new InArgument <string>() { EvaluationOrder = 0, Expression = new InvokeMethod <string>() { MethodName = "Concat", TargetType = typeof(string), Parameters = { new InArgument <string>() { EvaluationOrder = 0, Expression = new FieldValue <DummyHelper, string>() { FieldName = "StaticStringField1" }, }, new InArgument <string>() { EvaluationOrder = 1, Expression = new FieldValue <DummyHelper, string>() { FieldName = "StaticStringField2" }, } } }, }, new InArgument <string>() { EvaluationOrder = 1, Expression = new FieldValue <DummyHelper, string>() { FieldName = "StaticStringField3" }, } } }; TestExpression expr = new TestExpression() { ResultType = typeof(string), ExpectedNode = expectedActivity, ExpressionTree = expression }; ExpressionTestRuntime.ValidateExpressionXaml <string>(expr); ExpressionTestRuntime.ValidateExecutionResult(expr, null); }
public static void DelegateInvoke() { var obj = new InvokeMethod(); var action = CreateDelegate(obj); action(InvokeTimes); }
public void DynamicInvokeTest2() { CodeTimer.Time("DynamicInvokeTest.Create", CreateTimes, () => { dynamic a = new InvokeMethod(); }); dynamic b = new InvokeMethod(); CodeTimer.Time("DynamicInvokeTest", InvokeTimes, () => b.Do(InvokeTimes)); }
public void Constructor_ShouldInitializePropertiesWithCorrectlyValues() { //ARRANGE const string query = "testQuery"; const int parameters = 43; Type resultType = typeof(double); const InvokeMethod invokeMethod = InvokeMethod.Execute; IDbConnection connection = A.Fake <IDbConnection>(); IDbCommand command = A.Fake <IDbCommand>(); IConfiguration configuration = A.Fake <IConfiguration>(); //ACT var context = new AdoExecutorContext(query, parameters, resultType, invokeMethod, connection, command, configuration); //ASSERT Assert.AreEqual(query, context.Query); Assert.AreEqual(parameters, context.Parameters); Assert.AreEqual(resultType, context.ResultType); Assert.AreEqual(invokeMethod, context.InvokeMethod); Assert.AreSame(connection, context.Connection); Assert.AreSame(command, context.Command); Assert.AreSame(configuration, context.Configuration); CollectionAssert.IsEmpty(context.Bag); }
private static JobAction CreateDelegateAction() { var obj = new InvokeMethod(); var action = Delegate.CreateDelegate(typeof(JobAction), obj, CreateMethodInfo(obj)) as JobAction; return(action); }
public FComposition() { Module = "Cadastros Iniciais"; InvokeMethod = new InvokeMethod(typeof(CompositionController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListComposition" } }, typeof(Composition)); ObjectControl = new List <Composition>(); InitializeComponent(); StockItemId.DisplayMember = "Description"; StockItemId.ValueMember = "Id"; StockItemId.ObjetoApp = new InvokeMethod(typeof(StockItemController), TypeExecute.SearchAll, "ListStockItem", typeof(StockItem)); StockItemId.FormType = typeof(FStockItem); UnitMeasureId.DisplayMember = "Initials"; UnitMeasureId.ValueMember = "Id"; UnitMeasureId.ObjetoApp = new InvokeMethod(typeof(UnitMeasureController), TypeExecute.SearchAll, "ListUnitMeasure", typeof(UnitMeasure)); UnitMeasureId.FormType = typeof(FUnitMeasure); ImageSource = Properties.Resources.ion_composition; }
public FConfAutNumbering() { ObjectControl = new List <AutomaticNumbering>(); InvokeMethod = new InvokeMethod(typeof(ConfAutNumeringController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListAutomaticNumering" } }, typeof(AutomaticNumbering)); InitializeComponent(); DbTableId.ObjetoApp = new InvokeMethod(typeof(DbTableController), new Dictionary <TypeExecute, string>() { { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListDbTable" } }, typeof(DbTable)); DbTableId.DisplayMember = "TableDescription"; DbTableId.ValueMember = "Id"; DbTableId.Caption = "Tabela"; AfterSave += UpdateAutomaticNumering; }
public FService() { Module = "Cadastros Iniciais"; InvokeMethod = new InvokeMethod(typeof(ServiceController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListService" } }, typeof(Service)); ObjectControl = new List <Service>(); InitializeComponent(); TypeServiceId.ValueMember = "Id"; TypeServiceId.DisplayMember = "Description"; TypeServiceId.ObjetoApp = new InvokeMethod(typeof(TypeServiceController), TypeExecute.SearchAll, "ListTypeService", typeof(TypeService)); TypeServiceId.FormType = typeof(FTypeService); TypeValueCommission.SetEnumItems <TypeValue>(TypeValue.Porcent); TypeValueProfit.SetEnumItems <TypeValue>(TypeValue.Porcent); ImageSource = Properties.Resources.icon_service; }
public FFilter() { InvokeMethod = new InvokeMethod(typeof(FilterController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListFilter" } }, typeof(Filter)); ObjectControl = new List <Filter>(); InitializeComponent(); QueryId.ObjetoApp = new InvokeMethod(typeof(QueryController), TypeExecute.SearchAll, "ListQuery", typeof(Query)); QueryId.DisplayMember = "Code"; QueryId.ValueMember = "Id"; QueryId.FormType = typeof(FQuery); TypeComponent.SetEnumItems <TypeFilterComponent>(TypeFilterComponent.TextBox); DefaultTypeFilter.SetEnumItems <TypeFilter>(TypeFilter.Equal); InactiveFilters.ObjetoApp = new InvokeMethod(typeof(InactiveFiltersController), TypeExecute.Search, "InactiveFiltersSearch", typeof(InactiveFilters)); InactiveFilters.ScreenSecondary = true; InactiveFilters.IsDependecyUkey = true; InactiveFilters.FormType = typeof(FInactiveFilters); ImageSource = Properties.Resources.icon_filter; }
public void TestInvokeStaticMethodAsyncInSequence() { var t1 = new Variable <int>("t1"); var a = new InvokeMethod <int>() { MethodName = "GetSomething", TargetType = this.GetType(), RunAsynchronously = true, Result = t1, }; var s = new System.Activities.Statements.Sequence() { Variables = { t1 }, Activities = { new Plus() { X = 2, Y = 3 }, a, new Multiply() { X = 3, Y = 7 }, }, }; var r = WorkflowInvoker.Invoke(s); System.Diagnostics.Debug.WriteLine("Something invoke"); //So all run in sequences. The async activity is not being executed in fire and forget style, but probably just good not freezing the UI thread if UI is involved. }
public FInputStock() { Module = "Cadastros Iniciais"; InvokeMethod = new InvokeMethod(typeof(InputStockController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListInputStock" } }, typeof(InputStock)); ObjectControl = new List <InputStock>(); InitializeComponent(); ProviderId.DisplayMember = "PersonName"; ProviderId.ValueMember = "Id"; ProviderId.ObjetoApp = new InvokeMethod(typeof(PersonController), TypeExecute.SearchAll, "ListPerson", typeof(Person)); ItemInputStocks.FormType = typeof(FItemInputStock); ItemInputStocks.IsDependecyUkey = true; ItemInputStocks.ScreenSecondary = true; ItemInputStocks.ObjetoApp = new InvokeMethod(typeof(ItemInputStockController), TypeExecute.Search, "Search", typeof(ItemInputStock)); ItemInputStocks.Caption = "Itens da entrada de materiais"; }
public FItemOutputStock() { Module = "Cadastros Iniciais"; InvokeMethod = new InvokeMethod(typeof(ItemOutputStockController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListItemOutputStock" } }, typeof(ItemOutputStock)); ObjectControl = new List <ItemOutputStock>(); InitializeComponent(); LocalStockId.DisplayMember = "LocalName"; LocalStockId.ValueMember = "Id"; LocalStockId.FormType = typeof(FLocalStock); LocalStockId.ObjetoApp = new InvokeMethod(typeof(LocalStockController), TypeExecute.SearchAll, "ListLocalStock", typeof(LocalStock)); StockItemId.DisplayMember = "Description"; StockItemId.ValueMember = "Id"; StockItemId.ObjetoApp = new InvokeMethod(typeof(StockItemController), TypeExecute.SearchAll, "ListStockItem", typeof(StockItem)); StockItemId.FormType = typeof(FInputStock); UnitMeasureId.FormType = typeof(FUnitMeasure); UnitMeasureId.ObjetoApp = new InvokeMethod(typeof(UnitMeasureController), TypeExecute.SearchAll, "ListUnitMeasure", typeof(UnitMeasure)); UnitMeasureId.ValueMember = "Id"; UnitMeasureId.DisplayMember = "Initials"; }
public FConsult() { InvokeMethod = new InvokeMethod(typeof(ConsultController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListConsult" } }, typeof(Consult)); ObjectControl = new List <Consult>(); InitializeComponent(); QueryId.ObjetoApp = new InvokeMethod(typeof(QueryController), TypeExecute.SearchAll, "ListQuery", typeof(Query)); QueryId.DisplayMember = "Code"; QueryId.ValueMember = "Id"; QueryId.FormType = typeof(FQuery); ConsultForms.ObjetoApp = new InvokeMethod(typeof(ConsultFormController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "Remove" }, { TypeExecute.RemoveListId, "Remove" }, { TypeExecute.Search, "SearchConsult" } }, typeof(ConsultForm)); ConsultForms.ScreenSecondary = true; ConsultForms.FormType = typeof(FTable); ImageSource = Properties.Resources.icon_query; }
public FOscontractorService() { Module = "Funerária"; InvokeMethod = new InvokeMethod(typeof(OsContractorServiceController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListOsContractorService" } }, typeof(OsContractorService)); ObjectControl = new List <OsContractorService>(); InitializeComponent(); ContractorId.DisplayMember = "PersonName"; ContractorId.ValueMember = "Id"; ContractorId.ObjetoApp = new InvokeMethod(typeof(ContractorController), TypeExecute.SearchAll, "ListContractor", typeof(Contractor)); ContractorId.FormType = typeof(FContractor); ContractorId.Caption = "Contratada"; ServiceId.ValueMember = "Id"; ServiceId.DisplayMember = "Description"; ServiceId.ObjetoApp = new InvokeMethod(typeof(ServiceController), TypeExecute.SearchAll, "ListService", typeof(Service)); ServiceId.FormType = typeof(FService); }
public FFamily() { Module = "Cadastros Iniciais"; ObjectControl = new List <Family>(); InvokeMethod = new InvokeMethod(typeof(FamilyController), new Dictionary <TypeExecute, string>() { { TypeExecute.InsertOrUpdate, "Save" }, { TypeExecute.Remove, "RemoveId" }, { TypeExecute.FindId, "FindId" }, { TypeExecute.Search, "Search" }, { TypeExecute.SearchAll, "ListFamily" } }, typeof(Family)); InitializeComponent(); TypeStructure.SetEnumItems <TypeStructure>(Core.Domain.EnumBase.TypeStructure.Sinthetic); OriginItem.SetEnumItems <OriginItem>(Core.Domain.EnumBase.OriginItem.Origin0); Families.FormType = typeof(FFamily); Families.ObjetoApp = new InvokeMethod(typeof(FamilyController), TypeExecute.Search, "Search", typeof(Family)); Families.ScreenSecondary = true; Families.IsDependecyUkey = true; Families.PropertyDependecyUkey = "FamilyMasterId"; Families.Caption = "Sub Familias"; ImageSource = Properties.Resources.icon_family_stock; }
public void DirectInvokeTest2() { var obj = new InvokeMethod(); CodeTimer.Time("DirectInvokeTest.Create", CreateTimes, () => new InvokeMethod()); CodeTimer.Time("DirectInvokeTest", InvokeTimes, () => obj.Do(InvokeTimes)); }
public FrmToolBase GetWindow(string uniqueId, InvokeMethod func) { // Look for an existing window with the specified uniqueId FrmToolBase form = this.FindExistingWindow(uniqueId); if (form == null) { form = (FrmToolBase)Assembly.GetExecutingAssembly().CreateInstance(uniqueId); form.MessageChanged += new FrmToolBase.MessageChangedEventHandler(func); form.FormClosed += new FormClosedEventHandler(form_FormClosed); this.RegisterWindow(form, uniqueId); } return form; }
// AddExpresion := UnaryExpression ('+' UnaryExpression)* private Expression DoParseAddExpression(List<string> locals) { Expression result; result = DoParseUnaryExpression(locals); while (m_scanner.Token.IsPunct("+")) { int line = m_scanner.Token.Line; m_scanner.Advance(); Expression rhs = DoParseUnaryExpression(locals); result = new InvokeMethod(line, result, "op_Add", new Expression[]{rhs}); } return result; }
public static LambdaParameterWrapper InvokeIndexer(object obj, object[] args) { if (obj == null) throw new NullReferenceException(String.Format("Indexer target is null")); if (obj is LambdaParameterWrapper) obj = ((LambdaParameterWrapper)obj).Value; var argsResolved = new object[args.Length]; for (int i = 0; i < args.Length; i++) argsResolved[i] = args[i] is LambdaParameterWrapper ? ((LambdaParameterWrapper)args[i]).Value : args[i]; if (obj is Array) { var objArr = (Array)obj; if (objArr.Rank != args.Length) { throw new RankException(String.Format("Array rank ({0}) doesn't match number of indicies ({1})", objArr.Rank, args.Length)); } var indicies = new int[argsResolved.Length]; for (int i = 0; i < argsResolved.Length; i++) indicies[i] = Convert.ToInt32(argsResolved[i]); var res = objArr.GetValue(indicies); return new LambdaParameterWrapper(res); } else { // indexer method var invoke = new InvokeMethod(obj, "get_Item"); var res = invoke.Invoke(argsResolved); return new LambdaParameterWrapper(res); } }
public void InvokeForPaint(InvokeMethod m) { if (m_Thread == null || !Running) return; // special logic for painting invokes. Normally we want these to // go off immediately, but if we have a remote connection active // there could be slow operations on the pipe or currently being // processed. // So we check to see if the paint is likely to finish soon // (0, or only other paint invokes on the queue, nothing active) // and if so do it synchronously. Otherwise we just append to the // queue and return immediately. bool waitable = true; InvokeHandle cmd = new InvokeHandle(m); cmd.paintInvoke = true; lock (m_renderQueue) { InvokeHandle current = m_current; if (current != null && !current.paintInvoke) waitable = false; // any non-painting commands on the queue? can't wait for (int i = 0; waitable && i < m_renderQueue.Count; i++) if (!m_renderQueue[i].paintInvoke) waitable = false; m_renderQueue.Add(cmd); } m_WakeupEvent.Set(); if (!waitable) return; while (!cmd.processed) ; if (cmd.ex != null) throw cmd.ex; }
// UnaryExpression := 'not'? CallExpression private Expression DoParseUnaryExpression(List<string> locals) { Expression result; bool notted = false; int line = m_scanner.Token.Line; if (m_scanner.Token.IsKeyword("not")) { m_scanner.Advance(); notted = true; } result = DoParseCallExpression(locals); if (notted) result = new InvokeMethod(line, result, "op_LogicalComplement", new Expression[0]); return result; }
internal BeginInvokeMethod( InvokeMethod invoke, TypeSymbol iAsyncResultType, TypeSymbol objectType, TypeSymbol asyncCallbackType, DelegateDeclarationSyntax syntax) : base((SourceNamedTypeSymbol)invoke.ContainingType, iAsyncResultType, syntax, MethodKind.Ordinary, DeclarationModifiers.Virtual | DeclarationModifiers.Public) { var parameters = ArrayBuilder<ParameterSymbol>.GetInstance(); foreach (SourceParameterSymbol p in invoke.Parameters) { var synthesizedParam = new SourceClonedParameterSymbol(originalParam: p, newOwner: this, newOrdinal: p.Ordinal, suppressOptional: true); parameters.Add(synthesizedParam); } int paramCount = invoke.ParameterCount; parameters.Add(new SynthesizedParameterSymbol(this, asyncCallbackType, paramCount, RefKind.None, GetUniqueParameterName(parameters, "callback"))); parameters.Add(new SynthesizedParameterSymbol(this, objectType, paramCount + 1, RefKind.None, GetUniqueParameterName(parameters, "object"))); InitializeParameters(parameters.ToImmutableAndFree()); }
internal EndInvokeMethod( InvokeMethod invoke, TypeSymbol iAsyncResultType, DelegateDeclarationSyntax syntax) : base((SourceNamedTypeSymbol)invoke.ContainingType, invoke.ReturnType, syntax, MethodKind.Ordinary, DeclarationModifiers.Virtual | DeclarationModifiers.Public) { var parameters = ArrayBuilder<ParameterSymbol>.GetInstance(); int ordinal = 0; foreach (SourceParameterSymbol p in invoke.Parameters) { if (p.RefKind != RefKind.None) { var synthesizedParam = new SourceClonedParameterSymbol(originalParam: p, newOwner: this, newOrdinal: ordinal++, suppressOptional: true); parameters.Add(synthesizedParam); } } parameters.Add(new SynthesizedParameterSymbol(this, iAsyncResultType, ordinal++, RefKind.None, GetUniqueParameterName(parameters, "result"))); InitializeParameters(parameters.ToImmutableAndFree()); }
internal static void AddDelegateMembers( SourceMemberContainerTypeSymbol delegateType, ArrayBuilder<Symbol> symbols, DelegateDeclarationSyntax syntax, DiagnosticBag diagnostics) { Binder binder = delegateType.GetBinder(syntax.ParameterList); TypeSymbol returnType = binder.BindType(syntax.ReturnType, diagnostics); // reuse types to avoid reporting duplicate errors if missing: var voidType = binder.GetSpecialType(SpecialType.System_Void, diagnostics, syntax); var objectType = binder.GetSpecialType(SpecialType.System_Object, diagnostics, syntax); var intPtrType = binder.GetSpecialType(SpecialType.System_IntPtr, diagnostics, syntax); if (returnType.IsRestrictedType()) { // Method or delegate cannot return type '{0}' diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, syntax.ReturnType.Location, returnType); } // A delegate has the following members: (see CLI spec 13.6) // (1) a method named Invoke with the specified signature var invoke = new InvokeMethod(delegateType, returnType, syntax, binder, diagnostics); invoke.CheckDelegateVarianceSafety(diagnostics); symbols.Add(invoke); // (2) a constructor with argument types (object, System.IntPtr) symbols.Add(new Constructor(delegateType, voidType, objectType, intPtrType, syntax)); if (binder.Compilation.GetSpecialType(SpecialType.System_IAsyncResult).TypeKind != TypeKind.Error && binder.Compilation.GetSpecialType(SpecialType.System_AsyncCallback).TypeKind != TypeKind.Error && // WinRT delegates don't have Begin/EndInvoke methods !delegateType.IsCompilationOutputWinMdObj()) { var iAsyncResultType = binder.GetSpecialType(SpecialType.System_IAsyncResult, diagnostics, syntax); var asyncCallbackType = binder.GetSpecialType(SpecialType.System_AsyncCallback, diagnostics, syntax); // (3) BeginInvoke symbols.Add(new BeginInvokeMethod(invoke, iAsyncResultType, objectType, asyncCallbackType, syntax)); // and (4) EndInvoke methods symbols.Add(new EndInvokeMethod(invoke, iAsyncResultType, syntax)); } if (delegateType.DeclaredAccessibility <= Accessibility.Private) { return; } HashSet<DiagnosticInfo> useSiteDiagnostics = null; if (!delegateType.IsNoMoreVisibleThan(invoke.ReturnType, ref useSiteDiagnostics)) { // Inconsistent accessibility: return type '{1}' is less accessible than delegate '{0}' diagnostics.Add(ErrorCode.ERR_BadVisDelegateReturn, delegateType.Locations[0], delegateType, invoke.ReturnType); } foreach (var parameter in invoke.Parameters) { if (!parameter.Type.IsAtLeastAsVisibleAs(delegateType, ref useSiteDiagnostics)) { // Inconsistent accessibility: parameter type '{1}' is less accessible than delegate '{0}' diagnostics.Add(ErrorCode.ERR_BadVisDelegateParam, delegateType.Locations[0], delegateType, parameter.Type); } } diagnostics.Add(delegateType.Locations[0], useSiteDiagnostics); }
/// <summary> /// Switches the domain with specified domain switch effect. /// </summary> /// <param name="domain">The new domain.</param> /// <param name="switchEffect">The switch effect.</param> /// <param name="timeToSwitch">The time to switch.</param> public void SetScene(Scene scene, ISceneSwitchEffect switchEffect, float timeToSwitch) { if (null == scene) throw new ArgumentNullException("scene"); waitFrame += () => { if (null != switchEffect) { StartEffect(switchEffect, timeToSwitch); } if (_sceneStack.Count > 0) { var pop = _sceneStack.Pop(); pop.Deactivate(); pop.DeactivateResource(); } //change domain _sceneStack.Push(scene); //invoke activate for new domain... if (null != scene) { scene.BindService = this.Services; scene.ActivateResource(); scene.Activate(); } }; }
public static LambdaParameterWrapper InvokeMethod(object obj, string methodName, object[] args) { if (obj is LambdaParameterWrapper) obj = ((LambdaParameterWrapper)obj).Value; if (obj == null) throw new NullReferenceException(String.Format("Method {0} target is null", methodName)); var argsResolved = new object[args.Length]; for (int i = 0; i < args.Length; i++) argsResolved[i] = args[i] is LambdaParameterWrapper ? ((LambdaParameterWrapper)args[i]).Value : args[i]; var invoke = new InvokeMethod(obj, methodName); var res = invoke.Invoke(argsResolved); return new LambdaParameterWrapper(res); }
public InvokeHandle(InvokeMethod m) { method = m; processed = false; }
public RegistryMethod(string name, RegistryItem parent, InvokeMethod method) : base(name, parent) { this.Method = method; }
public void Invoke(InvokeMethod m) { InvokeHandle cmd = new InvokeHandle(m); PushInvoke(cmd); while (!cmd.processed) ; }
private void Invoke(OptionNode node, InvokeMethod method) { if(node == null) return; if(node.Option != null) { switch(method) { case InvokeMethod.Apply: node.Option.Apply(); break; case InvokeMethod.Reset: node.Option.Reset(); break; } } foreach(var child in node.Children) this.Invoke(child, method); }
/// <summary> /// 注册一个其他非基础的增删改工作单元仓储接口 /// </summary> /// <param name="entity">待操作实体接口</param> /// <param name="methodName">自定义委托</param> public void RegisterInvokeMethod(IEntity entity, InvokeMethod methodName) { this.m_invokeEntities.Add(entity, methodName); }
public static void Invoke(this MonoBehaviour behaviour, InvokeMethod method, float time){ behaviour.Invoke(method.Method.Name, time); }
// EqualityExpression = RelationalExpression (('==' | '!=') RelationalExpression)? private Expression DoParseEqualityExpression(List<string> locals) { Expression result; result = DoParseRelationalExpression(locals); if (m_scanner.Token.IsPunct("==")) { int line = m_scanner.Token.Line; m_scanner.Advance(); Expression rhs = DoParseRelationalExpression(locals); result = new InvokeMethod(line, result, "op_Equals", new Expression[]{rhs}); } else if (m_scanner.Token.IsPunct("!=")) { int line = m_scanner.Token.Line; m_scanner.Advance(); Expression rhs = DoParseRelationalExpression(locals); result = new InvokeMethod(line, result, "op_NotEquals", new Expression[]{rhs}); } return result; }
protected override void Draw(GameTime gameTime) { base.Draw(gameTime); var device = graphics.GraphicsDevice; if (waitFrame != null) { device.SetRenderTarget(_effectTarget); DrawContent(device, gameTime); device.SetRenderTarget(null); waitFrame(); waitFrame = null; } if (_switchEffectPlayer != null) { device.SetRenderTarget(_effectTarget); DrawContent(device, gameTime); device.SetRenderTarget(null); //draw domain through effect or some else... //if (_switchEffectPlayer != null) //{ //device.SetRenderTarget(_effectTarget); _switchEffectPlayer.Draw(canvas); //device.SetRenderTarget(null); //} //else //{ // canvas.Begin(); // canvas.Draw(_effectTarget, _effectTarget.Bounds, Color.Blue); // canvas.End(); //} } else { device.SetRenderTarget(null); DrawContent(device, gameTime); } }
// MethodCall := Identifier ActualArgs? private Expression DoParseMethodCall(int line, List<string> locals, Expression target) { Expression result; string name = DoParseIdentifier("for a method or property name"); if (m_scanner.Token.IsPunct("(")) { Expression[] args = DoParseActualArgs(locals, name); result = new InvokeMethod(line, target, name, args); } else { result = new InvokeMethod(line, target, "get_" + name, new Expression[0]); } return result; }
// OrExpression = AndExpression ('or' AndExpression)* private Expression DoParseOrExpression(List<string> locals) { Expression result; result = DoParseAndExpression(locals); while (m_scanner.Token.IsKeyword("or")) { int line = m_scanner.Token.Line; m_scanner.Advance(); Expression rhs = DoParseAndExpression(locals); result = new InvokeMethod(line, result, "op_LogicalOr", new Expression[]{rhs}); } return result; }
public void Invoke(InvokeMethod m) { InvokeHandle cmd = new InvokeHandle(m); PushInvoke(cmd); while (!cmd.processed) ; if (cmd.ex != null) throw cmd.ex; }
// RelationalExpression = AddExpresion ('is' Identifier)? private Expression DoParseRelationalExpression(List<string> locals) { Expression result; result = DoParseAddExpression(locals); if (m_scanner.Token.IsKeyword("is")) { int line = m_scanner.Token.Line; m_scanner.Advance(); Expression type = new TypeName(line, DoParseIdentifier("for the is expression")); result = new InvokeMethod(line, result, "op_IsType", new Expression[]{type}); } return result; }
public void BeginInvoke(InvokeMethod m) { InvokeHandle cmd = new InvokeHandle(m); PushInvoke(cmd); }
/// <summary> /// Pops the domain. Activating previous one removing top. /// </summary> /// <param name="switchEffect">The switch effect.</param> /// <param name="timeToSwitch">The time to switch.</param> public void PopScene(ISceneSwitchEffect switchEffect, float timeToSwitch) { if (_sceneStack.Count > 0) { waitFrame += () => { var pop = _sceneStack.Pop(); pop.Deactivate(); pop.DeactivateResource(); if (null != switchEffect) { StartEffect(switchEffect, timeToSwitch); } if (_sceneStack.Count > 0) { var scene = _sceneStack.Peek(); scene.ActivateResource(); scene.Activate(); } }; } else { throw new InvalidOperationException("Unable to pop scene. Scene stack is empty."); } }