Example #1
0
        public void Start()
        {
            var it     = new InitializeTask();
            var result = it.Start();

            Assert.IsTrue(result);
        }
Example #2
0
        public virtual async Task <List <T> > GetItemsAsync()
        {
            try
            {
                await InitializeTask.ConfigureAwait(false);

                return(await Database.Table <T>().ToListAsync().ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                return(null);
            }
        }
Example #3
0
        public virtual async Task <bool> RemoveAsync(T item)
        {
            try
            {
                await InitializeTask.ConfigureAwait(false);

                await Database.DeleteAsync(item).ConfigureAwait(false);

                return(true);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                return(false);
            }
        }
Example #4
0
        public virtual async Task <T> InsertAsync(T item)
        {
            try
            {
                await InitializeTask.ConfigureAwait(false);

                await Database.InsertAsync(item).ConfigureAwait(false);

                return(item);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                return(null);
            }
        }
Example #5
0
        GetIssuesWithConnections()
        {
            await InitializeTask.ConfigureAwait(false);

            var concurrentBag = new List <IssueLinkLight>();
            var rawIssues     = await _repository.GetAllIssuesInProject(CustomFields).ConfigureAwait(false);

            Console.WriteLine($"Loaded issues (count): {rawIssues.Count}");

            var getLinks = new TransformManyBlock <IssueLight, IssueLinkLight>(
                async i => await _repository.GetLinks(i),
                new ExecutionDataflowBlockOptions {
                MaxDegreeOfParallelism = Environment.ProcessorCount * 4
            }
                );
            var collect = new ActionBlock <IssueLinkLight>(
                i => concurrentBag.Add(i),
                new ExecutionDataflowBlockOptions {
                MaxDegreeOfParallelism = 1
            }
                );

            var linkOptions = new DataflowLinkOptions {
                PropagateCompletion = true
            };

            using var l1 = getLinks.LinkTo(collect, linkOptions);

            if (rawIssues.Any(x => !getLinks.Post(x)))
            {
                throw new Exception($"Failure to queue data for processing. Block already has {getLinks.InputCount} items to be processed.");
            }

            getLinks.Complete();
            await getLinks.Completion;
            await collect.Completion;

            Console.WriteLine($"Loaded links: (count): {concurrentBag.Count}");

            return(rawIssues, concurrentBag);
        }
Example #6
0
        public virtual async Task <T> GetItemAsync(string id)
        {
            try
            {
                await InitializeTask.ConfigureAwait(false);

                var items = await Database.Table <T>().Where(s => s.Id == id).ToListAsync().ConfigureAwait(false);

                if (items == null || items.Count == 0)
                {
                    return(null);
                }

                return(items[0]);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                return(null);
            }
        }
        public WeaponAnalysisViewModel()
        {
            PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(SelectedWeapon) ||
                    e.PropertyName == nameof(SelectedArmor) ||
                    e.PropertyName == nameof(SelectedShield) ||
                    e.PropertyName == nameof(SelectedHull) ||
                    e.PropertyName == nameof(WeaponCount) ||
                    e.PropertyName == nameof(ModHeavyArmor) ||
                    e.PropertyName == nameof(ModReinforcedHull))
                {
                    RaiseCalculatedWeaponProptiesChanged();
                }
            };

            InitializeTask = Initialize();
            InitializeTask.ContinueWith((T) =>
            {
                LoadErrorMessage = T.Exception?.Message;
            });
        }
Example #8
0
 public void Dispose()
 {
     using (var it = new InitializeTask())
     {
     }
 }
Example #9
0
 public async Task RunAsync()
 {
     var it = new InitializeTask();
     await it.RunAsync();
 }
Example #10
0
        public void Run()
        {
            var it = new InitializeTask();

            it.Run();
        }
 public void Dispose()
 {
     using (var it = new InitializeTask())
     {
     }
 }
 public void Start()
 {
     var it = new InitializeTask();
     var result = it.Start();
     Assert.IsTrue(result);
 }
 public async Task RunAsync()
 {
     var it = new InitializeTask();
     await it.RunAsync();
 }
 public void Run()
 {
     var it = new InitializeTask();
     it.Run();
 }