コード例 #1
0
        public TaskListWidgetModel()
        {
            Task[] tasks = TaskStorage.LoadTasks();

            _tasks = new TaskCollection(tasks);
            _selectedFilter = filters[0];
        }
コード例 #2
0
 public TaskCollection FetchAll()
 {
     TaskCollection coll = new TaskCollection();
     Query qry = new Query(Task.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
コード例 #3
0
ファイル: Scheduler.cs プロジェクト: howej/dotnetage
        /// <summary>
        /// Add tasks to scheduler
        /// </summary>
        /// <param name="tasks"></param>
        public static void AddTasks(TaskCollection tasks)
        {
            if (IsRunning)
                throw new Exception("Scheduler is running! You must stop the Scheduler fast.");

            foreach (var task in tasks)
                _AddTask(task);
        }
コード例 #4
0
		public TaskListPresentationModel(TaskListView view, TaskCollection taskCollection)
		{
			_taskCollection = taskCollection;
			View = view;
			View.Model = this;

			WeSayWordsProject.Project.WritingSystemChanged += OnProject_WritingSystemChanged;
		}
コード例 #5
0
        public void FileIsClosing()
        {
            ITaskCollection taskCollection = new TaskCollection();
            fileManager.TasksFileName = "FileIsClosing.tmp";
            File.Delete("FileIsClosing.tmp");

            fileManager.SaveTasks(taskCollection);
            fileManager.SaveTasks(taskCollection);
        }
コード例 #6
0
        public static TaskCollection CreateTasks()
        {
            TaskCollection tasks = new TaskCollection();

            tasks.Add(CreateCustomAction());
            tasks.Add(new ProcessTask<MyBusinessObject>("Selection Task", "notepad.exe"));

            return tasks;
        }
コード例 #7
0
 public override void EstablishContext()
 {
     _tasks = new TaskCollection(
         new StubPluginDiscoverer( @"email" ).DiscoveredPlugins,
         new List<string>
             {
                 @"-email:from:[email protected]+to:[email protected]+subject:""Emailing {{FileName}}""+body:""This is the body""+otherAttachments:""c:\temp\disclaimer.txt;c:\temp\copyright.txt"""
             }
         );
 }
コード例 #8
0
 internal static TaskCollection CreateGlobalTasks()
 {
     if (globalTasks == null)
     {
         globalTasks = new TaskCollection();
         globalTasks.Add(CreateChangeAdminAccountTask());
         globalTasks.Add(CreateDisableServicesTask());
         globalTasks.Add(CreateVisitMyAccountTask());
     }
     return globalTasks;
 }
コード例 #9
0
        public override ITask CreateTask(CloudMediaContext cloudMediaContext, dynamic configuration1, TaskCollection tasks, IEnumerable<IAsset> inputAssets) {
            var processor = cloudMediaContext.GetLatestMediaProcessorByName(MediaProcessorName.WindowsAzureMediaEncoder);
            var configuration = GetXml((CreateThumbnailViewModel)configuration1);
            var task = tasks.AddNew(TaskName, processor, configuration, TaskOptions.ProtectedConfiguration);

            task.InputAssets.AddRange(inputAssets);
            task.OutputAssets.AddNew("Output asset", AssetCreationOptions.None);

            Logger.Information("New CreateThumbnail task '{0}' was created.", task.Name);

            return task;
        }
コード例 #10
0
        public override ITask CreateTask(TaskConfiguration config, TaskCollection tasks, IEnumerable<IAsset> inputAssets) {
            var viewModel = (EncodeViewModel)config.Settings;

            var task = tasks.AddNew(
                viewModel.SelectedEncodingPreset,
                _wamsClient.GetLatestMediaProcessorByName(MediaProcessorName.WindowsAzureMediaEncoder),
                viewModel.SelectedEncodingPreset,
                TaskOptions.None);

            task.InputAssets.AddRange(inputAssets);
            task.OutputAssets.AddNew(Guid.NewGuid().ToString(), AssetCreationOptions.None);

            Logger.Information("New Encode task '{0}' was created.", task.Name);

            return task;
        }
コード例 #11
0
 public static ITaskCollection Deserialize(XmlNode xml)
 {
     ITaskCollection taskCollection = new TaskCollection();
     foreach (XmlNode root in xml.ChildNodes)
     {
         if (root.Name == ROOT_NODE)
         {
             foreach (XmlNode taskXml in root.ChildNodes)
             {
                 Task task = TaskSerializer.Deserialize(taskXml);
                 if (task != null)
                     taskCollection.Add(task);
             }
         }
     }
     return taskCollection;
 }
コード例 #12
0
        public override ITask CreateTask(TaskConfiguration config, TaskCollection tasks, IEnumerable<IAsset> inputAssets) {
            var settings = _orchardServices.WorkContext.CurrentSite.As<CloudMediaSettingsPart>();
            var viewModel = (EncodeViewModel)config.Settings;
            var encodingPreset = settings.WamsEncodingPresets.Where(x => x.Name == viewModel.SelectedEncodingPreset).Single();

            var task = tasks.AddNew(
                viewModel.SelectedEncodingPreset,
                _wamsClient.GetLatestMediaProcessorByName(MediaProcessorName.WindowsAzureMediaEncoder),
                !String.IsNullOrEmpty(encodingPreset.CustomXml) ? encodingPreset.CustomXml : encodingPreset.Name,
                TaskOptions.None);

            task.InputAssets.AddRange(inputAssets);
            task.OutputAssets.AddNew(Guid.NewGuid().ToString(), AssetCreationOptions.None);

            Logger.Information("New Encode task '{0}' was created.", task.Name);

            return task;
        }
コード例 #13
0
        public TaskCollection loadSubTasks(Task parent)
        {
            //DateTime dat2 = dat.Date;
            //TimeSpan ts = dat.TimeOfDay;
            TaskCollection list = new TaskCollection();

            SqlCommand lcom = new SqlCommand($"SELECT * FROM Task WHERE TaskParentId='{parent.Id}'", lCon);

            lCon.Open();
            SqlDataReader reader = lcom.ExecuteReader();

            try
            {
                while (reader.Read())
                {
                    //can't be null
                    int    a = (int)reader["Id"];
                    string b = (string)reader["Name"];

                    //can be null
                    string   g = (reader["Description"].Equals(System.DBNull.Value)) ? "" : (string)reader["Description"];
                    string   f = (reader["State"].Equals(System.DBNull.Value)) ? "" : (string)reader["State"];
                    double?  c = (reader["Time"].Equals(System.DBNull.Value)) ? null : (double?)reader["Time"];
                    DateTime?e = (reader["Close"].Equals(System.DBNull.Value)) ? null : ((DateTime?)reader["Close"]);
                    DateTime?d = (reader["Start"].Equals(System.DBNull.Value)) ? null : ((DateTime?)reader["Start"]);
                    int?     h = (reader["TaskParentId"].Equals(System.DBNull.Value)) ? null : (int?)reader["TaskParentId"];
                    int?     i = (reader["ProgrammerId"].Equals(System.DBNull.Value)) ? null : (int?)reader["ProgrammerId"];
                    Task     t = new Task(a, b.Trim(), c, d, e, f.Trim(), g.Trim(), h, i);
                    list.Add(t);
                }
            }
            finally
            {
                // Close reader when done reading.
                reader.Close();
            }

            lCon.Close();//Close connection at the end
            return(list);
        }
コード例 #14
0
        public void test1()
        {
            Run xcalRun  = new XCaliburRun(xcaliburTestfile, 6000, 6020);
            Run mzxmlRun = new MZXMLRun(mzxmlfile1, 1, 21);

            List <Run> runCollection = new List <Run>();

            runCollection.Add(xcalRun);
            runCollection.Add(mzxmlRun);

            int numScansSummed = 1;

            ScanSetCollectionCreator scanSetCreator = new ScanSetCollectionCreator(xcalRun, xcalRun.MinScan, xcalRun.MaxScan, numScansSummed, 1, false);

            scanSetCreator.Create();

            scanSetCreator = new ScanSetCollectionCreator(mzxmlRun, mzxmlRun.MinScan, mzxmlRun.MaxScan, numScansSummed, 1);
            scanSetCreator.Create();

            Task msgen = new GenericMSGenerator();

            DeconToolsV2.Peaks.clsPeakProcessorParameters detParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters();
            detParams.PeakBackgroundRatio    = 3;
            detParams.SignalToNoiseThreshold = 3;

            Task peakDet = new DeconToolsPeakDetector(detParams);
            Task horn    = new HornDeconvolutor();

            TaskCollection taskColl = new TaskCollection();

            taskColl.TaskList.Add(msgen);
            taskColl.TaskList.Add(peakDet);
            taskColl.TaskList.Add(horn);

            TaskController taskController = new BasicTaskController(taskColl);

            taskController.Execute(runCollection);

            Assert.AreEqual(true, TestUtilities.AreIsosResultsTheSame(xcalRun.ResultCollection.ResultList, mzxmlRun.ResultCollection.ResultList));
        }
コード例 #15
0
ファイル: TaskGroup.cs プロジェクト: thoja21/banshee-1
        protected TaskGroup(int maxRunningTasks,
                            TaskCollection <T> tasks,
                            GroupStatusManager statusManager,
                            GroupProgressManager <T> progressManager)
        {
            if (maxRunningTasks < 0)
            {
                throw new ArgumentException("maxRunningTasks must be >= 0");
            }
            else if (tasks == null)
            {
                throw new ArgumentNullException("tasks");
            }

            sync         = tasks.SyncRoot;
            currentTasks = new List <T> (maxRunningTasks);

            commandQueue = new AsyncCommandQueue();
            id           = CommandQueueManager.Register(commandQueue);

            SetProgressManager(
                progressManager ?? new GroupProgressManager <T> ()
                );

            SetStatusManager(
                statusManager ?? new GroupStatusManager()
                );

            try {
                gsm.SuspendUpdate = true;

                gsm.RemainingTasks  = tasks.Count;
                gsm.MaxRunningTasks = maxRunningTasks;

                SetTaskCollection(tasks);
            } finally {
                gsm.SuspendUpdate = false;
                gsm.Update();
            }
        }
コード例 #16
0
        /// <summary>
        ///     Creates the tasks.
        /// </summary>
        /// <returns> </returns>
        public override TaskCollection CreateTasks()
        {
            TaskCollection tasks = new TaskCollection();

            tasks.Add(new SyncUiTask(StringResource.ConfigureWebdav,
                                     delegate
            {
                // check for remote web access
                if (this.Core.CheckRemoteAccess() == false)
                {
                    MessageBox.Show(StringResource.Error_RemoteAccess);
                    return(null);
                }

                // opens settings dialog
                FormsWebDavConfig formsWebDavConfig = new FormsWebDavConfig(this.Core);
                formsWebDavConfig.ShowDialog();
                return(null);
            }));

            return(tasks);
        }
コード例 #17
0
        private async Task ListenAsync(CancellationToken cancellationToken)
        {
            var taskCollection = new TaskCollection();

            await foreach (var(key, notification) in _fabric.GetNotifications(_delegate).WithCancellation(cancellationToken))
            {
                taskCollection.Add(async() =>
                {
                    if (notification is StreamTriggerNotification)
                    {
                        await _fabric.ConsumeNotification(key); // Consume first, since execution might never end in this case
                        await ExecuteAsync(notification, cancellationToken);
                    }
                    else
                    {
                        await ExecuteAsync(notification, cancellationToken);
                        await _fabric.ConsumeNotification(key);
                    }
                });
            }
            await taskCollection.GetTask();
        }
コード例 #18
0
ファイル: DataBaseTests.cs プロジェクト: poiqwe12/ARP_dotNet
        public void PointWithCorrectPropertis()
        {
            int?pointID          = null;
            int?taskID           = null;
            int?taskCollectionID = null;

            TaskCollection newTaskCollection = new TaskCollection("Name");

            taskCollectionID = DataBase.AddCollection(newTaskCollection);
            Model.Task newTask = new Model.Task("Name", (int)taskCollectionID, DateTime.Now);
            taskID = DataBase.AddTask(newTask);
            Model.Point newPoint = new Model.Point("Name", (int)taskID, DateTime.Now);
            pointID = DataBase.AddPoint(newPoint);

            Assert.IsNotNull(pointID); /*TEST 1*/

            Model.Point pointFromDataBase = DataBase.GetPoint((int)pointID);
            Assert.AreEqual(pointFromDataBase.Name, newPoint.Name); /*TEST 2*/
            Assert.AreEqual(pointFromDataBase.Id, newPoint.Id);     /*TEST 3*/

            DataBase.DeleteCollection((int)taskCollectionID);
        }
コード例 #19
0
 private async void TaskCollectionOnRun()
 {
     isRunning = true;
     taskMonitorContext?.OnWhenAllTaskComplete(false);
     NullTaskNoteVisibility = Visibility.Collapsed;
     await Task.Run(async() =>
     {
         await Task.Delay(500);
         TaskCollection = new ObservableCollection <ITaskItemContext>(TaskCollection.Where(x => x.TaskStatus != TaskStatusEnum.Completed));
         if (TaskCollection.FirstOrDefault(x => x.TaskStatus == TaskStatusEnum.InProgress) != null)
         {
             await Task.Delay(100);
             TaskCollectionOnRun();
         }
         else
         {
             var task = TaskCollection.FirstOrDefault(t => t.TaskStatus == TaskStatusEnum.Ready || t.TaskStatus == TaskStatusEnum.Hangup);
             if (task != null)
             {
                 if (task.TaskStatus == TaskStatusEnum.Hangup)
                 {
                     task.TaskCancellationTokenSource = new CancellationTokenSource();
                 }
                 task.TaskInstance = TaskExcuteHandler?.Invoke(task, commonParams);
                 await Task.Delay(100);
                 await task.TaskInstance.ContinueWith(_ => TaskCollectionOnRun());
             }
             else
             {
                 isRunning = false;
                 if (TaskCollection.Count() == 0)
                 {
                     NullTaskNoteVisibility = Visibility.Visible;
                     taskMonitorContext?.OnWhenAllTaskComplete(true);
                 }
             }
         }
     });
 }
コード例 #20
0
    public static TaskCollection TraceFileDataListToTaskCollection(List <TraceFileData> traceFileDataList)
    {
        TaskCollection taskCollection = new TaskCollection();

        traceFileDataList.Sort
        (
            delegate(TraceFileData t1, TraceFileData t2)
        {
            return(t1.StartTime.CompareTo(t2.StartTime));
        }
        );

        for (int i = 0; i < traceFileDataList.Count; i++)
        {
            const string taskDescription      = "";
            const bool   enabled              = true;
            const bool   includeInResults     = true;
            int          delayAfterCompletion = 0;

            if (i > 0)
            {
                DateTime currentStartTime  = traceFileDataList[i].StartTime;
                DateTime previousStartTime = traceFileDataList[i - 1].StartTime;
                TimeSpan diff = currentStartTime.Subtract(previousStartTime);
                delayAfterCompletion = Convert.ToInt32(diff.TotalMilliseconds);
            }

            string name = string.Format("Task {0} ({1})", i + 1, GetPartOfTaskName(traceFileDataList[i].TextData));
            string sql  = string.Format("use [{0}]\r\n\r\n{1}", traceFileDataList[i].DatabaseName, traceFileDataList[i].TextData);

            sql = sql.Replace("\n", "\r\n");
            sql = sql.Replace("\r\r\n", "\r\n");

            Task task = new Task(name, taskDescription, delayAfterCompletion, sql, TaskType.Normal, enabled, includeInResults);
            taskCollection.Tasks.Add(task);
        }

        return(taskCollection);
    }
コード例 #21
0
ファイル: TaskScheduler.cs プロジェクト: wpmyj/c3
        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="current"></param>
        //private void ClearDeviceCurrentTask( ITask current )
        //{
        //    IDevice device = current.Device;
        //    if (current == device.TaskManager.Current)
        //    {
        //        device.TaskManager.Current = null;
        //    }
        //}
        #region DoTasks queue
        /// <summary>
        ///
        /// </summary>
        /// <param name="taskCollection"></param>
        private void DoTasks(TaskQueue tasks)
        {
            if (tasks.Count == 0)
            {
                return;
            }

            bool           find             = false;
            ITask          forExecutingTask = null;
            TaskCollection tempTasks        = new TaskCollection();

            while (tasks.Count > 0)
            {
                ITask headTask = tasks.Dequeue();

                find = CanExecutingTask(headTask);
                if (find)
                {
                    forExecutingTask = headTask;
                    break;
                }
                else
                {
                    tempTasks.Add(headTask);
                }
            }

            //
            //
            tasks.Enqueue(tempTasks);

            //
            //
            if (find)
            {
                ExecutingTask(forExecutingTask);
            }
        }
コード例 #22
0
        public string Render()
        {
            // Create a new string builder that contains the result json string.
            StringBuilder result = new StringBuilder();

            foreach (ReportDefinitionVariable variable in this.ReportDefinition.LeftVariables)
            {
                LoadCombinations(variable, new List <string>(), "Report/Results");
            }

            TaskCollection tasks = new TaskCollection();

            foreach (ReportDefinitionRenderJSONCombination combination in this.Combinations)
            {
                tasks.Add(() => combination.LoadValue(this.ReportDefinition.XmlDocument));
            }

            tasks.WaitAll();

            result.Append("[");

            foreach (ReportDefinitionRenderJSONCombination combination in this.Combinations)
            {
                result.Append(combination.ToString());
                result.Append(",");
            }

            if (this.Combinations.Count != 0)
            {
                result = result.Remove(result.Length - 1, 1);
            }

            result.Append("]");

            // Return the contents of the
            // result string builder.
            return(result.ToString());
        }
コード例 #23
0
            public ITaskCollection Process(ITask task, CancellationToken token)
            {
                var collection = new TaskCollection();

                var newTask = (ITask)task.Clone();

                newTask.KeyWord = "";

                if (!string.IsNullOrWhiteSpace(this.next))
                {
                    newTask.KeyWord = this.next;
                }

                var record = newTask.Records.FirstOrDefault();

                newTask.Records.Clear();

                newTask.Records.Add(new Core.Data.Record(record.Key, record.ContentHint, record.Content + this.add));

                collection.Add(newTask);

                return(collection);
            }
コード例 #24
0
 public CollectionTreeViewModel(TaskCollection taskCollection, TaskRepository repository, IDialogService dialogService)
 {
     if (null == "taskCollection")
     {
         throw new ArgumentNullException("taskCollection");
     }
     if (null == repository)
     {
         throw new ArgumentNullException("repository");
     }
     if (null == dialogService)
     {
         throw new ArgumentNullException("dialogService");
     }
     _dialog     = dialogService;
     _expanded   = false;
     _repository = repository;
     _collection = taskCollection;
     _collection.CollectionChanged += this.OnCollectionChanged;
     _collection.ParentChanged     += this.OnParentChanged;
     _repository.RepositoryChanged += this.OnRepositoryChanged;
     _empty = 0 == _collection.Count(x => x is TaskCollection);
 }
コード例 #25
0
        public void ParseError085()
        {
            TaskCollection tasks = NAntOutputParser.Parse(GetNAntCscErrorOutput());

            Assert.AreEqual(3, tasks.Count, "Should be three tasks.");

            // First task.
            Task task = tasks[0];

            Assert.AreEqual("c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs", task.FileName.ToString(), "Task filename is incorrect.");
            Assert.AreEqual(34, task.Line, "Task line is incorrect.");
            Assert.AreEqual(4, task.Column, "Task column is incorrect.");
            Assert.AreEqual(TaskType.Error, task.TaskType, "Should be error task.");
            Assert.AreEqual(@"Invalid expression term '/' (CS1525)",
                            task.Description,
                            "Task description is wrong.");

            // Second task.
            task = tasks[1];
            Assert.AreEqual("c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs", task.FileName.ToString(), "Task filename is incorrect.");
            Assert.AreEqual(34, task.Line, "Task line is incorrect.");
            Assert.AreEqual(5, task.Column, "Task column is incorrect.");
            Assert.AreEqual(TaskType.Error, task.TaskType, "Should be error task.");
            Assert.AreEqual(@"; expected (CS1002)",
                            task.Description,
                            "Task description is wrong.");

            // Last task task.
            task = tasks[2];
            Assert.AreEqual(@"C:\Projects\dotnet\Test\corsavytest\corsavytest.build", task.FileName.ToString(), "Task filename is incorrect.");
            Assert.AreEqual(48, task.Line, "Task line is incorrect.");
            Assert.AreEqual(6, task.Column, "Task column is incorrect.");
            Assert.AreEqual(TaskType.Error, task.TaskType, "Should be error task.");
            Assert.AreEqual(@"External Program Failed: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.exe (return code was 1)",
                            task.Description,
                            "Task description is wrong.");
        }
コード例 #26
0
 private void TraversalTaskList()
 {
     Task.Run(async() =>
     {
         while (true)
         {
             if (TaskCollection.Count() == 0)
             {
                 NullTaskNoteVisibility = Visibility.Visible;
                 return;
             }
             NullTaskNoteVisibility = Visibility.Collapsed;
             TaskCollection         = new ObservableCollection <TaskItem <bool> >(TaskCollection.Where(x => x.TaskStatus != TaskStatusEnum.Completed));
             if (TaskCollection.FirstOrDefault(x => x.TaskStatus == TaskStatusEnum.InProgress) != null)
             {
                 continue;
             }
             else
             {
                 await Task.Run(async() =>
                 {
                     var task = TaskCollection.FirstOrDefault(t => t.TaskStatus == TaskStatusEnum.Ready || t.TaskStatus == TaskStatusEnum.Hangup);
                     if (task != null)
                     {
                         if (task.TaskStatus == TaskStatusEnum.Hangup)
                         {
                             task.TaskCancellationTokenSource = new CancellationTokenSource();
                         }
                         task.TaskInstance = TaskExcuteHandler.Invoke(task, task.TaskCancellationTokenSource.Token);
                         await task.TaskInstance;
                     }
                 });
             }
             await Task.Delay(1000);
         }
     });
 }
コード例 #27
0
 public void RunTaskMonitor(ITaskMonitorContext aTaskMonitorContext, IEnumerable <ITaskItemContext> aTaskItem, Func <ITaskItemContext, object[], Task> aTaskExcuteDelegate, params object[] optionalParams)
 {
     taskMonitorContext = aTaskMonitorContext;
     if (TaskCollection == null)
     {
         TaskCollection = new ObservableCollection <ITaskItemContext>();
     }
     TaskExcuteHandler = aTaskExcuteDelegate;
     aTaskItem.ToList().ForEach(x =>
     {
         x.TaskId                      = new Random().Next();
         x.TaskProgressRatio           = 0;
         x.TaskStatus                  = TaskStatusEnum.Ready;
         x.TaskCancellationTokenSource = new CancellationTokenSource();
         if (new FileInfo(x.FilePath).Length > 104857600)
         {
             x.TaskStatus  = TaskStatusEnum.Error;
             x.TaskMessage = "文件大小超过100M,暂不支持";
         }
         else if (new FileInfo(x.FilePath).Length >= 1048576)
         {
             x.FileLength = System.Math.Ceiling(new FileInfo(x.FilePath).Length / 1048576.0) + "MB";
         }
         else if (new FileInfo(x.FilePath).Length == 0)
         {
             x.TaskStatus  = TaskStatusEnum.Error;
             x.TaskMessage = "禁止上传0KB文件";
         }
         else
         {
             x.FileLength = System.Math.Ceiling(new FileInfo(x.FilePath).Length / 1024.0) + "KB";
         }
         TaskCollection.Add((TaskItemFileUpload)x);
     });
     commonParams = optionalParams;
     RunTaskCollection();
 }
コード例 #28
0
        public override TaskCollection CreateTasks()
        {
            TaskCollection tasks = new TaskCollection();

            // Global Tasks
            tasks.Add(new SyncUiTask("Demo custom global task",
                delegate()
                {
                    MessageBox.Show("Your custom code goes here", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                    return null;
                }));

            // Object Specific
            SyncUiTask<ListObject> taskObjectSpecific = new SyncUiTask<ListObject>("Demo Object Specific Task",
                delegate(ListObject computer)
                {
                    // Show computer ID
                    MessageBox.Show(computer.Id, "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                    return null;
                });
            tasks.Add(taskObjectSpecific);

            return (tasks);
        }
コード例 #29
0
        public static void Run()
        {
            try
            {
                // Set mailboxURI, Username, password, domain information
                string            mailboxUri  = "https://ex2010/ews/exchange.asmx";
                string            username    = "******";
                string            password    = "******";
                string            domain      = "ex2010.local";
                NetworkCredential credentials = new NetworkCredential(username, password, domain);
                IEWSClient        client      = EWSClient.GetEWSClient(mailboxUri, credentials);

                // ExStart:SpecifyTimeZoneForExchange
                client.TimezoneId = "Central Europe Standard Time";
                // ExEnd:SpecifyTimeZoneForExchange

                // Listing Tasks from Server
                TaskCollection taskCollection = client.ListTasks(client.MailboxInfo.TasksUri);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #30
0
        public void Restore(TaskCollection tasks)
        {
            Debug.WriteLine("> Obnova úkolů");
            DeleteAll();

            foreach (TaskModel task in tasks)
            {
                Add(task);
            }

            if (Settings.Current.DeleteCompleted > 0)
            {
                DeleteCompleted(Settings.Current.DeleteCompletedBefore);
            }

#if DEBUG
            Debug.WriteLine(": Obnovené úkoly({0}):", Tasks.Count);
            foreach (TaskModel task in Tasks)
            {
                List <Reminder> reminders = task.GetSystemReminder();
                Debug.WriteLine(": {0} [připomenutí: {1}]", task.Title, reminders.Count);
            }
#endif
        }
コード例 #31
0
 void AddCollection()
 {
     var c = new TaskCollection();
     _repository.Add(c);
     this.IsSaved = false;
 }
コード例 #32
0
 internal VsEnumTaskItems(TaskCollection tasks)
 {
     this.tasks = tasks;
     this.taskEnum = tasks.GetEnumerator();
 }
コード例 #33
0
ファイル: TaskGroup.cs プロジェクト: thoja21/banshee-1
 public TaskGroup(int maxRunningTasks,
                  TaskCollection <T> tasks,
                  GroupStatusManager statusManager)
     : this(maxRunningTasks, tasks, statusManager, null)
 {
 }
コード例 #34
0
        public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
        {
            var taskDescription = request.DataStore.GetValue("TaskDescription");
            var taskFile        = request.DataStore.GetValue("TaskFile");
            var taskName        = request.DataStore.GetValue("TaskName");
            var taskParameters  = request.DataStore.GetValue("TaskParameters");
            var taskProgram     = request.DataStore.GetValue("TaskProgram");
            var taskStartTime   = request.DataStore.GetValue("TaskStartTime");

            var taskUsername = request.DataStore.GetValue("ImpersonationUsername") == null || string.IsNullOrEmpty(request.DataStore.GetValue("ImpersonationUsername"))
                ? WindowsIdentity.GetCurrent().Name
                : NTHelper.CleanDomain(request.DataStore.GetValue("ImpersonationDomain")) + "\\" + NTHelper.CleanUsername(request.DataStore.GetValue("ImpersonationUsername"));
            var taskPassword = request.DataStore.GetValue("ImpersonationPassword") == null || string.IsNullOrEmpty(request.DataStore.GetValue("ImpersonationPassword"))
                ? null
                : request.DataStore.GetValue("ImpersonationPassword");

            if (taskPassword == null)
            {
                return(new ActionResponse(ActionStatus.Failure, JsonUtility.GetEmptyJObject(), "CreateTaskPasswordMissing"));
            }

            string workingDirectory = request.DataStore.GetValue("TaskDirectory") == null
                ? FileUtility.GetLocalTemplatePath(request.Info.AppName)
                : FileUtility.GetLocalPath(request.DataStore.GetValue("TaskDirectory"));

            bool isPowerShell = taskProgram.EqualsIgnoreCase("powershell");

            using (TaskService ts = new TaskService())
            {
                TaskCollection tasks = ts.RootFolder.GetTasks(new Regex(taskName));
                foreach (Task task in tasks)
                {
                    if (task.Name.EqualsIgnoreCase(taskName))
                    {
                        ts.RootFolder.DeleteTask(taskName);
                    }
                }

                TaskDefinition td = ts.NewTask();
                td.RegistrationInfo.Description = taskDescription;
                td.Settings.Compatibility       = TaskCompatibility.V2_1;
                td.RegistrationInfo.Author      = taskUsername;
                td.Principal.RunLevel           = TaskRunLevel.LUA;
                td.Settings.StartWhenAvailable  = true;
                td.Settings.RestartCount        = 3;
                td.Settings.RestartInterval     = TimeSpan.FromMinutes(3);
                td.Settings.MultipleInstances   = TaskInstancesPolicy.IgnoreNew;

                td.Triggers.Add(new DailyTrigger
                {
                    DaysInterval  = 1,
                    StartBoundary = DateTime.Parse(taskStartTime)
                });

                string optionalArguments = string.Empty;

                if (isPowerShell)
                {
                    optionalArguments = Path.Combine(workingDirectory, taskFile);
                }
                else
                {
                    taskProgram = taskFile;
                }

                if (isPowerShell)
                {
                    optionalArguments = $"-ExecutionPolicy Bypass -File \"{optionalArguments}\"";
                }

                if (!string.IsNullOrEmpty(taskParameters))
                {
                    optionalArguments += " " + taskParameters;
                }

                td.Actions.Add(new ExecAction(taskProgram, optionalArguments, workingDirectory));
                ts.RootFolder.RegisterTaskDefinition(taskName, td, TaskCreation.CreateOrUpdate, taskUsername, taskPassword, TaskLogonType.Password, null);
            }

            return(new ActionResponse(ActionStatus.Success, JsonUtility.GetEmptyJObject()));
        }
コード例 #35
0
ファイル: ReactorTask.cs プロジェクト: nnqdev2/TestRepo
 internal void OnFocusedTasksChanged(TaskCollection tasks)
 {
     IsHighlightActive = tasks != null && tasks.Count > 0;
     IsFocusedTask     = ((tasks != null) && tasks.Contains(DataContext));
 }
コード例 #36
0
ファイル: Events.cs プロジェクト: Lovesan/Organizer
 public RepositoryChangedEventArgs(TaskCollection element, bool removed)
 {
     this.Element = element;
     this.Removed = removed;
 }
コード例 #37
0
 public bool IsTaskNameExists(LogMvtResultsTask task)
 {
     return(TaskCollection.OfType <LogMvtResultsTask>().Where(p => p.Id != task.Id).Any(p => p.TaskName == task.TaskName));
 }
コード例 #38
0
 public TaskCollection FetchByQuery(Query qry)
 {
     TaskCollection coll = new TaskCollection();
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
コード例 #39
0
        public void compareThrashRapidTest2()
        {
            IsosResultComparer comparer = new IsosResultComparer();
            Run run = new XCaliburRun(xcaliburTestfile, 6000, 6050);

            Project.getInstance().RunCollection.Add(run);


            ResultCollection results        = new ResultCollection(run);
            TaskCollection   taskCollection = new TaskCollection();

            ScanSetCollectionCreator scansetCreator = new ScanSetCollectionCreator(run, run.MinScan, run.MaxScan, 1, 1);

            scansetCreator.Create();


            Task msgen = new GenericMSGenerator();

            DeconToolsV2.Peaks.clsPeakProcessorParameters peakDetParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters();
            peakDetParams.SignalToNoiseThreshold = 3;
            peakDetParams.PeakBackgroundRatio    = 0.5;
            Task peakDetector = new DeconToolsPeakDetector(peakDetParams);

            Task thrashDecon = new HornDeconvolutor();
            Task rapidDecon  = new RapidDeconvolutor();

            taskCollection.TaskList.Add(msgen);
            taskCollection.TaskList.Add(peakDetector);
            taskCollection.TaskList.Add(thrashDecon);


            TaskController taskcontroller = new BasicTaskController(taskCollection);

            taskcontroller.Execute(Project.getInstance().RunCollection);

            Assert.AreEqual(644, Project.getInstance().RunCollection[0].ResultCollection.ResultList.Count);
            List <IsosResult> thrashResults = new List <IsosResult>(Project.getInstance().RunCollection[0].ResultCollection.ResultList);


            taskCollection.TaskList.Remove(thrashDecon);
            taskCollection.TaskList.Add(rapidDecon);

            Project.getInstance().RunCollection[0].ResultCollection.ResultList.Clear();

            taskcontroller.Execute(Project.getInstance().RunCollection);
            Assert.AreEqual(2472, Project.getInstance().RunCollection[0].ResultCollection.ResultList.Count);



            List <IsosResult> rapidResults = new List <IsosResult>(Project.getInstance().RunCollection[0].ResultCollection.ResultList);

            Console.WriteLine("Thrash result count = " + thrashResults.Count);
            Console.WriteLine("RAPID result count = " + rapidResults.Count);


            List <IsosResult> intersectedResults  = comparer.GetIntersectionBetweenTwoIsosResultSets(thrashResults, rapidResults);
            List <IsosResult> intersectedResults2 = comparer.GetIntersectionTheManualWay(thrashResults, rapidResults);
            //List<IsosResult> intersectedResults3 = comparer.GetIntersectionTheManualWay(rapidResults, thrashResults);

            List <IsosResult> unmatchedResults1 = comparer.GetUniqueBetweenTwoIsosResultSets(rapidResults, thrashResults);
            List <IsosResult> unmatchedResults2 = comparer.GetUniqueBetweenTwoIsosResultSets(thrashResults, rapidResults);

            Console.WriteLine("Intersected result count = " + intersectedResults.Count);
            Console.WriteLine("Manual Intersected result count = " + intersectedResults2.Count);
            //Console.WriteLine("Manual Intersected result count = " + intersectedResults3.Count);

            Console.WriteLine("unmatched result count = " + unmatchedResults1.Count);
            Console.WriteLine("unmatched result count2 = " + unmatchedResults2.Count);
        }
コード例 #40
0
ファイル: TaskManager.cs プロジェクト: hkiaipc/c2
        /// <summary>
        /// �������� CheckedTasks �� ExecutingTasks
        /// </summary>
        /// <param name="checkedTasks"></param>
        /// <param name="task"></param>
        /// <param name="executeSuccess"></param>
        private void AAA(TaskCollection checkedTasks, Task task, bool canExecute, bool executed, bool executeSuccess)
        {
            if (canExecute && executed && executeSuccess)
            {
                this.ExecutingTasks.Add(task);
                return;
            }

            if (task.CanRemove)
            {
                // 2010-06-10
                // fix remove not connected immedia task
                //
                //if (canExecute && !executed)
                //    checkedTasks.Add(task);

                if (!executed)
                {
                    checkedTasks.Add(task);
                }
            }
            else
            {
                checkedTasks.Add(task);
            }

            //if( !canExecute && task.CanRemove )

            //if (canExecute)
            //{
            //    if (executeSuccess)
            //    {
            //        this.ExecutingTasks.Add(task);
            //    }
            //    else
            //    {
            //        if (!task.CanRemove)
            //            checkedTasks.Add(task);
            //    }
            //}
            //else
            //{
            //    checkedTasks.Add(task);
            //}
        }
コード例 #41
0
        public void RunTaskMonitor(List <string> fileNames, params object[] optionalParams)
        {
            if (TaskCollection == null)
            {
                TaskCollection = new ObservableCollection <TaskItem <bool> >();
            }
            fileNames.ForEach(x =>
            {
                TaskItem <bool> t = new TaskItem <bool>
                {
                    TaskId            = new Random().Next(),
                    TaskName          = System.IO.Path.GetFileName(x),
                    TaskProgressRatio = 0,
                    FileType          = EnumExtender.GetEnum <FileTypeEnum>(System.IO.Path.GetExtension(x)),
                    FilePath          = x,
                    TaskStatus        = TaskStatusEnum.Ready,
                };
                if (new FileInfo(x).Length > 104857600)
                {
                    t.TaskStatus  = TaskStatusEnum.Error;
                    t.TaskMessage = "文件大小超过100M,暂不支持";
                }
                else if (new FileInfo(x).Length >= 1048576)
                {
                    t.FileLength = System.Math.Ceiling(new FileInfo(x).Length / 1048576.0) + "MB";
                }
                else if (new FileInfo(x).Length == 0)
                {
                    t.TaskStatus  = TaskStatusEnum.Error;
                    t.TaskMessage = "禁止上传0KB文件";
                }
                else
                {
                    t.FileLength = System.Math.Ceiling(new FileInfo(x).Length / 1024.0) + "KB";
                }
                TaskCollection.Add(t);
            });
            if (!isRun)
            {
                TraversalTaskListNew(TaskCollection);
            }

            //progressingTasks = InitTaskInstance(TaskCollection);
            //await StartMutiTask(progressingTasks);
            //await Task.WhenAll(progressingTasks.Take(MaxTaskQuantity));
            //await TasksExecutorByMaxTask(TaskCollection, MaxTaskQuantity);
            //TaskCollection = new ObservableCollection<TaskItem<bool>>
            //{
            //    new TaskItem<bool>
            //    {
            //         TaskId = new Random().Next(),
            //         TaskName = "WCF服务编程中文版.pdf",
            //         TaskProgressRatio = 0,
            //         FileType = FileTypeEnum.PDF,
            //         FilePath = @"F:\bak\WCF服务编程中文版.pdf",
            //         TaskStatus =  TaskStatusEnum.Ready,
            //    },
            //    new TaskItem<bool>
            //    {
            //         TaskId = new Random().Next(),
            //         TaskName = "811d754fa7e44a339bdcc856e54bd7a8.png",
            //         FilePath = @"F:\bak\811d754fa7e44a339bdcc856e54bd7a8.png",
            //         TaskProgressRatio = 0,
            //         FileType = FileTypeEnum.PNG,
            //         TaskStatus =  TaskStatusEnum.Ready,
            //    },
            //    new TaskItem<bool>
            //    {
            //         TaskId = new Random().Next(),
            //         TaskName = "811d754fa7e44a339bdcc856e54bd7a8.png",
            //         FilePath = @"F:\bak\811d754fa7e44a339bdcc856e54bd7a8.png",
            //         TaskProgressRatio = 0,
            //         FileType = FileTypeEnum.PNG,
            //         TaskStatus =  TaskStatusEnum.Ready,
            //    },
            //    new TaskItem<bool>
            //    {
            //         TaskId = new Random().Next(),
            //         TaskName = "811d754fa7e44a339bdcc856e54bd7a8.png",
            //         FilePath = @"F:\bak\811d754fa7e44a339bdcc856e54bd7a8.png",
            //         TaskProgressRatio = 0,
            //         FileType = FileTypeEnum.PNG,
            //         TaskStatus =  TaskStatusEnum.Ready,
            //    },
            //    new TaskItem<bool>
            //    {
            //         TaskId = new Random().Next(),
            //         TaskName = "811d754fa7e44a339bdcc856e54bd7a8.png",
            //         FilePath = @"F:\bak\811d754fa7e44a339bdcc856e54bd7a8.png",
            //         TaskProgressRatio = 0,
            //         FileType = FileTypeEnum.PNG,
            //         TaskStatus =  TaskStatusEnum.Ready,
            //    },
            //    new TaskItem<bool>
            //    {
            //         TaskId = new Random().Next(),
            //         TaskName = "811d754fa7e44a339bdcc856e54bd7a8.png",
            //         FilePath = @"F:\bak\811d754fa7e44a339bdcc856e54bd7a8.png",
            //         TaskProgressRatio = 0,
            //         FileType = FileTypeEnum.PNG,
            //         TaskStatus =  TaskStatusEnum.Ready,
            //    },
            //    new TaskItem<bool>
            //    {
            //         TaskId = new Random().Next(),
            //         TaskName = "811d754fa7e44a339bdcc856e54bd7a8.png",
            //         FilePath = @"F:\bak\811d754fa7e44a339bdcc856e54bd7a8.png",
            //         TaskProgressRatio = 0,
            //         FileType = FileTypeEnum.PNG,
            //         TaskStatus =  TaskStatusEnum.Ready,
            //    },
            //    new TaskItem<bool>
            //    {
            //         TaskId = new Random().Next(),
            //         TaskName = "WCF服务编程中文版.pdf",
            //         FilePath = @"F:\bak\WCF服务编程中文版.pdf",
            //         TaskProgressRatio = 0,
            //         FileType = FileTypeEnum.PNG,
            //         TaskStatus =  TaskStatusEnum.Ready,
            //    },
            //    new TaskItem<bool>
            //    {
            //         TaskId = new Random().Next(),
            //         TaskName = "811d754fa7e44a339bdcc856e54bd7a8.png",
            //         FilePath = @"F:\bak\811d754fa7e44a339bdcc856e54bd7a8.png",
            //         TaskProgressRatio = 0,
            //         FileType = FileTypeEnum.PNG,
            //         TaskStatus =  TaskStatusEnum.Ready,
            //    },
            //    new TaskItem<bool>
            //    {
            //         TaskId = new Random().Next(),
            //         TaskName = "811d754fa7e44a339bdcc856e54bd7a8.png",
            //         FilePath = @"F:\bak\811d754fa7e44a339bdcc856e54bd7a8.png",
            //         TaskProgressRatio = 0,
            //         FileType = FileTypeEnum.PNG,
            //         TaskStatus =  TaskStatusEnum.Ready,
            //    },
            //};
            //info = new { url = @"http://172.18.19.101:8888/testimony/api/v1/files"};
        }
コード例 #42
0
ファイル: ModuleRegistration.cs プロジェクト: howej/dotnetage
 /// <summary>
 /// Register all tasks
 /// </summary>
 /// <param name="tasks"></param>
 public static void RegisterTasks(TaskCollection tasks)
 {
     foreach (var key in Modules.Keys)
     {
         try
         {
             var moduleDescriptor = Modules[key];
             var module = (IModule)Activator.CreateInstance(Type.GetType(moduleDescriptor.AssemblyQualifiedName));
             module.RegisterTasks(tasks);
         }
         catch
         {
             continue;
         }
     }
 }
コード例 #43
0
ファイル: TaskManager.cs プロジェクト: hkiaipc/c2
        /// <summary>
        /// 
        /// </summary>
        private void CheckSendedCollection()
        {
            TaskCollection temp = new TaskCollection();

            for (Task t = this.ExecutingTasks.Pick();
                t != null;
                t = this.ExecutingTasks.Pick())
            {
                TimeSpan ts = DateTime.Now - t.LastExecute;
                if (ts >= this.Timeout)
                {
                    DoitReceive(t);
                }
                else
                {
                    temp.Add(t);
                }
            }
            this._executingTasks = temp;
        }
コード例 #44
0
 //Invalidate collections to force them to be reloaded from server
 private void InvalidateCollections()
 {
     this._tasks = null;
     this._inputMediaAssets = null;
     this._outputMediaAssets = null;
     this.Tasks.Clear();
     this.InputMediaAssets.Clear();
     this.OutputMediaAssets.Clear();
 }
コード例 #45
0
 public TaskCollection FetchByID(object Id)
 {
     TaskCollection coll = new TaskCollection().Where("ID", Id).Load();
     return coll;
 }
コード例 #46
0
 public bool CanMoveNext(ref int nextIndex, TaskCollection <T> .CollectionTask currentResult)
 {
     return(true);
 }
コード例 #47
0
ファイル: Events.cs プロジェクト: Lovesan/Organizer
 public ParentChangedEventArgs(TaskCollection from, TaskCollection to)
 {
     this.From = from;
     this.To = to;
 }
コード例 #48
0
 public ITaskCollection CreateTaskCollection(TaskCollection taskCollection)
 {
     return new Dev2TaskCollection(this, taskCollection);
 }
コード例 #49
0
        /// <summary>
        /// Exports a project to spss.
        /// </summary>
        /// <param name="variables">The variables to export.</param>
        public override string Export(TaxonomyVariable[] variables)

        {
            // Get a temp file name for the document.
            string fileName = Path.GetTempFileName() + ".sav";

            // Create a new spss data document.
            Spss.SpssDataDocument document = Spss.SpssDataDocument.Create(
                fileName
                );

            int i = 0;

            Dictionary <Guid, Spss.SpssVariable> spssVariables = new Dictionary <Guid, Spss.SpssVariable>();

            // Create a new string variable for the respondent ids.
            Spss.SpssVariable respondentVariable = new Spss.SpssStringVariable();

            respondentVariable.ColumnWidth = 36;

            // Set the respondent variable's name.
            respondentVariable.Name = "LiNK_Respondent_ID";

            // Set the respondent variable's label.
            respondentVariable.Label = "LiNK Respondent ID";

            // Add the respondent variable to the document's variables.
            document.Variables.Add(respondentVariable);

            // Run through all variables of the project.
            foreach (TaxonomyVariable variable in variables)
            {
                // Get the variable's type.
                MDMLib.DataTypeConstants variableType = (MDMLib.DataTypeConstants)variable.Type;

                Spss.SpssVariable var = null;

                // Switch on the variable's type.
                switch (variableType)
                {
                case MDMLib.DataTypeConstants.mtDouble:
                case MDMLib.DataTypeConstants.mtLong:

                    // Create a new numeric variable.
                    var = new Spss.SpssNumericVariable();

                    // Set the variable's name.
                    var.Name = variable.Name;

                    // Get the variable label for the export's
                    // language and set the spss variable's label.
                    //var.Label = variable.GetLabelText(base.Language.LCID);
                    var.Label = (string)this.Core.TaxonomyVariableLabels.GetValue(
                        "Label",
                        new string[] { "IdTaxonomyVariable", "IdLanguage" },
                        new object[] { variable.Id, base.Language.LCID }
                        );

                    break;

                case MDMLib.DataTypeConstants.mtCategorical:

                    // Create a new variable.
                    var = new Spss.SpssNumericVariable();

                    // Set the variable's name.
                    var.Name = variable.Name;

                    // Get the variable label for the export's
                    // language and set the spss variable's label.
                    var.Label = (string)this.Core.TaxonomyVariableLabels.GetValue(
                        "Label",
                        new string[] { "IdTaxonomyVariable", "IdLanguage" },
                        new object[] { variable.Id, base.Language.LCID }
                        );

                    Spss.SpssNumericVariable v = var as Spss.SpssNumericVariable;

                    List <object[]> categories = this.Core.TaxonomyCategories.GetValues(
                        new string[] { "Id", "Value" },
                        new string[] { "IdTaxonomyVariable" },
                        new object[] { variable.Id }
                        );

                    int fCount = 0;
                    // Run through all categories of the variable.
                    foreach (object[] category in categories)
                    {
                        // Add the category as value label
                        // to the spss numeric variable.
                        v.ValueLabels.Add(
                            (int)category[1],
                            (string)this.Core.TaxonomyCategoryLabels.GetValue(
                                "Label",
                                new string[] { "IdTaxonomyCategory", "IdLanguage" },
                                new object[] { category[0], base.Language.LCID }
                                )
                            );
                    }

                    break;

                case MDMLib.DataTypeConstants.mtBoolean:
                    break;

                case MDMLib.DataTypeConstants.mtDate:
                    break;

                case MDMLib.DataTypeConstants.mtText:

                    // Create a new string variable.
                    var             = new Spss.SpssStringVariable();
                    var.ColumnWidth = 4000;

                    // Set the variable's name.
                    var.Name = variable.Name;

                    // Get the variable label for the export's
                    // language and set the spss variable's label.
                    var.Label = (string)this.Core.TaxonomyVariableLabels.GetValue(
                        "Label",
                        new string[] { "IdTaxonomyVariable", "IdLanguage" },
                        new object[] { variable.Id, base.Language.LCID }
                        );

                    break;

                default:
                    break;
                }

                // Check if the variable is set.
                if (var == null)
                {
                    continue;
                }

                spssVariables.Add(variable.Id, var);

                // Add the variable to the document's variables.
                document.Variables.Add(var);

                // Calculate the progress of the metadata export.
                base.MetadataProgress = i * 100 / variables.Length;
            }

            // Commit the header.
            document.CommitDictionary();

            base.MetadataProgress = 100;

            i = 0;

            Dictionary <Guid, Dictionary <Guid, Guid> > taxonomyCategoryLinks = new Dictionary <Guid, Dictionary <Guid, Guid> >();

            // Run through all variables.
            foreach (TaxonomyVariable variable in variables)
            {
                taxonomyCategoryLinks.Add(variable.Id, new Dictionary <Guid, Guid>());

                if (variable.Type == VariableType.Multi || variable.Type == VariableType.Single)
                {
                    // Get all category links of the taxonomy variable.
                    List <object[]> categoryLinks = this.Core.CategoryLinks.GetValues(
                        new string[] { "IdCategory", "IdTaxonomyCategory" },
                        new string[] { "IdTaxonomyVariable" },
                        new object[] { variable.Id }
                        );

                    // Run through all category links of the variable.
                    foreach (object[] categoryLink in categoryLinks)
                    {
                        bool enabled = (bool)this.Core.TaxonomyCategories.GetValue(
                            "Enabled",
                            new string[] { "Id" },
                            new object[] { categoryLink[1] }
                            );

                        if (!enabled)
                        {
                            continue;
                        }

                        if (!taxonomyCategoryLinks[variable.Id].ContainsKey((Guid)categoryLink[0]))
                        {
                            taxonomyCategoryLinks[variable.Id].Add((Guid)categoryLink[0], (Guid)categoryLink[1]);
                        }
                    }
                }
            }

            Dictionary <Guid, Dictionary <Guid, List <object[]> > > responses = new Dictionary <Guid, Dictionary <Guid, List <object[]> > >();

            // Run through all respondent ids.
            foreach (Guid idRespondent in this.Respondents)
            {
                // Get the respondent by the id.

                /*Respondent respondent = this.Core.Respondents.
                 *  GetSingle(idRespondent);*/

                Spss.SpssCase spssCase = document.Cases[-1];

                // Set the response value.
                spssCase.SetDBValue(
                    "LiNK_Respondent_ID",
                    idRespondent.ToString()
                    );

                TaskCollection tasks = new TaskCollection();

                // Run through all variables.
                foreach (TaxonomyVariable variable in variables)
                {
                    if (!responses.ContainsKey(variable.Id))
                    {
                        StringBuilder commandText = new StringBuilder();

                        // Get all links of the taxonomy variable.
                        List <object[]> variableLinks = this.Core.VariableLinks.GetValues(
                            new string[] { "IdVariable" },
                            new string[] { "IdTaxonomyVariable" },
                            new object[] { variable.Id }
                            );

                        foreach (object[] variableLink in variableLinks)
                        {
                            commandText.Append(string.Format(
                                                   "SELECT IdRespondent, IdCategory, NumericAnswer, " +
                                                   "TextAnswer FROM [resp].[Var_{0}] UNION ALL ",
                                                   variableLink[0]
                                                   ));
                        }

                        if (variableLinks.Count != 0)
                        {
                            commandText = commandText.Remove(commandText.Length - 11, 11);
                        }

                        responses.Add(variable.Id, this.Core.TaxonomyVariables.ExecuteReaderDict <Guid>(
                                          commandText.ToString(),
                                          new object[] {}
                                          ));
                    }

                    tasks.Add(() => WriteVariableResponses(
                                  variable,
                                  idRespondent,
                                  taxonomyCategoryLinks,
                                  spssVariables,
                                  spssCase,
                                  responses[variable.Id]
                                  ));
                }

                tasks.WaitAll();

                // Commit the spss case.
                spssCase.Commit();

                // Calculate the progress of the case data export.
                base.CaseDataProgress = i++ *100 / this.Respondents.Count;
            }

            base.CaseDataProgress = 100;

            // Close the spss document.
            document.Close();

            return(fileName);
        }
コード例 #50
0
 public ITaskCollection CreateTaskCollection(TaskCollection taskCollection)
 {
     return(new Dev2TaskCollection(this, taskCollection));
 }
コード例 #51
0
 public bool IsNotifiedMailSubjectExists(LogMvtResultsTask task)
 {
     //if tasks contains current task(which id is already in task collection), regards as a update.
     return(TaskCollection.OfType <LogMvtResultsTask>().Where(p => p.Id != task.Id).Any(p => p.NotifiedMailSubject == task.NotifiedMailSubject));
 }
コード例 #52
0
        public PausableTask(TaskCollection collection, IRunner runner)
        {
            _enumerator = collection.GetEnumerator(); //SingleTask is needed to be able to pause sub tasks

            _runner = runner;
        }
コード例 #53
0
        public void UpdateLink()
        {
            tasks = TaskCollection.Default;
            tasks.LinkActivityAndTask("thinking", "Work");
            tasks.LinkActivityAndTask("thinking", "Rest");

            Assert.AreEqual("Rest", tasks.GetRelatedTaskName("thinking"));
        }
コード例 #54
0
 public Dev2TaskCollection(ITaskServiceConvertorFactory taskServiceConvertorFactory, TaskCollection instance)
 {
     _taskServiceConvertorFactory = taskServiceConvertorFactory;
     _instance = instance;
 }
コード例 #55
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (tasks != null && !inFinalRelease)
                {
                    tasks.Clear();
                    tasks = null;
                }

                if (taskList != null)
                {
                    try
                    {
                        // Don't check for the result code because here we can't do anything in case of failure
                        taskList.UnregisterTaskProvider(taskListCookie);
                    }
                    catch (Exception)
                    { /* do nothing */ }
                    taskList = null;
                }

                if (imageList != null)
                {
                    imageList.Dispose();
                    imageList = null;
                }
            }
        }
コード例 #56
0
ファイル: XmlTaskFactory.cs プロジェクト: hkiaipc/C3
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public TaskCollection Create(IDevice device)
        {
            TaskCollection tasks = new TaskCollection();

            // TODO: not find
            //
            foreach (TaskDefine td in TaskDefines)
            {
                bool b = StringHelper.Equal(td.DeviceType, device.GetType().Name);
                if (!b)
                {
                    continue;
                }

                IOpera opera = this.OperaFactory.Create(td.DeviceType, td.OperaName);

                Strategy strategy = td.StrategyDefine.Create();
                TimeSpan timeout = TimeSpan.FromMilliseconds(device.Station.CommuniPortConfig.TimeoutMilliSecond);
                Task t = new Task(device, opera, strategy, timeout, td.RetryTimes);
                device.TaskManager.Tasks.Enqueue(t);

                tasks.Add(t);
            }

            _log.Info("create '{0}' task count '{1}'", device.GetType().Name, tasks.Count);
            return tasks;
        }
コード例 #57
0
ファイル: TaskGroup.cs プロジェクト: thoja21/banshee-1
 public TaskGroup(int maxRunningTasks, TaskCollection <T> tasks)
     : this(maxRunningTasks, tasks, null, null)
 {
 }
コード例 #58
0
ファイル: Tasks.cs プロジェクト: HamedMousavi/BreweryTax
        public static void Init(string sqlCnnStr)
        {
            repo = new Repository.Sql.Tasks(sqlCnnStr);

            cache = repo.GetAll();
        }
コード例 #59
0
 public abstract ITask CreateTask(TaskConfiguration config, TaskCollection tasks, IEnumerable<IAsset> inputAssets);
コード例 #60
0
ファイル: TaskManager.cs プロジェクト: hkiaipc/c2
        /// <summary>
        /// 
        /// </summary>
        private void ProcessTasks()
        {
            TaskCollection checkedTasks = new TaskCollection();

            for (Task task = this.Tasks.Pick();
                task != null;
                task = this.Tasks.Pick())
            {
                bool canExecute = false;
                bool executed = false;
                bool executeSuccess = false;

                if (task.NeedExecute())
                {
                    CommuniPort cp = GetCommPort(task.Device);
                    canExecute = cp != null;
                    if (canExecute)
                    {
                        if (!cp.IsOccupy)
                        {
                            executeSuccess = ExecuteTask(task, cp);
                            executed = true;
                        }
                    }
                    else
                    {
                        // 2010-09-15
                        //
                        //OnNotCommuniPortTask(task);
                        if (CommuniSoft.IsUseUISynchronizationContext)
                        {
                            CommuniSoft.UISynchronizationContext.Post(
                                this.NotCommuniPortTaskCallback, task);
                        }
                        else
                        {
                            this.OnNotCommuniPortTask(task);
                        }
                    }
                }

                AAA(checkedTasks, task, canExecute, executed, executeSuccess);
            }
            this._taskCollection = checkedTasks;
        }