当前位置: 首页>>代码示例>>C#>>正文


C# Action.DynamicInvoke方法代码示例

本文整理汇总了C#中System.Action.DynamicInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# Action.DynamicInvoke方法的具体用法?C# Action.DynamicInvoke怎么用?C# Action.DynamicInvoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Action的用法示例。


在下文中一共展示了Action.DynamicInvoke方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DispatchMethod

 public void DispatchMethod(Action method)
 {
     if (CurrentDispatcher.CheckAccess())
         method.DynamicInvoke();
     else
         CurrentDispatcher.BeginInvoke(method);
 }
开发者ID:FoundOPS,项目名称:server,代码行数:7,代码来源:ThreadableVM.cs

示例2: LoadAgain

 public static void LoadAgain(string url, Action a)
 {
     if (LoadRes(url) == null) {
         a.DynamicInvoke();
     } else {
         return;
     }
 }
开发者ID:caoqiwen2001,项目名称:unity,代码行数:8,代码来源:ResLoad.cs

示例3: ThrownBy

        public static SpecificationConstraintBuilder ThrownBy(Action action)
        {
            if (action == null)
                throw new ArgumentNullException("action");

            try
            {
                action.DynamicInvoke();
                return RegisterNewConstraintBuilder(null);
            }
            catch (TargetInvocationException outerException)
            {
                return RegisterNewConstraintBuilder(outerException.InnerException);
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:15,代码来源:Specify.cs

示例4: ShowProgressWorker

        /*
        void ShowProgressWorker(string cancelCaption, Delegate cancelCallback, float progress = -1, string status = null, MaskType maskType = MaskType.None){
            CancelHudButton.SetTitle(cancelCaption, UIControlState.Normal);
            CancelHudButton.TouchUpInside += delegate {
                BTProgressHUD.Dismiss();
                if(cancelCallback != null){
                    cancelCallback.DynamicInvoke(null);
                }
            };
            UpdatePosition();
            ShowProgressWorker(progress, status, maskType);
        }
        */
        void ShowProgressWorker(float progress = -1, string status = null, MaskType maskType = MaskType.None, bool textOnly = false, bool showToastCentered = true, string cancelCaption = null, Action cancelCallback = null)
        {
            if (OverlayView.Superview == null)
                UIApplication.SharedApplication.KeyWindow.AddSubview (OverlayView);

            if (Superview == null)
                OverlayView.AddSubview (this);

            _fadeoutTimer = null;
            ImageView.Hidden = true;
            _maskType = maskType;
            _progress = progress;

            StringLabel.Text = status;

            if(!string.IsNullOrEmpty(cancelCaption)){
                CancelHudButton.SetTitle(cancelCaption, UIControlState.Normal);
                CancelHudButton.TouchUpInside += delegate {
                    BTProgressHUD.Dismiss();
                    if(cancelCallback != null){
                        obj.InvokeOnMainThread (() => cancelCallback.DynamicInvoke(null));
                        //cancelCallback.DynamicInvoke(null);
                    }
                };
            }

            UpdatePosition (textOnly);

            if(progress >= 0)
            {
                ImageView.Image = null;
                ImageView.Hidden = false;
                SpinnerView.StopAnimating();
                RingLayer.StrokeEnd = progress;
            } else if (textOnly)
            {
                CancelRingLayerAnimation();
                SpinnerView.StopAnimating();
            } else
            {
                CancelRingLayerAnimation();
                SpinnerView.StartAnimating();
            }

            if(maskType != MaskType.None) {
                OverlayView.UserInteractionEnabled = true;
                //AccessibilityLabel = status;
                //IsAccessibilityElement = true;
            }
            else {
                OverlayView.UserInteractionEnabled = true;
                //hudView.IsAccessibilityElement = true;
            }

            OverlayView.Hidden = false;
            this.showToastCentered = showToastCentered;
            PositionHUD (null);

            if (Alpha != 1)
            {
                RegisterNotifications ();
                HudView.Transform.Scale (1.3f, 1.3f);

                UIView.Animate (0.15f, 0,
                                UIViewAnimationOptions.AllowUserInteraction | UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.BeginFromCurrentState,
                                delegate {
                    HudView.Transform.Scale ((float)1 / 1.3f, (float)1f / 1.3f);
                    Alpha = 1;
                }, delegate {
                    //UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, string);

                    if (textOnly) StartDismissTimer(new TimeSpan(0,0,1));
                });

                SetNeedsDisplay();
            }
        }
开发者ID:jivkopetiov,项目名称:StackApp,代码行数:90,代码来源:BTProgressHUD.cs

示例5: PostImageAsync

 public async Task PostImageAsync(string encodedImage, Action callback)
 {
     await PostImage(encodedImage);
     callback.DynamicInvoke();
 }
开发者ID:rachwal,项目名称:RTM-Windows-10-Client,代码行数:5,代码来源:RTMWebClient.cs

示例6: ShowProgressWorker

        void ShowProgressWorker(float progress = -1, string status = null, MaskType maskType = MaskType.None, bool textOnly = false, 
		                         ToastPosition toastPosition = ToastPosition.Center, string cancelCaption = null, Action cancelCallback = null, 
		                         double timeoutMs = 1000, bool showContinuousProgress = false, UIImage displayContinuousImage = null)
        {
            Ring.ResetStyle(IsiOS7ForLookAndFeel, (IsiOS7ForLookAndFeel ? TintColor : UIColor.White));

            if (OverlayView.Superview == null) {
                var windows = UIApplication.SharedApplication.Windows;
                Array.Reverse (windows);
                foreach (UIWindow window in windows) {
                    if (window.WindowLevel == UIWindowLevel.Normal && !window.Hidden) {
                        window.AddSubview (OverlayView);
                        break;
                    }
                }
            }

            if (Superview == null)
                OverlayView.AddSubview (this);

            _fadeoutTimer = null;
            ImageView.Hidden = true;
            _maskType = maskType;
            _progress = progress;

            StringLabel.Text = status;

            if (!string.IsNullOrEmpty (cancelCaption)) {
                CancelHudButton.SetTitle (cancelCaption, UIControlState.Normal);
                CancelHudButton.TouchUpInside += delegate {
                    Dismiss ();
                    if (cancelCallback != null) {
                        obj.InvokeOnMainThread (() => cancelCallback.DynamicInvoke (null));
                        //cancelCallback.DynamicInvoke(null);
                    }
                };
            }

            UpdatePosition (textOnly);

            if (showContinuousProgress) {
                if (displayContinuousImage != null) {
                    _displayContinuousImage = true;
                    ImageView.Image = displayContinuousImage;
                    ImageView.Hidden = false;
                }

                RingLayer.StrokeEnd = 0.0f;
                StartProgressTimer (TimeSpan.FromMilliseconds (Ring.ProgressUpdateInterval));
            } else {
                if (progress >= 0) {
                    ImageView.Image = null;
                    ImageView.Hidden = false;

                    SpinnerView.StopAnimating ();
                    RingLayer.StrokeEnd = progress;
                } else if (textOnly) {
                    CancelRingLayerAnimation ();
                    SpinnerView.StopAnimating ();
                } else {
                    CancelRingLayerAnimation ();
                    SpinnerView.StartAnimating ();
                }
            }

            bool cancelButtonVisible = _cancelHud != null && _cancelHud.IsDescendantOfView (_hudView);

            // intercept user interaction with the underlying view
            if (maskType != MaskType.None || cancelButtonVisible) {
                OverlayView.UserInteractionEnabled = true;
                //AccessibilityLabel = status;
                //IsAccessibilityElement = true;
            } else {
                OverlayView.UserInteractionEnabled = false;
                //hudView.IsAccessibilityElement = true;
            }

            OverlayView.Hidden = false;
            this.toastPosition = toastPosition;
            PositionHUD (null);

            if (Alpha != 1) {
                RegisterNotifications ();
                HudView.Transform.Scale (1.3f, 1.3f);

                if (isClear) {
                    Alpha = 1f;
                    HudView.Alpha = 0f;
                }

                UIView.Animate (0.15f, 0,
                    UIViewAnimationOptions.AllowUserInteraction | UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.BeginFromCurrentState,
                    delegate {
                        HudView.Transform.Scale ((float)1 / 1.3f, (float)1f / 1.3f);
                        if (isClear) {
                            HudView.Alpha = 1f;
                        } else {
                            Alpha = 1f;
                        }
                    }, delegate {
//.........这里部分代码省略.........
开发者ID:philippd,项目名称:userdialogs,代码行数:101,代码来源:ProgressHUD.cs

示例7: HandleAction

 /// <summary>
 /// Runs a compiled linq expression.
 /// </summary>
 /// <param name="action">The action.</param>
 /// <param name="receivedMessage">The received message.</param>
 /// <param name="workerNotification">The worker notification.</param>
 private void HandleAction(Action<IReceivedMessage<MessageExpression>, IWorkerNotification> action, IReceivedMessage<MessageExpression> receivedMessage, IWorkerNotification workerNotification)
 {
     action.DynamicInvoke(receivedMessage, workerNotification);
 }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:10,代码来源:MessageMethodHandling.cs

示例8: Invoke

 /// <summary>
 /// Invoke the given delegate on the given syncronizer.
 /// </summary>
 public static void Invoke(ISynchronizeInvoke syncronizer, Action method)
 {
     if (syncronizer != null && syncronizer.InvokeRequired)
     {
         Action exceptionLogger = () =>
         {
             try
             {
                 method.DynamicInvoke();
             }
             catch (Exception e)
             {
                 log.Error("Exception in Invoke", e);
                 throw;
             }
         };
         syncronizer.Invoke(exceptionLogger, new object[0]);
     }
     else
     {
         method();
     }
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:26,代码来源:InvokeHelper.cs

示例9: RunGUI

        private void RunGUI(Action PreAction, Action PostAction)
        {
            #region Firast Disable Password Hook Listener
            PreAction.DynamicInvoke();
            //
            #endregion

            #region Run GUI
            //
            // Run Graphic User Interface
            //
            try
            {
                Task.WaitAll(Task.Run(async () =>
                {
                    try
                    {
                        await EventReflector.CallReport.SendAsync(new ReportEventArgs("RunGUI", ReportCodes.RequestedForJob, "Request to Start GUI"));

                        GUI BlackANTKernel = new GUI(Environment.TickCount);

                        await EventReflector.CallReport.SendAsync(new ReportEventArgs("RunGUI", ReportCodes.GUIRunning, "GUI Started"));

                        BlackANTKernel.ShowDialog();

                        await EventReflector.CallReport.SendAsync(new ReportEventArgs("RunGUI", ReportCodes.GUIClosed, "GUI Disposed"));
                    }
                    catch (Exception ex) { EventReflector.CallReport.Post(new ReportEventArgs("RunGUI", ex)); }
                }));
            }
            catch (Exception ex) { EventReflector.CallReport.Post(new ReportEventArgs("RunGUI", ex)); }
            //
            #endregion

            #region Finally Enable Password Hook Listener
            PostAction.DynamicInvoke();
            #endregion
        }
开发者ID:Behzadkhosravifar,项目名称:BlackANT,代码行数:38,代码来源:MultipleActions.cs

示例10: IfUsed

            /// <summary>
            /// Checks if orderby is used in query and calls action delegate to 
            /// execute user's code and internally marks <value>true</value> for ifUsed field
            /// to be used by <see cref="FluentOrderByItem"/> iterator.
            /// </summary>
            /// <param name="action"></param>
            /// <returns></returns>
            public FluentOrderBy IfUsed(Action action)
            {
                ifUsed = bucket.OrderByItems.Count > 0;

                if (ifUsed && action != null)
                    action.DynamicInvoke();
                return this;
            }
开发者ID:swijnands,项目名称:LinqExtender,代码行数:15,代码来源:FluentEntity.cs

示例11: BuildDepedencyTree

		/// <summary>
		/// Scan the directory passed and build the dependency tree.
		/// </summary>
		/// <param name="currentPath">the path to start scanning</param>
		/// <param name="filePattern"></param>
		/// <param name="getDetailsFromJsFilePath"></param>
		private void BuildDepedencyTree(string currentPath, string filePattern, Action<string, string> getDetailsFromJsFilePath, string regex)
		{
			// recurse through all the directories
			var currentDirectories = Directory.GetDirectories(currentPath);
			foreach (var directory in currentDirectories)
			{
				BuildDepedencyTree(directory, filePattern, getDetailsFromJsFilePath,regex);
			}

			// list all the JS files in this folder we don't care about any of the others.
			var currentFiles = Directory.GetFiles(currentPath, filePattern);
			foreach (var currentFile in currentFiles)
			{
				getDetailsFromJsFilePath.DynamicInvoke(currentFile, regex);
			}
		}
开发者ID:hikirsch,项目名称:Plovr.NET,代码行数:22,代码来源:DependencyBuilder.cs

示例12: TestBrowser

 private void TestBrowser(IWebDriver d, Action method)
 {
     try
     {
         driver = d;
         method.DynamicInvoke();
     }
     catch (Exception ex)
     {                
         string errorMessage = ex.InnerException.Message.Split('\n')[0];
         AddErrorMessageToDictionary(errorMessage);
     }
 }
开发者ID:jimlawruk,项目名称:lawruk.com,代码行数:13,代码来源:BaseTest.cs

示例13: Invoke

        private static void Invoke(string key, Action<dynamic, dynamic> action, object sender, EventArgs e)
        {
            if (action.Method != null)
            {
                if (action.Target is Control)
                {
                    var control = (Control)action.Target;

                    if (control.IsDisposed)
                    {
                        Unsubscribe(key, action);
                        return;
                    }
                }

                action.DynamicInvoke(sender, e);
            }
        }
开发者ID:ccasalicchio,项目名称:Cassini-Original-Project,代码行数:18,代码来源:EventBroker.cs


注:本文中的System.Action.DynamicInvoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。