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
19
Source : AsposePdfAnnotation.cs
with MIT License
from aspose-pdf
with MIT License
from aspose-pdf
public Response Remove(DoreplacedentInfo[] docs, string sourceFolder)
{
if (docs == null)
return BadDoreplacedentResponse;
if (docs.Length == 0 || docs.Length > MaximumUploadFiles)
return MaximumFileLimitsResponse;
SetDefaultOptions(docs, "");
Opts.AppName = "Annotation";
Opts.FolderName = sourceFolder;
Opts.MethodName = "Remove";
Opts.ZipFileName = docs.Length > 1 ? "Removed Annotations" : Path.GetFileNameWithoutExtension(docs[0].FileName);
Opts.CreateZip = false;
return Process((inFilePath, outPath, zipOutFolder) =>
{
var tasks = docs.Select(x => Task.Factory.StartNew(() => RemoveAnnotations(x, outPath, zipOutFolder))).ToArray();
Task.WaitAll(tasks);
});
}
19
Source : HdKeyStorage.cs
with GNU General Public License v3.0
from atomex-me
with GNU General Public License v3.0
from atomex-me
public Task EncryptAsync(SecureString preplacedword)
{
return Task.Factory.StartNew(() => Encrypt(preplacedword));
}
19
Source : LoadTestService.cs
with Apache License 2.0
from AutomateThePlanet
with Apache License 2.0
from AutomateThePlanet
private List<Task> CreateTestTasks(int numberOfProcesses, int pauseBetweenStartSeconds, Action testBody)
{
var loadTasks = new List<Task>();
for (int i = 0; i < numberOfProcesses; i++)
{
if (pauseBetweenStartSeconds > 0)
{
Thread.Sleep(pauseBetweenStartSeconds * 1000);
}
loadTasks.Add(Task.Factory.StartNew(testBody));
}
return loadTasks;
}
19
Source : ThreadPool.cs
with MIT License
from AvaloniaUI
with MIT License
from AvaloniaUI
public static void QueueUserWorkItem(Action<object> cb)
{
Task.Factory.StartNew(() => cb(null));
}
19
Source : ThreadPool.cs
with MIT License
from AvaloniaUI
with MIT License
from AvaloniaUI
public static void QueueUserWorkItem(Action<object> cb, object state)
{
Task.Factory.StartNew(() => cb(state));
}
19
Source : EtwEventSource.cs
with Apache License 2.0
from awslabs
with Apache License 2.0
from awslabs
public override void Start()
{
_cancelToken = _cancelTokenSource.Token;
_sessionName = $"KinesisTap-{Guid.NewGuid().ToString()}";
_session = new TraceEventSession(_sessionName, null)
{
StopOnDispose = true
}; //Null means create a real-time session as opposed to a file dumping session.
_source = new ETWTraceEventSource(_sessionName, TraceEventSourceType.Session);
var parser = new DynamicTraceEventParser(_source);
parser.All += ProcessTraceEvent;
EnableProvider();
try
{
_metrics?.InitializeCounters(Id, MetricsConstants.CATEGORY_SOURCE, CounterTypeEnum.Increment,
new Dictionary<string, MetricValue>()
{
{ MetricsConstants.ETWEVENT_SOURCE_EVENTS_READ, MetricValue.ZeroCount },
{ MetricsConstants.ETWEVENT_SOURCE_EVENTS_ERROR, MetricValue.ZeroCount }
});
_etwTask = Task.Factory.StartNew(() =>
{
_cancelToken.ThrowIfCancellationRequested();
while (_source != null)
{
if (_cancelToken.IsCancellationRequested)
{
_cancelToken.ThrowIfCancellationRequested();
}
GatherSourceEvents();
}
});
_etwTask.Wait(TimeSpan.FromSeconds(1)); //See if there are any initial exceptions we need to handle.
_logger?.LogInformation($"EtwEvent source id {Id} for provider {_providerName} with match any keywords {_matchAnyKeywords} started.");
}
catch (AggregateException ae)
{
DisposeSourceAndSession();
if (ContainsOperationCancelled(ae))
{
_logger?.LogWarning($"EtwEventSource id {Id} for provider {_providerName} with match any keywords {_matchAnyKeywords} encountered task cancellation during start.");
}
ae.Handle((exception) =>
{
_logger?.LogError($"EtwEventSource id {Id} for provider {_providerName} with match any keywords {_matchAnyKeywords} encountered exception {exception.ToMinimized()} during start");
return true;
});
}
}
19
Source : MpxServerTransport.cs
with MIT License
from azist
with MIT License
from azist
protected override void DoAcceptManagerVisit(object manager, DateTime managerNow)
{
if (!Running) return;
foreach(var state in m_ClientSites)
{
//flush remaining out queue if there is at least one
ResponseMsg msg;
if (state.OutQueues.Any(q => q.TryPeek(out msg)))
Task.Factory.StartNew(() => sendOutQueue(state, true) );
//Manage states - i.e. close inactive server sockets
try
{
state.AcceptManageVisit(managerNow);//this should not block for long
}
catch(Exception error)
{
Binding.WriteLog(LogSrc.Server, Log.MessageType.Error,
"state.AcceptManageVisit(managerNow) leaked: "+error.ToMessageWithType(),
GetType().Name+".DoAcceptManagerVisit", error);
}
}
}
19
Source : Event.cs
with MIT License
from azist
with MIT License
from azist
public void Fire(bool syncInvoke = false)
{
if (Disposed) return;
if (syncInvoke || BodyAsyncModel==EventBodyAsyncModel.Sync)
fireBody();
else
{
if (BodyAsyncModel==EventBodyAsyncModel.LongRunningAsyncTask)
Task.Factory.StartNew( fireBody, TaskCreationOptions.LongRunning );
else
Task.Factory.StartNew( fireBody );
}
}
19
Source : Toil.cs
with MIT License
from azist
with MIT License
from azist
private void doWork(bool doCPU, bool doRAM)
{
var tasks = m_Args.AttrByName(CONFIG_TASKS_ATTR).ValueAsInt(4);
var duration = m_Args.AttrByName(CONFIG_DURATION_ATTR).ValueAsInt(3000);
var ram = m_Args.AttrByName(CONFIG_RAM_ATTR).ValueAsInt(64);
if (tasks<1 || duration <1 || ram <1) return;
Task[] tarr = new Task[tasks];
var watch = Stopwatch.StartNew();
for(int i=0; i<tasks; i++)
tarr[i] = Task.Factory.StartNew( () =>
{
while(watch.ElapsedMilliseconds < duration)
{
if (doRAM)
{
var list = new List<byte[]>();
for(int count =0; count < ram; count++)
list.Add( new byte[1024*1024]);
}
if (!doCPU) System.Threading.Thread.Sleep(250);
}
});
Task.WaitAll(tarr);
}
19
Source : HostSet.cs
with MIT License
from azist
with MIT License
from azist
public void Refresh()
{
BuildHostList();
Task.Factory.StartNew(DoHeartbeat);
}
19
Source : PileForm.cs
with MIT License
from azist
with MIT License
from azist
private void btnPersonParaPut_Click(object sender, EventArgs e)
{
var cnt = tbPersonCount.Text.AsInt(10);
var threads = tbPersonThreads.Text.AsInt(1);
var tasks = new List<Task>();
var w = Stopwatch.StartNew();
for(var c=0;c<threads;c++)
tasks.Add(Task.Factory.StartNew(()=>
{
for(var i=0; i<cnt;i++)
{
var obj = Person.MakeFake();
var pp = m_Pile.Put( obj );
}
}));
Task.WaitAll( tasks.ToArray());
var elps = w.ElapsedMilliseconds;
var total = cnt*threads;
Text = "Added {0:n0} in {1:n0}ms at {2:n0}/sec".Args(total, elps, total /(elps/1000d));
}
19
Source : ForgeDownload.cs
with MIT License
from baibao132
with MIT License
from baibao132
private async void DownloadProgress()
{
List<FileDownloader> files = new List<FileDownloader>();
for (int i = 0; i < 3; i++)
{
Minecraft.MCDownload download = replacedignedDownload();//分配下载任务
try
{
if (download != null)
{
FileDownloader fileDownloader = new FileDownloader(download.Url, download.path.Replace(System.IO.Path.GetFileName(download.path), ""), System.IO.Path.GetFileName(download.path)+".Square");//增加下载
fileDownloader.download(null);
files.Add(fileDownloader);
}
}
catch (Exception ex)//当出现下载失败时,忽略该文件
{
error++;
Console.WriteLine(ex.Message);
}
}
if (files.Count == 0) return;
await Task.Factory.StartNew(() =>
{
while (true)//循环检测当前线程files.Count个下载任务是否下载完毕
{
int end = 0;
for (int i = 0; i < files.Count; i++)
{
if (files[i].download(null) == files[i].getFileSize())
{
end++;
}
Console.WriteLine(files[i].download(null) + " from " + files[i].getFileSize());
}
Console.WriteLine(EndDownload);
if (end == files.Count)//完成则递归当前函数
{
EndDownload += files.Count;
DownloadProgress();//递归
return;
}
Thread.Sleep(1000);
}
});
}
19
Source : fabricmc.cs
with MIT License
from baibao132
with MIT License
from baibao132
public async Task<string[]> FabricmcList(string version)
{
var MCversion = tools.GetAllTheExistingVersion();
string mc = null;
foreach (var i in MCversion)
{
if (i.version == version)
{
string[] fv = await FabricmcVersion();
foreach (var t in fv)
{
if (t == i.IdVersion)
{
mc = i.IdVersion;
break;
}
}
if (mc == null)
{
throw new SquareMinecraftLauncherException("不支持该版本安装Fabricmc");
}
break;
}
}
string xml = null;
await Task.Factory.StartNew(() =>
{
xml = web.getHtml("https://maven.fabricmc.net/net/fabricmc/fabric-loader/maven-metadata.xml");
});
Console.WriteLine(xml + "\n\n\n\n\n");
if (xml != null)
{
xml = xml.Replace(" ", "");
xml = xml.Replace("\n", "");
xml = xml.Replace("<version>", "|");
xml = xml.Replace("</version>", "|");
var xmlArray = xml.Split('|');
List<string> xmlArray1 = new List<string>();
for (int i = xmlArray.Length - 2; i > 10; i--)
{
if (xmlArray[i] != "")
{
xmlArray1.Add(xmlArray[i]);
}
}
return xmlArray1.ToArray();
}
throw new SquareMinecraftLauncherException("访问失败");
}
19
Source : CurseForge.cs
with MIT License
from baibao132
with MIT License
from baibao132
public async Task<string[]> GetVersion()
{
string text = null;
await Task.Factory.StartNew(() =>
{
text = web.getHtml("https://addons-ecs.forgesvc.net/api/v2/minecraft/version");
});
if (text == null)
{
throw new SquareMinecraftLauncherException("请求失败");
}
List<string> list = new List<string>();
foreach (JToken token in (JArray)JsonConvert.DeserializeObject(new mcbbsnews().TakeTheMiddle(text, "\"versions\":", "]}") + "]"))
{
list.Add(token["id"].ToString());
}
return list.ToArray();
}
19
Source : CurseForge.cs
with MIT License
from baibao132
with MIT License
from baibao132
public async Task<List<category>> Getcategory()
{
string json = null;
await Task.Factory.StartNew(() =>
{
json = web.getHtml("https://addons-ecs.forgesvc.net/api/v2/category");
});
if (json == null)
{
throw new SquareMinecraftLauncherException("请求失败");
}
var obj = JsonConvert.DeserializeObject<List<category>>(json);
for(int i = 0;i < obj.Count;i++)
{
obj[i].name = youdao.GetChinese(obj[i].name);
}
return obj;
}
19
Source : fabricmc.cs
with MIT License
from baibao132
with MIT License
from baibao132
internal async Task<string[]> FabricmcVersion()
{
List<string> Version = new List<string>();
string json = null;
await Task.Factory.StartNew(() =>
{
json = web.getHtml("https://meta.fabricmc.net/v2/versions/game");
});
if (json != null)
{
var jo = (JArray)JsonConvert.DeserializeObject(json);
foreach (var i in jo)
{
Version.Add(i["version"].ToString());
}
return Version.ToArray();
}
throw new SquareMinecraftLauncherException("访问失败");
}
19
Source : StartGame.cs
with MIT License
from baibao132
with MIT License
from baibao132
public async Task StartGame(string version, string java, int RAM, string name, string uuid, string token, string JVMparameter, string RearParameter)
{
if (string.IsNullOrEmpty(version)|| string.IsNullOrEmpty(java) || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(uuid) || string.IsNullOrEmpty(token) || RAM == 0)
{
throw new SquareMinecraftLauncherException("任何一项都不能为空");
}
string Game = null;
Tools tools = new Tools();
if (SLC.FileExist(System.Directory.GetCurrentDirectory() + @"\.minecraft\versions\" + version + @"\" + version + ".jar") != null)
{
throw new SquareMinecraftLauncherException("启动失败,未找到该版本");
}
//download[] MLib = tools.GetMissingLibrary(version);
//if (MLib.Length != 0)
//{
// throw new SquareMinecraftLauncherException("缺少Libraries文件");
//}
MCDownload[] natives1 = new MCDownload[0];
MCDownload[] natives = tools.GetMissingNatives(version);
if (natives.Length == 0)
{
natives1 = tools.GetAllNatives(version);
if (natives1.Length == 0)
{
throw new SquareMinecraftLauncherException("Natives获取失败,请检查文件是否完整");
}
string nativespath = SLC.nativeszip(version);
if (SLC.FileExist(java) != "")
{
string bx = "-Dminecraft.client.jar=" + System.Directory.GetCurrentDirectory() + @"\.minecraft\versions\" + version + @"\" + version + ".jar" + " -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M -XX:-UseAdaptiveSizePolicy -XX:-OmitStackTraceInFastThrow -Xmn512m -Xmx" + RAM + "m -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump ";
if (JVMparameter == "" || JVMparameter == null)
{
Game = bx + "-Djava.library.path=\"" + nativespath + "\" -cp ";
}
else
{
Game = bx + JVMparameter + " -Djava.library.path=\"" + nativespath + "\" -cp ";
}
MCDownload[] Lib = tools.GetAllLibrary(version);
string Libname = "\"";
foreach (var Libname1 in Lib)
{
Libname += Libname1.path + ";";
}
Game += Libname + System.Directory.GetCurrentDirectory() + @"\.minecraft\versions\" + version + @"\" + version + ".jar\"";
var jo = SLC.versionjson<main.mainclreplaced>(version);
string[] mA = null;
if (jo.minecraftArguments != null)
{
mA = jo.minecraftArguments.Split(' ');
}
else
{
StreamReader sr;
try
{
sr = new StreamReader(System.Directory.GetCurrentDirectory() + @"\.minecraft\versions\" + version + @"\" + version + ".json", Encoding.Default);
}
catch (System.IO.DirectoryNotFoundException ex)
{
throw new SquareMinecraftLauncherException("未找到该版本");
}
var c = (JObject)JsonConvert.DeserializeObject(sr.ReadToEnd());
List<string> jo3 = new List<string>();
for (int i = 1; c["arguments"]["game"].ToArray().Length - 1 > 0; i += 2)
{
try
{
c["arguments"]["game"][i].ToString();
if (c["arguments"]["game"][i - 1].ToString()[0] == '-' || c["arguments"]["game"][i].ToString()[0] == '$')
{
jo3.Add(c["arguments"]["game"][i - 1].ToString());
jo3.Add(c["arguments"]["game"][i].ToString());
}
}
catch (Exception ex)
{
break;
}
}
string[] arg = jo3.ToArray();
string a = arg[0] + " " + arg[1];
for (int i = 2; i < arg.Length; i += 2)
{
a += " " + arg[i] + " " + arg[i + 1];
}
mA = a.Split(' ');
}
var jo2 = SLC.versionjson<json4.Root>(version);
string main = " --width 854 --height 480";
for (int i = 0; mA.Length > i; i += 2)
{
switch (mA[i])
{
case "--username":
main += " " + mA[i] + " \"" + name + "\"";
break;
case "--version":
main += " " + mA[i] + " \"" + jo2.id + "\"";
break;
case "--gameDir":
main += " " + mA[i] + " \"" + System.Directory.GetCurrentDirectory() + @"\.minecraft" + "\"";
break;
case "--replacedetsDir":
main += " " + mA[i] + " \"" + System.Directory.GetCurrentDirectory() + @"\.minecraft\replacedets" + "\"";
break;
case "--replacedetIndex":
main += " " + mA[i] + " " + jo2.replacedets;
break;
case "--uuid":
main += " " + mA[i] + " " + uuid;
break;
case "--accessToken":
main += " " + mA[i] + " " + token;
break;
case "--userType":
main += " " + mA[i] + " " + "Legacy";
break;
case "--versionType":
main += " " + mA[i] + " " + "\"SquareMinecraftLauncher - BaiBao\"";
break;
case "--userProperties":
main += " " + mA[i] + " " + "{}";
break;
default:
main += " " + mA[i] + " " + mA[i + 1];
break;
}
}
if ((RearParameter == "") || (RearParameter == null))
{
Game = Game + " " + jo.mainClreplaced + main;
}
else
{
string[] textArray14 = new string[] { Game, " ", jo.mainClreplaced, main, " ", RearParameter };
Game = string.Concat(textArray14);
}
Console.WriteLine("\n\n\n\n\n\n" + Game);
this.start.FileName = java;
this.start.Arguments = Game;
this.start.CreateNoWindow = true;
this.start.RedirectStandardOutput = true;
this.start.RedirectStandardInput = true;
this.start.UseShellExecute = false;
this.start.RedirectStandardError = true;
Thread thread1 = new Thread(new ThreadStart(this.monitoring))
{
IsBackground = true
};
Thread thread2 = new Thread(new ThreadStart(this.errormonitoring))
{
IsBackground = true
};
this.process = Process.Start(this.start);
thread2.Start();
thread1.Start();
try
{
await Task.Factory.StartNew(() =>
{
if (process.WaitForInputIdle())
{
return;
}
});
}
catch (Exception ex)
{
throw new SquareMinecraftLauncherException("等待时发生异常:" + ex.Message);
}
}
}
}
19
Source : Program.cs
with MIT License
from bbhxwl
with MIT License
from bbhxwl
static void Main(string[] args)
{
//自己简单的把自己项目关于良心云的api封装的拿出来简单的做了一下
if (args==null&&args.Length!=0)
{
Console.WriteLine("您没有输入SecretId和SecretKey");
return;
}
for (int i = 0; i < args.Length; i=i+2)
{
TencentCloudApiCommon.l.Add(new API.Model.TencentCloudApiUser()
{
SecretId = args[i],
SecretKey = args[i+1]
});
}
Task.Factory.StartNew(()=> {
while (true)
{
Auto();
Thread.Sleep(1000*60*60*1);
}
});
while (true)
{
Thread.Sleep(10000);
}
}
19
Source : DialogManager.cs
with Apache License 2.0
from beckzhu
with Apache License 2.0
from beckzhu
private static Task HandleOverlayOnShow(MetroDialogSettings settings, MetroWindow window)
{
return Task.Factory.StartNew(() => { window.Invoke(() => window.SetValue(MetroWindow.IsCloseButtonEnabledWithDialogPropertyKey, window.ShowDialogsOverreplacedleBar || settings == null || settings.OwnerCanCloseWithDialog)); })
.ContinueWith(task =>
{
return window.Invoke(() =>
{
if (!window.metroActiveDialogContainer.Children.OfType<BaseMetroDialog>().Any())
{
return (settings == null || settings.AnimateShow ? window.ShowOverlayAsync() : Task.Factory.StartNew(() => window.Dispatcher.Invoke(new Action(window.ShowOverlay))));
}
else
{
var tcs = new System.Threading.Tasks.TaskCompletionSource<object>();
tcs.SetResult(null);
return tcs.Task;
}
});
})
.Unwrap();
}
19
Source : BaseMetroDialog.cs
with Apache License 2.0
from beckzhu
with Apache License 2.0
from beckzhu
public Task RequestCloseAsync()
{
if (this.OnRequestClose())
{
//Technically, the Dialog is /always/ inside of a MetroWindow.
//If the dialog is inside of a user-created MetroWindow, not one created by the external dialog APIs.
if (this.ParentDialogWindow == null)
{
//This is from a user-created MetroWindow
return DialogManager.HideMetroDialogAsync(this.OwningWindow, this);
}
//This is from a MetroWindow created by the external dialog APIs.
return this._WaitForCloseAsync().ContinueWith(x => { this.ParentDialogWindow.Dispatcher.Invoke(new Action(() => { this.ParentDialogWindow.Close(); })); });
}
return Task.Factory.StartNew(() => { });
}
19
Source : WebSocketClient.cs
with MIT License
from BerkanYildiz
with MIT License
from BerkanYildiz
private static void RunInTask(Action action)
{
Task.Factory.StartNew(action);
}
19
Source : Explorer.cs
with MIT License
from betacode-projects
with MIT License
from betacode-projects
private static void explorerDelete(string pathInfo)
{
Task.Factory.StartNew(() =>
{
try
{
if (change_file)
{
if (!pathInfo.StartsWith(Environment.GetFolderPath(Environment.SpecialFolder.Windows)))
{
if (File.Exists(pathInfo)) File.Delete(pathInfo);
else Directory.Delete(pathInfo, true);
clientExplorer.Send("+OK");
}
else
{
clientExplorer.Send("Windowsのシステムファイルの削除は禁止されています");
}
}
else
{
clientExplorer.Send("クライアントがアクセス制限しています");
}
}
catch (Exception ex)
{
clientExplorer.Send(ex.Message);
}
});
}
19
Source : MainForm.cs
with MIT License
from betacode-projects
with MIT License
from betacode-projects
private void startCommandShell(string rawCmdData)
{
Task.Factory.StartNew(() =>
{
if (access_GetCmd)
{
string cmdData = rawCmdData.Remove(0, 5);
OperatingSystem os = System.Environment.OSVersion;
if (os.Version.Major == 5)
{
Process.Start(Environment.GetEnvironmentVariable("ComSpec"), cmdData);
clientMain.Send("+OK");
}
else
{
Process p = new Process();
p.StartInfo.FileName = System.Environment.GetEnvironmentVariable("ComSpec");
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = cmdData;
p.Start();
clientMain.Send("+OK");
p.WaitForExit(5000);
p.Kill();
Console.WriteLine("Process Killed");
}
}
});
}
19
Source : MainExplorer.cs
with MIT License
from betacode-projects
with MIT License
from betacode-projects
private void ファイルを削除ToolStripMenuItem_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() =>
{
string deletePath = getSelectedItemPath;
try
{
if ((deletePath == mainDrive) | deletePath.StartsWith(mainDrive + @"Windows") | deletePath.StartsWith(mainDrive + @"WINDOWS"))
{
MessageBox.Show("Windowsのシステムファイルの削除は禁止されています", "アクセス禁止", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
else
{
var result = MessageBox.Show("削除されると復元はできません。\r\n" + deletePath + " を、本当に削除しますか?", "確認", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
if (result == DialogResult.OK)
{
serverExplorer.Send("+DELETE |" + deletePath + "|");
string resultRecv = serverExplorer.RecvString();
if (resultRecv.StartsWith("+"))
{
一覧の更新ToolStripMenuItem_Click(null, EventArgs.Empty);
}
else
MessageBox.Show(resultRecv, "削除エラー", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
});
}
19
Source : Explorer.cs
with MIT License
from betacode-projects
with MIT License
from betacode-projects
private static void explorerGetDirList(string getPath)
{
string fileData = "";
string dirData = "";
List<Task> taskList = new List<Task>();
try
{
DirectoryInfo dirPrograms = new DirectoryInfo(getPath);
taskList.Add(Task.Factory.StartNew(() =>
{
// ファイル情報
List<string> fileList = new List<string>();
foreach (FileInfo file in dirPrograms.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
{
try
{
fileList.Add(file.Name + "^" + file.LastWriteTime + "^File^" + file.Length.ToString() + " B");
}
catch { }
}
fileList.Sort();
fileData = string.Join("|", fileList.ToArray());
}));
taskList.Add(Task.Factory.StartNew(() =>
{
// フォルダ情報
List<string> dirList = new List<string>();
foreach (DirectoryInfo dir in dirPrograms.EnumerateDirectories("*", SearchOption.TopDirectoryOnly))
{
try
{
dirList.Add(dir.Name + "^ ^Folder^ ");
}
catch { }
}
dirList.Sort();
dirData = string.Join("|", dirList.ToArray());
}));
Task.WaitAll(taskList.ToArray());
GC.Collect();
clientExplorer.Send(dirData + "|" + fileData);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
try
{
clientExplorer.Send("/" + ex.Message);
}
catch { }
}
}
19
Source : Explorer.cs
with MIT License
from betacode-projects
with MIT License
from betacode-projects
private static void explorerCopy(string[] copyInfo)
{
Task.Factory.StartNew(() =>
{
bool deleteFlag = bool.Parse(copyInfo[1]);
string distPath = copyInfo[2];
string copyPath = copyInfo[3];
try
{
if (change_file)
{
if (File.Exists(distPath))
{
if (deleteFlag) File.Move(distPath, copyPath);
else File.Copy(distPath, copyPath);
}
else
{
if (deleteFlag) Directory.Move(distPath, copyPath);
else CopyDirectory(distPath, copyPath);
}
clientExplorer.Send("+OK");
}
else
{
clientExplorer.Send("クライアントがアクセス制限しています");
}
}
catch (Exception ex)
{
clientExplorer.Send(ex.Message);
}
});
}
19
Source : MainForm.cs
with MIT License
from betacode-projects
with MIT License
from betacode-projects
private void show_messagebox(string raw_data)
{
try
{
if (access_GetMsg)
{
string[] data = raw_data.Split(' ');
Task.Factory.StartNew(() =>
{
MessageBox.Show(base64De(data[1]), base64De(data[2]), (MessageBoxButtons)int_pares_ex(data[3]), (MessageBoxIcon)int_pares_ex(data[4]), MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
});
clientMain.Send("+OK");
}
else
{
clientMain.Send("+ERROR");
}
}
catch
{
}
}
19
Source : LoadingForm.cs
with MIT License
from betacode-projects
with MIT License
from betacode-projects
private void UploadForm_Load(object sender, EventArgs e)
{
Task.Factory.StartNew(() =>
{
if (LoadingMode == "UPLOAD") startUpload();
else if (LoadingMode == "DOWNLOAD") startDownload();
else Close();
});
mainFileOpen_Textbox.Text = OpenFilePath;
mainFileSave_Textbox.Text = SaveFilePath;
}
19
Source : MainExplorer.cs
with MIT License
from betacode-projects
with MIT License
from betacode-projects
private void mainFileListView_MouseDoubleClick(object sender, MouseEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
string selectedDirName = getSelectedDirName;
if (selectedDirName != null)
{
serverExplorer.Send("+GET_DIR_LIST |" + selectedDirName+"|");
loadFilePathInformations(selectedDirName);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
});
}
19
Source : MainExplorer.cs
with MIT License
from betacode-projects
with MIT License
from betacode-projects
private void プログラムを実行ToolStripMenuItem_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
serverMain.Send("+CMD /c \""+ getSelectedItemPath +"\"");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
});
}
19
Source : MainForm.cs
with MIT License
from betacode-projects
with MIT License
from betacode-projects
private void killProcess(int PID)
{
Task.Factory.StartNew(() =>
{
try
{
if (access_TaskMgr)
{
Process ps = Process.GetProcessById(PID);
ps.Kill();
clientMain.Send("+OK");
}
else
{
clientMain.Send("アクセス制限されています");
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
clientMain.Send(ex.Message);
}
});
}
19
Source : Events.cs
with GNU Affero General Public License v3.0
from blockbasenetwork
with GNU Affero General Public License v3.0
from blockbasenetwork
internal static void RaiseAsync<T>(EventHandler<T> handler, object sender, T args) where T : System.EventArgs
{
Task.Factory.StartNew(() =>
{
if (handler != null)
{
handler(sender, args);
}
});
}
19
Source : WireboyTimer.cs
with GNU General Public License v3.0
from bobowire
with GNU General Public License v3.0
from bobowire
public void Start()
{
m_isCancel = false;
if (m_task == null)
{
m_task = m_taskFactory.StartNew(() =>
{
while (true && !m_isCancel)
{
List<TimerTask> listFunc = m_taskList.Where(t => MatchTime(t.ExcuteTime, DateTime.Now)).ToList();
foreach (TimerTask task in listFunc)
{
switch (task.Mode)
{
case 0:
{
m_taskList.Remove(task);
}
break;
case 1:
{
task.ExcuteTime = task.ExcuteTime.AddDays(1);
}
break;
case 2:
{
task.ExcuteTime = task.ExcuteTime.AddHours(1);
}
break;
case 3:
{
task.ExcuteTime = task.ExcuteTime.AddMinutes(1);
}
break;
}
m_taskFactory.StartNew(() =>
{
TimerTask _this = task;
_this.CallBack();
});
}
Thread.Sleep(1000);
}
m_task = null;
});
}
}
19
Source : ConsoleLogger.cs
with MIT License
from bonsai-rx
with MIT License
from bonsai-rx
public override Task LogAsync(ILogMessage message)
{
return Task.Factory.StartNew(() => Log(message));
}
19
Source : BrokerageMultiWebSocketSubscriptionManager.cs
with Apache License 2.0
from Capnode
with Apache License 2.0
from Capnode
private void OnOpen(object sender, EventArgs e)
{
var webSocket = (IWebSocket)sender;
lock (_locker)
{
foreach (var entry in _webSocketEntries)
{
if (entry.WebSocket == webSocket && entry.Symbols.Count > 0)
{
Log.Trace($"BrokerageMultiWebSocketSubscriptionManager.Connect(): WebSocket opened: {webSocket.GetHashCode()} - Resubscribing existing symbols: {entry.Symbols.Count}");
Task.Factory.StartNew(() =>
{
foreach (var symbol in entry.Symbols)
{
_subscribeFunc(webSocket, symbol);
}
});
}
}
}
}
19
Source : RandomDataClient.cs
with MIT License
from capslocky
with MIT License
from capslocky
public void StartThreads()
{
string[] locations = { "Berlin", "Praha", "Brussels" };
int reportCount = 10;
foreach (string location in locations)
{
Task.Factory.StartNew(() => SendReportSeries(location, reportCount));
Task.Factory.StartNew(() => WatchLastReport(location));
Task.Factory.StartNew(() => WatchForecast(location, 4));
}
}
19
Source : LogProfile.cs
with MIT License
from carina-studio
with MIT License
from carina-studio
public static async Task<LogProfile> LoadProfileAsync(IULogViewerApplication app, string fileName)
{
// load JSON doreplacedent
var jsonDoreplacedent = await ioTaskFactory.StartNew(() =>
{
using var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
return JsonDoreplacedent.Parse(stream);
});
// prepare profile
var profile = new LogProfile(app);
// load profile
await ioTaskFactory.StartNew(() => profile.LoadFromJson(jsonDoreplacedent.RootElement));
if (string.IsNullOrEmpty(profile.name))
profile.name = Path.GetFileNameWithoutExtension(fileName);
profile.FileName = fileName;
// validate
profile.Validate();
// complete
return profile;
}
19
Source : LogProfile.cs
with MIT License
from carina-studio
with MIT License
from carina-studio
public static async Task WaitForIOCompletionAsync() => await ioTaskFactory.StartNew(() => { });
19
Source : LogProfile.cs
with MIT License
from carina-studio
with MIT License
from carina-studio
public static async Task<LogProfile> LoadBuiltInProfileAsync(IULogViewerApplication app, string id)
{
// load JSON doreplacedent
var jsonDoreplacedent = await ioTaskFactory.StartNew(() =>
{
using var stream = replacedembly.GetExecutingreplacedembly().GetManifestResourceStream($"CarinaStudio.ULogViewer.Logs.Profiles.BuiltIn.{id}.json") ?? throw new ArgumentException($"Cannot find built-in profile '{id}'.");
return JsonDoreplacedent.Parse(stream);
});
// prepare profile
var profile = new LogProfile(app, id);
// load profile
await ioTaskFactory.StartNew(() => profile.LoadFromJson(jsonDoreplacedent.RootElement));
profile.isPinned = app.PersistentState.GetValueOrDefault(profile.isPinnedSettingKey.AsNonNull());
// validate
profile.Validate();
// complete
return profile;
}
19
Source : DisplayableLogFilter.cs
with MIT License
from carina-studio
with MIT License
from carina-studio
void FilterNextChunk(FilteringParams filteringParams)
{
// check state
if (this.currentFilterParams != filteringParams)
return;
if (this.unfilteredLogs.IsEmpty())
{
if (this.IsFiltering)
{
this.IsFiltering = false;
this.FilteringProgress = 1;
this.OnPropertyChanged(nameof(FilteringProgress));
this.OnPropertyChanged(nameof(IsFiltering));
}
return;
}
if (filteringParams.ConcurrencyLevel >= this.maxFilteringConcurrencyLevel)
return;
// update state
if (!this.IsFiltering)
{
this.IsFiltering = true;
this.OnPropertyChanged(nameof(IsFiltering));
}
this.FilteringProgress = 1.0 - ((double)this.unfilteredLogs.Count / this.SourceLogs.Count);
this.OnPropertyChanged(nameof(FilteringProgress));
// start filtering
var chunkId = filteringParams.NextChunkId++;
var logs = this.unfilteredLogs.Let(it =>
{
if (it.Count <= ChunkSize)
{
var array = it.ToArray();
it.Clear();
return array;
}
else
{
var index = it.Count - ChunkSize;
var array = it.ToArray(index, ChunkSize);
it.RemoveRange(index, ChunkSize);
return array;
}
});
var logVersions = new byte[logs.Length].Also(it =>
{
var sourceLogs = this.SourceLogs;
var sourceLogVersions = this.sourceLogVersions;
var comparer = this.unfilteredLogs.Comparer;
var logCount = it.Length;
var unfilteredIndex = 0;
var sourceIndex = sourceLogs.IndexOf(logs[0]);
while (sourceIndex < 0 && unfilteredIndex < logCount - 1)
sourceIndex = sourceLogs.IndexOf(logs[++unfilteredIndex]);
if (unfilteredIndex < logCount && sourceIndex >= 0)
{
while (true)
{
it[unfilteredIndex++] = sourceLogVersions[sourceIndex--];
if (unfilteredIndex >= logCount || sourceIndex < 0)
break;
var comparisonResult = comparer.Compare(logs[unfilteredIndex], sourceLogs[sourceIndex]);
if (comparisonResult == 0)
continue;
if (comparisonResult < 0)
{
++unfilteredIndex;
if (unfilteredIndex >= logCount)
break;
}
else
{
--sourceIndex;
if (sourceIndex < 0)
break;
}
}
}
});
++filteringParams.ConcurrencyLevel;
this.filteringTaskFactory.StartNew(() => this.FilterChunk(filteringParams, chunkId, logs, logVersions));
}
19
Source : PendingUpdatesManager.cs
with MIT License
from centaurus-project
with MIT License
from centaurus-project
private async Task ApplyUpdates(DiffObject updates)
{
try
{
var sw = new Stopwatch();
sw.Start();
var retries = await Context.PersistenceManager.ApplyUpdates(updates);
sw.Stop();
var batchInfo = new BatchSavedInfo
{
SavedAt = DateTime.UtcNow,
QuantaCount = updates.Quanta.Count,
EffectsCount = updates.EffectsCount,
ElapsedMilliseconds = sw.ElapsedMilliseconds,
Retries = retries
};
_ = Task.Factory.StartNew(() => OnBatchSaved?.Invoke(batchInfo));
}
catch (Exception exc)
{
//we need to cancel all pending updates
cancellationTokenSource.Cancel();
if (Context.AppState.State != ApplicationState.Failed)
OnSaveFailed("Error on saving updates.", exc);
}
}
19
Source : Connection.cs
with MIT License
from centaurus-project
with MIT License
from centaurus-project
private async Task Listen()
{
try
{
while (webSocket.State != WebSocketState.Closed && webSocket.State != WebSocketState.Aborted && !cancellationTokenSource.Token.IsCancellationRequested)
{
var messageType = await webSocket.GetWebsocketBuffer(readerBuffer, cancellationTokenSource.Token);
if (cancellationTokenSource.Token.IsCancellationRequested) break;
//the client send close message
if (messageType == WebSocketMessageType.Close)
{
if (webSocket.State != WebSocketState.CloseReceived) continue;
await sendMessageSemapreplaced.WaitAsync();
try
{
await webSocket.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "Close", CancellationToken.None);
}
finally
{
sendMessageSemapreplaced.Release();
cancellationTokenSource.Cancel();
}
continue;
}
try
{
var envelope = XdrConverter.Deserialize<MessageEnvelope>(new XdrBufferReader(readerBuffer.Buffer));
OnMessage.Invoke(envelope);
}
catch
{
OnException?.Invoke(new UnexpectedMessageException("Failed to deserialize a response message received from the server."));
}
}
}
catch (OperationCanceledException)
{ }
catch (Exception e)
{
var status = WebSocketCloseStatus.InternalServerError;
//connection has been already closed by the other side
if ((e as WebSocketException)?.WebSocketErrorCode == WebSocketError.ConnectionClosedPrematurely) return;
string errorDescription = null;
if (e is ConnectionCloseException closeException)
{
status = closeException.Status;
errorDescription = closeException.Description;
}
else if (e is FormatException)
{
status = WebSocketCloseStatus.ProtocolError;
}
else
{
logger.Error(e);
}
await CloseConnection(status, errorDescription);
}
finally
{
_ = Task.Factory.StartNew(() => OnClose?.Invoke());
}
}
19
Source : MockWebSocket.cs
with MIT License
from centaurus-project
with MIT License
from centaurus-project
public override void Abort()
{
state = WebSocketState.Aborted;
if (secondPartyWebsocket != null)
Task.Factory.StartNew(secondPartyWebsocket.SetClosed);
}
19
Source : CentaurusClient.cs
with MIT License
from centaurus-project
with MIT License
from centaurus-project
public async Task Connect()
{
try
{
if (connection.IsConnected) return;
//initialize a connection
connection = new Connection(Config);
//subscribe to events
connection.OnClose += Connection_OnClose;
connection.OnException += Connection_OnException;
//try to connect
await connection.Connect();
//fetch current account state
AccountState = await GetAccountData();
//track state on the client side
if (AccountState != null && OnAccountUpdate != null)
{
_ = Task.Factory.StartNew(() => OnAccountUpdate.Invoke(AccountState));
}
}
catch (Exception e)
{
//failed to connect - dispose everything
if (connection != null)
{
await connection.CloseConnection(WebSocketCloseStatus.ProtocolError);
connection.Dispose();
connection = null;
}
throw new Exception("Failed to connect to Centaurus Alpha server", e);
}
}
19
Source : ChartWindow.xaml.cs
with Apache License 2.0
from chancezheng
with Apache License 2.0
from chancezheng
private void Read()
{
if (IsReading) return;
//lets keep in memory only the last 20000 records,
//to keep everything running faster
const int keepRecords = 20000;
IsReading = true;
Action readFromTread = () =>
{
while (IsReading)
{
Thread.Sleep(1);
var r = new Random();
_trend += (r.NextDouble() < 0.5 ? 1 : -1) * r.Next(0, 10) * .001;
//when multi threading avoid indexed calls like -> Values[0]
//instead enumerate the collection
//ChartValues/GearedValues returns a thread safe copy once you enumerate it.
//TIPS: use foreach instead of for
//LINQ methods also enumerate the collections
var first = LineValues.DefaultIfEmpty(0).FirstOrDefault();
if (LineValues.Count > keepRecords - 1) LineValues.Remove(first);
if (LineValues.Count < keepRecords) LineValues.Add(_trend);
IsHot = _trend > 0;
Count = LineValues.Count;
CurrentLecture = _trend;
}
};
//2 different tasks adding a value every ms
//add as many tasks as you want to test this feature
Task.Factory.StartNew(readFromTread);
//Task.Factory.StartNew(readFromTread);
//Task.Factory.StartNew(readFromTread);
//Task.Factory.StartNew(readFromTread);
//Task.Factory.StartNew(readFromTread);
//Task.Factory.StartNew(readFromTread);
//Task.Factory.StartNew(readFromTread);
//Task.Factory.StartNew(readFromTread);
}
19
Source : MedicalReportViewModel.cs
with Apache License 2.0
from chancezheng
with Apache License 2.0
from chancezheng
protected async void Refresh()
{
ObservableCollection<PatientExtention> tsNew = new ObservableCollection<PatientExtention>();
await Task.Factory.StartNew(() =>
{
SelectedCount = 0;
tsNew = GetPatientData(); //刷新后不记住选择
//tsNew = PatientsInformation; //刷新后记住选择
PatientsInformation = null;
Thread.Sleep(200);
PatientsInformation = tsNew;
});
//CommandManager.InvalidateRequerySuggested();
//Task.Factory.StartNew(() => Console.WriteLine(123), new CancellationTokenSource().Token,
// TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()).Wait();
}
19
Source : DatabaseObjectAutoCleanUpTest.cs
with MIT License
from christiandelbianco
with MIT License
from christiandelbianco
[TestCategory("SqlServer")]
[TestMethod]
public void TestStopWhileStillInserting()
{
SqlTableDependency<DatabaseObjectCleanUpTestSqlServerModel> tableDependency = new SqlTableDependency<DatabaseObjectCleanUpTestSqlServerModel>(
ConnectionStringForTestUser,
tableName: TableName);
string objectNaming = tableDependency.DataBaseObjectsNamingConvention;
tableDependency.OnChanged += (sender, e) => { };
objectNaming = tableDependency.DataBaseObjectsNamingConvention;
tableDependency.Start();
Thread.Sleep(1000);
// Run async tasks insering 1000 rows in table every 250 milliseconds
var task1 = Task.Factory.StartNew(() => ModifyTableContent());
var task2 = Task.Factory.StartNew(() => ModifyTableContent());
var task3 = Task.Factory.StartNew(() => ModifyTableContent());
Thread.Sleep(5000);
tableDependency.Stop();
Thread.Sleep(5000);
replacedert.IsTrue(base.AreAllDbObjectDisposed(objectNaming));
replacedert.IsTrue(base.CountConversationEndpoints(objectNaming) == 0);
}
19
Source : DatabaseObjectAutoCleanUpTest.cs
with MIT License
from christiandelbianco
with MIT License
from christiandelbianco
[TestCategory("SqlServer")]
[TestMethod]
public void TestCollapsingTheAppDomain()
{
var domaininfo = new AppDomainSetup { ApplicationBase = Environment.CurrentDirectory };
var adevidence = AppDomain.CurrentDomain.Evidence;
var domain = AppDomain.CreateDomain("RunsInAnotherAppDomain_Check_DatabaseObjectCleanUp", adevidence, domaininfo);
var otherDomainObject = (RunsInAnotherAppDomainCheckDatabaseObjectCleanUp)domain.CreateInstanceAndUnwrap(typeof(RunsInAnotherAppDomainCheckDatabaseObjectCleanUp).replacedembly.FullName, typeof(RunsInAnotherAppDomainCheckDatabaseObjectCleanUp).FullName);
_dbObjectsNaming = otherDomainObject.RunTableDependency(ConnectionStringForTestUser, tableName: TableName);
Thread.Sleep(1000);
// Run async tasks insering 1000 rows in table every 250 milliseconds
var task1 = Task.Factory.StartNew(() => ModifyTableContent());
var task2 = Task.Factory.StartNew(() => ModifyTableContent());
var task3 = Task.Factory.StartNew(() => ModifyTableContent());
// Wait 5 seconds and then collapse the app domain where sqltabledependency is running
Thread.Sleep(5000);
AppDomain.Unload(domain);
// After 3 minutes, even if the background thread is still inserting data in table, db objects must be removed
Thread.Sleep(3 * 60 * 1000);
replacedert.IsTrue(base.AreAllDbObjectDisposed(_dbObjectsNaming));
replacedert.IsTrue(base.CountConversationEndpoints(_dbObjectsNaming) == 0);
// Wait a minute in order to let the task complete and not interfeer with other tests!
Thread.Sleep(1 * 60 * 1000);
}
19
Source : MultiDmlOperationsTest.cs
with MIT License
from christiandelbianco
with MIT License
from christiandelbianco
[TestCategory("SqlServer")]
[TestMethod]
public void ThreeUpdateTest()
{
using (var sqlConnection = new SqlConnection(ConnectionStringForTestUser))
{
sqlConnection.Open();
using (var sqlCommand = sqlConnection.CreateCommand())
{
foreach (var item in InitialValues)
{
sqlCommand.CommandText = $"INSERT INTO [{TableName}] ([First Name], [Second Name]) VALUES ('{item.Name}', '{item.Surname}')";
sqlCommand.ExecuteNonQuery();
}
}
}
ModifiedValues.Clear();
SqlTableDependency<MultiDmlOperationsTestSqlServerModel> tableDependency = null;
try
{
var mapper = new ModelToTableMapper<MultiDmlOperationsTestSqlServerModel>();
mapper.AddMapping(c => c.Name, "FIRST name");
mapper.AddMapping(c => c.Surname, "Second Name");
tableDependency = new SqlTableDependency<MultiDmlOperationsTestSqlServerModel>(ConnectionStringForTestUser, tableName: TableName, mapper: mapper);
tableDependency.OnChanged += this.TableDependency_Changed;
tableDependency.OnError += this.TableDependency_OnError;
tableDependency.Start();
Task.Factory.StartNew(() => MultiUpdateOperation("xxx"));
Thread.Sleep(1000 * 15 * 1);
}
finally
{
tableDependency?.Dispose();
}
replacedert.AreEqual(3, ModifiedValues.Count);
replacedert.AreEqual(ModifiedValues[0].Name, "xxx");
replacedert.AreEqual(ModifiedValues[1].Name, "xxx");
replacedert.AreEqual(ModifiedValues[2].Name, "xxx");
}
19
Source : MultiDmlOperationsTest.cs
with MIT License
from christiandelbianco
with MIT License
from christiandelbianco
[TestCategory("SqlServer")]
[TestMethod]
public void TwoUpdateTest()
{
using (var sqlConnection = new SqlConnection(ConnectionStringForTestUser))
{
sqlConnection.Open();
using (var sqlCommand = sqlConnection.CreateCommand())
{
foreach (var item in InitialValues)
{
sqlCommand.CommandText = $"INSERT INTO [{TableName}] ([First Name], [Second Name]) VALUES ('{item.Name}', '{item.Surname}')";
sqlCommand.ExecuteNonQuery();
}
}
}
ModifiedValues.Clear();
SqlTableDependency<MultiDmlOperationsTestSqlServerModel> tableDependency = null;
try
{
var mapper = new ModelToTableMapper<MultiDmlOperationsTestSqlServerModel>();
mapper.AddMapping(c => c.Name, "FIRST name");
mapper.AddMapping(c => c.Surname, "Second Name");
tableDependency = new SqlTableDependency<MultiDmlOperationsTestSqlServerModel>(ConnectionStringForTestUser, tableName: TableName, mapper: mapper);
tableDependency.OnChanged += this.TableDependency_Changed;
tableDependency.OnError += this.TableDependency_OnError;
tableDependency.Start();
Task.Factory.StartNew(() => MultiUpdateOperation("VELIA"));
Thread.Sleep(1000 * 15 * 1);
}
finally
{
tableDependency?.Dispose();
}
replacedert.AreEqual(2, ModifiedValues.Count);
replacedert.AreEqual(ModifiedValues[0].Name, "VELIA");
replacedert.AreEqual(ModifiedValues[1].Name, "VELIA");
}
See More Examples