System.Threading.Tasks.TaskFactory.StartNew(System.Action)

Here are the examples of the csharp api System.Threading.Tasks.TaskFactory.StartNew(System.Action) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

738 Examples 7

19 Source : DMSkinSimpleWindow.cs
with MIT License
from 944095635

private void StoryboardHide()
        {
            //启动最小化动画
            //StoryboardSlowHide.Begin(this);
            Task.Factory.StartNew(() =>
            {
                Thread.Sleep(300);
                Dispatcher.Invoke(new Action(() =>
                {
                    WindowState = WindowState.Minimized;
                }));
            });
        }

19 Source : DMSkinComplexWindow.cs
with MIT License
from 944095635

void MainWindow_StateChanged(object sender, EventArgs e)
        {
            //最大化
            if (WindowState == WindowState.Maximized)
            {
                ShadowWindowVisibility(false);
            }
            //默认大小
            if (WindowState == WindowState.Normal)
            {
                if (shadowWindowState)
                {
                    return;
                }
                shadowWindowState = true;
                Task.Factory.StartNew(() =>
                {
                    Thread.Sleep(200);
                    Dispatcher.Invoke(new Action(() =>
                    {
                        //恢复-显示阴影
                        ShadowWindowVisibility(true);
                        shadowWindowState = false;
                        //激活当前窗口
                        Activate();
                        //(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                    }));
                });
            }
            //最小化-隐藏阴影
            if (WindowState == WindowState.Minimized)
            {
                ShadowWindowVisibility(false);
            }
        }

19 Source : DMSkinSimpleWindow.cs
with MIT License
from 944095635

private void WindowRestore()
        {
            Opacity = 0;
            Task.Factory.StartNew(() =>
            {
                Thread.Sleep(50);
                Dispatcher.Invoke(new Action(() =>
                {
                    WindowState = WindowState.Normal;
                    Opacity = 1;
                }));
            });
        }

19 Source : HistoryViewer.cs
with MIT License
from aabiryukov

[System.Diagnostics.Codereplacedysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
		private void ExecViewHistory(Uri tfsCollectionUri, string sourceControlFolder)
        {
            // gource start arguments
            string arguments;
            string replacedle;
			string avatarsDirectory = null;

            if (m_settigs.PlayMode == VisualizationSettings.PlayModeOption.History)
            {
                replacedle = "History of " + sourceControlFolder;
				var logFile = Path.Combine(FileUtils.GetTempPath(), "TfsHistoryLog.tmp.txt");
	            
	            if (m_settigs.ViewAvatars)
	            {
		            avatarsDirectory = Path.Combine(FileUtils.GetTempPath(), "TfsHistoryLog.tmp.Avatars");
					if (!Directory.Exists(avatarsDirectory))
		            {
			            Directory.CreateDirectory(avatarsDirectory);
		            }
	            }

				bool historyFound;
				bool hasLines;

                using (var waitMessage = new WaitMessage("Connecting to Team Foundation Server...", OnCancelByUser))
                {
                    var progress = waitMessage.CreateProgress("Loading history ({0}% done) ...");

                    hasLines =
                        TfsLogWriter.CreateGourceLogFile(
                            logFile,
							avatarsDirectory,
                            tfsCollectionUri,
                            sourceControlFolder,
                            m_settigs,
                            ref m_canceled,
                            progress.SetValue
                            );

	                historyFound = progress.LastValue > 0;
                    progress.Done();
                }

                if (m_canceled)
					return;

                if (!hasLines)
                {
	                MessageBox.Show(
		                historyFound
			                ? "No items found.\nCheck your filters: 'User name' and 'File type'."
							: "No items found.\nTry to change period of the history (From/To dates).",
		                "TFS History Visualization");
	                return;
                }

	            arguments = string.Format(CultureInfo.InvariantCulture, " \"{0}\" ", logFile);

                // Setting other history settings

                arguments += " --seconds-per-day " + m_settigs.SecondsPerDay.ToString(CultureInfo.InvariantCulture);

                if (m_settigs.TimeScale != VisualizationSettings.TimeScaleOption.None)
                {
                    var optionValue = ConvertToString(m_settigs.TimeScale);
                    if (optionValue != null)
                        arguments += " --time-scale " + optionValue;
                }

                if (m_settigs.LoopPlayback)
                {
                    arguments += " --loop";
                }

				arguments += " --file-idle-time 60"; // 60 is default in gource 0.40 and older. Since 0.41 default 0.
            }
            else
            {
                // PlayMode: Live
                replacedle = "Live changes of " + sourceControlFolder;

                arguments = " --realtime --log-format custom -";
                arguments += " --file-idle-time 28800"; // 8 hours (work day)
            }

            var baseDirectory = Path.GetDirectoryName(System.Reflection.replacedembly.GetExecutingreplacedembly().Location) ??
                                "unknown";


            if (baseDirectory.Contains("Test"))
            {
                baseDirectory += @"\..\..\..\VSExtension";
            }

#if DEBUG
			// baseDirectory = @"C:\Temp\aaaa\уи³пс\";
#endif
            var gourcePath = Path.Combine(baseDirectory, @"Gource\Gource.exe");
            var dataPath = Path.Combine(baseDirectory, @"Data");

            // ******************************************************
            // Configuring Gource command line
            // ******************************************************

            arguments +=
                string.Format(CultureInfo.InvariantCulture, " --highlight-users --replacedle \"{0}\"", replacedle);

			if (m_settigs.ViewLogo != CheckState.Unchecked)
			{
				var logoFile = m_settigs.ViewLogo == CheckState.Indeterminate
					? Path.Combine(dataPath, "Logo.png")
					: m_settigs.LogoFileName;

				// fix gource unicode path problems
				logoFile = FileUtils.GetShortPath(logoFile);

				arguments += string.Format(CultureInfo.InvariantCulture, " --logo \"{0}\"", logoFile);
			}

            if (m_settigs.FullScreen)
            {
                arguments += " --fullscreen";

				// By default gource not using full area of screen width ( It's a bug. Must be fixed in gource 0.41).
				// Fixing fullscreen resolution to real full screen.
				if (!m_settigs.SetResolution)
				{
					var screenBounds = Screen.PrimaryScreen.Bounds;
					arguments += string.Format(CultureInfo.InvariantCulture, " --viewport {0}x{1}", screenBounds.Width,
											   screenBounds.Height);
				}
			}

            if (m_settigs.SetResolution)
            {
                arguments += string.Format(CultureInfo.InvariantCulture, " --viewport {0}x{1}",
                                           m_settigs.ResolutionWidth, m_settigs.ResolutionHeight);
            }

            if (m_settigs.ViewFilesExtentionMap)
            {
                arguments += " --key";
            }

			if (!string.IsNullOrEmpty(avatarsDirectory))
			{
				arguments += string.Format(CultureInfo.InvariantCulture, " --user-image-dir \"{0}\"", avatarsDirectory);
			}

            // Process "--hide" option
            {
                var hideItems = string.Empty;
                if (!m_settigs.ViewDirNames)
                {
                    hideItems = "dirnames";
                }
                if (!m_settigs.ViewFileNames)
                {
                    if (hideItems.Length > 0) hideItems += ",";
                    hideItems += "filenames";
                }
                if (!m_settigs.ViewUserNames)
                {
                    if (hideItems.Length > 0) hideItems += ",";
                    hideItems += "usernames";
                }

                if (hideItems.Length > 0)
                    arguments += " --hide " + hideItems;
            }

            arguments += " --max-files " + m_settigs.MaxFiles.ToString(CultureInfo.InvariantCulture);

			if (SystemInformation.TerminalServerSession)
			{
				arguments += " --disable-bloom";
			}

			if (m_settigs.PlayMode == VisualizationSettings.PlayModeOption.History)
            {
                var si = new ProcessStartInfo(gourcePath, arguments)
                    {
                        WindowStyle = ProcessWindowStyle.Maximized,
 //                       UseShellExecute = true
					};

                Process.Start(si);
            }
            else
            {
                var logReader = new VersionControlLogReader(tfsCollectionUri, sourceControlFolder, m_settigs.UsersFilter,
                                                     m_settigs.FilesFilter);
                using (new WaitMessage("Connecting to Team Foundation Server..."))
                {
                    logReader.Connect();
                }

                System.Threading.Tasks.Task.Factory.StartNew(() => RunLiveChangesMonitor(logReader, gourcePath, arguments));
            }
        }

19 Source : EndlessItemsControl.cs
with MIT License
from ABTSoftware

private void AddMoreItems()
        {
            var isBusy = (bool)GetValue(IsBusyProperty);
            if (!isBusy)
            {
                SetValue(IsBusyProperty, true);
                SetValue(IsBusyProperty, false);
                SetValue(IsBusyProperty, true);
                var delay = (TimeSpan)GetValue(PreLoadingDelayProperty);
                
                Task.Factory.StartNew(() =>
                {
                    Thread.Sleep(delay);

                    var items = _allItems.Take(10).ToList();
                    items.ForEach(item =>
                    {
                        Dispatcher.BeginInvoke(new Action(() => Currenreplacedems.Add(item)));
                        _allItems.Remove(item);
                    });
                }).ContinueWith(_ =>
                {
                    Dispatcher.BeginInvoke(new Action(() => SetValue(IsBusyProperty, false)));
                });
            }
        }

19 Source : FileCache.cs
with Apache License 2.0
from acarteas

private void FileCache_MaxCacheSizeReached(object sender, FileCacheEventArgs e)
        {
            Task.Factory.StartNew((Action) (() =>
            {
                // Shrink the cache to 75% of the max size
                // that way there's room for it to grow a bit
                // before we have to do this again.
                long newSize = ShrinkCacheToSize((long)(MaxCacheSize*0.75));
            }));
        }

19 Source : FileCache.cs
with Apache License 2.0
from acarteas

public void CleanCacheAsync()
        {
            Task.Factory.StartNew((Action) (() =>
            {
                CleanCache();
            }));
        }

19 Source : FileCache.cs
with Apache License 2.0
from acarteas

public void UpdateCacheSizeAsync()
        {
            Task.Factory.StartNew((Action) (() =>
            {
                CurrentCacheSize = GetCacheSize();
            }));
        }

19 Source : SearchIndexBuildRequest.cs
with MIT License
from Adoxio

private static void PerformUpdateAsync(SearchProvider provider, Action<ICrmEnreplacedyIndexUpdater> action)
        {
            Task.Factory.StartNew(() => PerformUpdate(provider, action));
        }

19 Source : PaceServer.cs
with MIT License
from afxw

public void Start()
        {
            listener?.Stop();

            listener = new TcpListener(IPAddress.Any, ServerConfiguration.Port);
            listener.Start();
            Listening = true;

            Task.Factory.StartNew(HandleClientConnection);
        }

19 Source : PaceServer.cs
with MIT License
from afxw

private void HandleClientConnection()
        {
            while (Listening)
            {
                var client = new PaceClient(listener.AcceptTcpClient());
                OnClientConnected(client);

                Task.Factory.StartNew(() =>
                {
                    bool isConnected = true;

                    while (isConnected)
                    {
                        try
                        {
                            var packet = client.ReadPacket();
                            OnPacketReceived(client, packet);
                        }
                        catch (IOException ex)
                        {
                            if (ex.InnerException == null)
                            {
                                throw ex;
                            }

                            if (ex.InnerException.GetType() == typeof(SocketException))
                            {
                                var socketException = (ex.InnerException as SocketException);

                                if (socketException.ErrorCode == (int)SocketError.ConnectionReset)
                                {
                                    OnClientDisconnected(client);
                                    isConnected = false;
                                }
                            }
                        }
                    }
                });
            }

            listener.Stop();
        }

19 Source : ZeroApplication.cs
with Mozilla Public License 2.0
from agebullhu

public static void RunAwaite()
        {
            Console.CancelKeyPress += OnCancelKeyPress;
            Console.WriteLine("Zeronet application start...");
            Start();
            Task.Factory.StartNew(WaitTask).Wait();
        }

19 Source : PollProxy.cs
with Mozilla Public License 2.0
from agebullhu

public void Start()
        {
            ZeroTrace.SystemLog("ConnectionProxy", "Start");
            RunTaskCancel = new CancellationTokenSource();
            Task.Factory.StartNew(Run);
            _waitToken.Wait();
        }

19 Source : StationProxy.cs
with Mozilla Public License 2.0
from agebullhu

public void Start()
        {
            ZeroTrace.SystemLog($"{Config.StationName}(proxy)", "Start");
            RunTaskCancel = new CancellationTokenSource();
            Task.Factory.StartNew(Run);
            _waitToken.Wait();
        }

19 Source : ApiStation.cs
with Mozilla Public License 2.0
from agebullhu

protected sealed override bool RunInner(CancellationToken token)
        {
            waitCount = 0;
            SystemManager.Instance.HeartReady(StationName, RealName);
            var option = ZeroApplication.GetApiOption(StationName);
            switch (option.SpeedLimitModel)
            {
                case SpeedLimitType.ThreadCount:
                    int max = (int)(Environment.ProcessorCount * option.TaskCpuMultiple);
                    if (max < 1)
                        max = 1;
                    _processSemapreplaced = new SemapreplacedSlim(0, max);
                    for (int idx = 0; idx < max; idx++)
                        Task.Factory.StartNew(RunThread);

                    for (int idx = 0; idx < max; idx++)
                        _processSemapreplaced.Wait();
                    break;
                case SpeedLimitType.WaitCount:
                    RunWait();
                    break;
                default:
                    RunSignle();
                    break;
            }
            SystemManager.Instance.HeartLeft(StationName, RealName);
            return true;
        }

19 Source : RemoteRecorder.cs
with Mozilla Public License 2.0
from agebullhu

bool Start()
        {
            using (OnceScope.CreateScope(this))
            {
                if (!ZeroApplication.Config.TryGetConfig("RemoteLog", out Config))
                {
                    ZeroTrace.WriteError("RemoteLogRecorder", "No config");
                    State = StationState.ConfigError;
                    ZeroApplication.OnObjectFailed(this);
                    return false;
                }
                RealName = ZeroIdenreplacedyHelper.CreateRealName(false, Config.ShortName ?? Config.StationName);
                Idenreplacedy = RealName.ToAsciiBytes();
                RunTaskCancel = new CancellationTokenSource();
                //Task.Factory.StartNew(SendTask, RunTaskCancel.Token);
                Task.Factory.StartNew(RunWaite);
            }
            return true;
        }

19 Source : StationCounter.cs
with Mozilla Public License 2.0
from agebullhu

private void SystemMonitor_StationEvent(object sender, ZeroNetEventArgument e)
        {
            Task.Factory.StartNew(() => StationEvent(e));
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncExecute<TResult>(Action<TResult> asyncAction)
        {
            var func = GetDelegate<Func<TResult>>();
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func();
                    asyncAction(result);
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncExecute<TArg1, TResult>(Action<TResult> asyncAction, TArg1 arg1)
        {
            var func = GetDelegate<Func<TArg1, TResult>>();
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func(arg1);
                    asyncAction(result);
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncRun<TArg1, TArg2, TArg3>(TArg1 arg1, TArg2 arg2, TArg3 arg3, Action asyncAction = null)
        {
            var action = GetDelegate<Action<TArg1, TArg2, TArg3>>();
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action(arg1, arg2, arg3);
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncRun<TArg1, TArg2, TArg3, TArg4>(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, Action asyncAction = null)
        {
            var action = GetDelegate<Action<TArg1, TArg2, TArg3, TArg4>>();
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action(arg1, arg2, arg3, arg4);
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryExecute<TArg1, TResult>(Action<TResult> asyncAction, TArg1 arg1)
        {
            var func = GetDelegate<Func<TArg1, TResult>>();
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func(arg1);
                    asyncAction(result);
                });
            }
            else
            {
                asyncAction(default(TResult));
            }
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryExecute<TArg1, TArg2, TResult>(Action<TResult> asyncAction, TArg1 arg1, TArg2 arg2)
        {
            var func = GetDelegate<Func<TArg1, TArg2, TResult>>();
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func(arg1, arg2);
                    asyncAction(result);
                });
            }
            else
            {
                asyncAction(default(TResult));
            }
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncExecute<TArg1, TArg2, TArg3, TResult>(Action<TResult> asyncAction, TArg1 arg1, TArg2 arg2, TArg3 arg3)
        {
            var func = GetDelegate<Func<TArg1, TArg2, TArg3, TResult>>();
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func(arg1, arg2, arg3);
                    asyncAction(result);
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncExecute<TArg1, TArg2, TArg3, TArg4, TResult>(Action<TResult> asyncAction, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4)
        {
            var func = GetDelegate<Func<TArg1, TArg2, TArg3, TArg4, TResult>>();

            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func(arg1, arg2, arg3, arg4);
                    asyncAction(result);
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncRun(Action asyncAction = null)
        {
            var action = GetDelegate<Action>();
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action();
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncRun<TArg1>(TArg1 arg1, Action asyncAction = null)
        {
            var action = GetDelegate<Action<TArg1>>();
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action(arg1);
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncRun<TArg1, TArg2>(TArg1 arg1, TArg2 arg2, Action asyncAction = null)
        {
            var action = GetDelegate<Action<TArg1, TArg2>>();
            if (action != null)
            {
                Task.Factory.StartNew(() => action(arg1, arg2));
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryRun<TArg1, TArg2>(TArg1 arg1, TArg2 arg2, Action asyncAction = null)
        {
            var action = GetDelegate<Action<TArg1, TArg2>>();
            if (action != null)
            {
                Task.Factory.StartNew(() => action(arg1, arg2));
            }
            else if (asyncAction != null)
            {
                asyncAction();
            }
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryRun<TArg1, TArg2, TArg3>(TArg1 arg1, TArg2 arg2, TArg3 arg3, Action asyncAction = null)
        {
            var action = GetDelegate<Action<TArg1, TArg2, TArg3>>();
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action(arg1, arg2, arg3);
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            else if (asyncAction != null)
            {
                asyncAction();
            }
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncExecute<TArg1, TArg2, TResult>(Action<TResult> asyncAction, TArg1 arg1, TArg2 arg2, string name = null)
        {
            var func = GetDelegate<Func<TArg1, TArg2, TResult>>(name);
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func( arg1, arg2);
                    asyncAction(result);
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncExecute<TArg1, TArg2, TArg3, TResult>(Action<TResult> asyncAction, TArg1 arg1, TArg2 arg2, TArg3 arg3, string name = null)
        {
            var func = GetDelegate<Func<TArg1, TArg2, TArg3, TResult>>(name);
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func( arg1, arg2, arg3);
                    asyncAction(result);
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncExecute<TArg1, TArg2, TArg3, TArg4, TResult>(Action<TResult> asyncAction, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, string name = null)
        {
            var func = GetDelegate<Func<TArg1, TArg2, TArg3, TArg4, TResult>>(name);

            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func( arg1, arg2, arg3, arg4);
                    asyncAction(result);
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncRun(Action asyncAction = null, string name = null)
        {
            var action = GetDelegate<Action>(name);
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action();
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncRun<TArg1>(TArg1 arg1, Action asyncAction = null, string name = null)
        {
            var action = GetDelegate<Action<TArg1>>(name);
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action( arg1);
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryRun<TArg1, TArg2, TArg3>(TArg1 arg1, TArg2 arg2, TArg3 arg3, Action asyncAction = null, string name = null)
        {
            var action = GetDelegate<Action<TArg1, TArg2, TArg3>>(name);
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action( arg1, arg2, arg3);
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            else if (asyncAction != null)
            {
                asyncAction();
            }
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryRun<TArg1, TArg2, TArg3, TArg4>(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, Action asyncAction = null, string name = null)
        {
            var action = GetDelegate<Action<TArg1, TArg2, TArg3, TArg4>>(name);
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action( arg1, arg2, arg3, arg4);
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            else if (asyncAction != null)
            {
                asyncAction();
            }
        }

19 Source : ModelFunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncExecute<TResult>(Action<TResult> asyncAction, string name = null)
        {
            var func = GetDelegate<Func<TModel, TResult>>(name);
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func(Model);
                    asyncAction(result);
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryExecute<TResult>(Action<TResult> asyncAction)
        {
            var func = GetDelegate<Func<TResult>>();
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func();
                    asyncAction(result);
                });
            }
            else
            {
                asyncAction(default(TResult));
            }
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryRun<TArg1>(TArg1 arg1, Action asyncAction = null)
        {
            var action = GetDelegate<Action<TArg1>>();
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action(arg1);
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            else if (asyncAction != null)
            {
                asyncAction();
            }
        }

19 Source : DependencyFunctions.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryRun<TArg1, TArg2, TArg3, TArg4>(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, Action asyncAction = null)
        {
            var action = GetDelegate<Action<TArg1, TArg2, TArg3, TArg4>>();
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action(arg1, arg2, arg3, arg4);
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            else if (asyncAction != null)
            {
                asyncAction();
            }
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncExecute<TResult>(Action<TResult> asyncAction, string name = null)
        {
            var func = GetDelegate<Func<TResult>>(name);
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func();
                    asyncAction(result);
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncExecute<TArg1, TResult>(Action<TResult> asyncAction, TArg1 arg1, string name = null)
        {
            var func = GetDelegate<Func<TArg1, TResult>>(name);
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func( arg1);
                    asyncAction(result);
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncRun<TArg1, TArg2, TArg3>(TArg1 arg1, TArg2 arg2, TArg3 arg3, Action asyncAction = null, string name = null)
        {
            var action = GetDelegate<Action<TArg1, TArg2, TArg3>>(name);
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action( arg1, arg2, arg3);
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncRun<TArg1, TArg2, TArg3, TArg4>(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, Action asyncAction = null, string name = null)
        {
            var action = GetDelegate<Action<TArg1, TArg2, TArg3, TArg4>>(name);
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action( arg1, arg2, arg3, arg4);
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            throw new ArgumentException("�����ڶ�Ӧ���Ƶķ���");
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryExecute<TArg1, TResult>(Action<TResult> asyncAction, TArg1 arg1, string name = null)
        {
            var func = GetDelegate<Func<TArg1, TResult>>(name);
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func( arg1);
                    asyncAction(result);
                });
            }
            else
            {
                asyncAction(default(TResult));
            }
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryExecute<TArg1, TArg2, TResult>(Action<TResult> asyncAction, TArg1 arg1, TArg2 arg2, string name = null)
        {
            var func = GetDelegate<Func<TArg1, TArg2, TResult>>(name);
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func( arg1, arg2);
                    asyncAction(result);
                });
            }
            else
            {
                asyncAction(default(TResult));
            }
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryExecute<TArg1, TArg2, TArg3, TResult>(Action<TResult> asyncAction, TArg1 arg1, TArg2 arg2, TArg3 arg3, string name = null)
        {
            var func = GetDelegate<Func<TArg1, TArg2, TArg3, TResult>>(name);
            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func( arg1, arg2, arg3);
                    asyncAction(result);
                });
            }
            else
            {
                asyncAction(default(TResult));
            }
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryExecute<TArg1, TArg2, TArg3, TArg4, TResult>(Action<TResult> asyncAction, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, string name = null)
        {
            var func = GetDelegate<Func<TArg1, TArg2, TArg3, TArg4, TResult>>(name);

            if (func != null)
            {
                Task.Factory.StartNew(() =>
                {
                    var result = func( arg1, arg2, arg3, arg4);
                    asyncAction(result);
                });
            }
            else
            {
                asyncAction(default(TResult));
            }
        }

19 Source : FunctionDictionary.cs
with Mozilla Public License 2.0
from agebullhu

public void AsyncTryRun(Action asyncAction = null, string name = null)
        {
            var action = GetDelegate<Action>(name);
            if (action != null)
            {
                Task.Factory.StartNew(() =>
                {
                    action();
                    if (asyncAction != null)
                        asyncAction();
                });
            }
            else if (asyncAction != null)
            {
                asyncAction();
            }
        }

See More Examples