Ejemplo n.º 1
0
 /// <summary>
 /// Event invoker za RequestBlockFinished - ako je ovaj objekat uzrok dogadjaja onda moze i bez argumenata da se pozove
 /// </summary>
 /// <param name="sender">Objekat koji je pozvao izvrsavanje - ako je null smatrace da je ovaj objekat uzrok dogadjaja</param>
 /// <param name="args">Argumenti dogadjaja - ako je null postavlja da je unknown</param>
 public void callRequestBlockFinished(webRequestBlock sender, webRequestBlockEventArgs args)
 {
     if (onRequestBlockAborted != null)
     {
         webLoaderEventArgs loaderArgs = new webLoaderEventArgs(webLoaderEventType.blockFinished, args.message);
         onRequestBlockAborted(this, loaderArgs);
     }
 }
Ejemplo n.º 2
0
 public void callExecutionProgress(webRequestBlock sender, webRequestBlockEventArgs args)
 {
     if (onExecutionProgress != null)
     {
         webLoaderEventArgs loaderArgs = new webLoaderEventArgs(webLoaderEventType.progress, args.message);
         onExecutionProgress(this, loaderArgs);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Pravi novi request block i postavlja ga za current
        /// </summary>
        /// <returns></returns>
        public webRequestBlock createNewRequestBlock(String __blockTitle = null)
        {
            if (String.IsNullOrEmpty(__blockTitle))
            {
                __blockTitle = "Block n" + requestBlocks.Count();
            }
            webRequestBlock wRB = new webRequestBlock(__blockTitle, callRequestBlockFinished, callRequestBlockAborted);

            requestBlock = wRB;
            return(wRB);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Omogućava ad-hoc izvršavanje webRequest-a
        /// </summary>
        /// <param name="__url"></param>
        /// <param name="__syncMode"></param>
        /// <param name="__action"></param>
        /// <param name="__type"></param>
        /// <param name="purge">Da li da obrise sve ranije izvrsene Blokove i Zahteve ?</param>
        /// <returns>Vraća dobijeni rezultat</returns>
        public webResult executeRequest(String __url, executionSyncMode __syncMode,
                                        webRequestActionType __action = webRequestActionType.openUrl,
                                        webRequestType __type         = webRequestType.unknown, Boolean purge = true)
        {
            if (purge)
            {
                purgeExecutedBlocksAndRequests(true);
            }
            webRequestBlock blck    = getCurrentBlock();
            webRequest      request = addNewRequest(__url, __action, __type);

            webResultBlock wRB = executeCurrentBlock(__syncMode);

            return(request.result);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Izvrsava jedan request
        /// </summary>
        /// <param name="request">Zahtev koji treba da se izvrsi</param>
        /// <param name="__syncMode">Rezim izvrsavanja</param>
        /// <param name="purge">Da li da obrise sve ranije izvrsene Blokove i Zahteve ?</param>
        /// <returns>Vraca objekat sa rezultatom</returns>
        public webResult executeRequest(webRequest request, executionSyncMode __syncMode, Boolean purge = true)
        {
            if (purge)
            {
                purgeExecutedBlocksAndRequests(true);
            }

            webRequestBlock blck = getCurrentBlock();

            blck.Add(request);

            webResultBlock wRB = executeCurrentBlock(__syncMode);

            return(request.result);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Vraca Request block koji sadrzi tmp request listu
        /// </summary>
        /// <returns></returns>
        protected webRequestBlock getCurrentBlock()
        {
            webRequestBlock blck        = null;
            String          currentName = "Current requests";

            if (!has_requestBlock)
            {
                blck = createNewRequestBlock(currentName);
            }
            else
            {
                blck = requestBlocks.First(x => (x.title == currentName));
                if (blck == null)
                {
                    blck = createNewRequestBlock(currentName);
                }
            }
            return(blck);
        }