task

Is there a way to cancel execution of method in cancelled task?

旧城冷巷雨未停 提交于 2019-12-11 18:32:45
问题 I have a problem, that I could not find any answear yet. And this is my first project with use of threading and Tasks. When my task is cancelled, it keeps executing time consuming method. Right now I have not idea how to stop execution of the method together with the task. Below is a loop, that runs tasks. Every single task is running a ParseHorseData method, that runs also several other methods. Execution of them takes sometimes a lot of time. After the task is cancelled, before await Task

Generic Task<object> method

☆樱花仙子☆ 提交于 2019-12-11 18:29:50
问题 I have class to consuming my REST service. Method for this will look like this: public async Task<object> Get(string controller) { object data; HttpResponseMessage response = await this.HttpClient.GetAsync(UrlService.BuildEndpoint(controller)); if (response.IsSuccessStatusCode) { data = await response.Content.ReadAsAsync<object>(); return data; } else { throw new Exception(); //todo } } in this case, object can be like my own class ( Project , User etc) with propertys. My question is, how to

XML Task error message hexadecimal invalid character

走远了吗. 提交于 2019-12-11 18:26:45
问题 I am developing a SSIS package to add data from an XML file to an existing SQL Server table. I have completed several similar projects, but on this XML file I am getting the error from the Data Flow tab between the XML Task and Data Flow Task: Error: 0xC002F304 at XML Task, XML Task: An error occurred with the following error message: "'', hexadecimal value 0x15, is an invalid character. Line 28, position 54.". Error: 0xC002928F at XML Task, XML Task: Property "New Source" has no source Xml

Android - how to run a task via “handler” periodically within a service-intent (worker-thread)

十年热恋 提交于 2019-12-11 18:17:05
问题 My question is Android related: How do I run a task every 20 seconds within an intentservice ? Problem is, I have to init some classes which will be used in the Handler "run" process. It works one time - but then the service stops & the application crashes when the handler-loop starts again after 20 seconds (probably because of the classes that got eliminated when the service stopped?). So maybe the solution is to get the service to stay running as long as the Handler runs or to throw away

It takes more than a few seconds for a task to start running

馋奶兔 提交于 2019-12-11 17:42:41
问题 I'm developing an application using WPF and C# . I have the following code: var tokenSource = new CancellationTokenSource(); CancellationToken token = tokenSource.Token; Task task = Task.Factory.StartNew(() => { // Some action that returns a boolean - **CODE_A** }).ContinueWith((task2) => { result= task2.Result; if (!result) { //Another action **CODE_B** } }); }, token); Usually CODE_A starts running immediately, and after less than a second, CODE_B starts executing. But, sometimes it takes

How to optimize the loading of a big amout of images?

早过忘川 提交于 2019-12-11 17:35:34
问题 I upload a large number of images from a REST service and use them to create various gif image thanks to a periodic task. I'd like to know how to optimize my code, to impove it and make it faster. public class WebcamListViewModel : BaseViewModel { public ICommand InitializeWebcamsCommand { set; get; } public ICommand OpenVideoWebcamCommand { set; get; } private List<Webcam> _ListOfWebcam { get; set; } public List<Webcam> ListOfWebcam { get { return _ListOfWebcam; } set { _ListOfWebcam = value

VSTS anybody managed to use “secure file” in azure-pipelines.yml?

断了今生、忘了曾经 提交于 2019-12-11 17:16:40
问题 I would like to use "download secure file" in a dev azure task - and that works exactly as expected within a task in "release pipeline" (in "Releases"). However, when I try to do the same in a "Builds" task in azure-pipelines.yml I get "file some-uuid not found". From the official documentation I cannot find any difference if a custom task is used in "Builds" or "Releases" - it just refers to tasks no matter where it is being used - Is there anything I can do to access one of my secure files

Make Outlook Task item through Excel Button

 ̄綄美尐妖づ 提交于 2019-12-11 16:56:03
问题 I want to make a simple program in which I can create an Outlook Task. User fills in data and clicks the create button. I found the following code online and it should work, but it doesn't. No task is added in my Outlook, but no error is shown either. I have the feeling it somehow goes wrong with adding the recipients of the task. Any clue why I don't get an error but, no tasks are added? Dim OutApp As Outlook.Application Dim OutTask As Outlook.TaskItem Set OutApp = CreateObject("Outlook

Launching a long running task from an AlertDialog (Android)

半世苍凉 提交于 2019-12-11 16:53:21
问题 I have an AlertDialog in and it's got a button, which, if selected, will initiate a file upload to a remote server like this: builder.setMessage(text) .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { uploadFile(); }}) This works fine, the only problem is that uploadFile() can potentially take a long time (30 seconds to 2 minutes). I would like to replace the AlertDialog with a progress dialog (even an

How can I get the current CodeDomProvider in an MSBuild Task

北城余情 提交于 2019-12-11 14:29:31
问题 I have a task and I want to generate some code using the CodeDom. How can I get either the current "language" or the CodeDomProvider for the current project calling my task? 回答1: Ok I managed to figure it out eventually: Geting a CodeDomProvider in an MSBuild Task 来源: https://stackoverflow.com/questions/395313/how-can-i-get-the-current-codedomprovider-in-an-msbuild-task