示例#1
0
        async Task ExecuteLoadItemsCommand()
        {
            IsBusy = true;

            try
            {
                WebPages.Clear();
                var items = await DataStore.GetItemsAsync(true);

                foreach (var item in items)
                {
                    WebPages.Add(item);
                }
            }
            catch (Exception ex)
            {
                await DataStore.DeleteAllItemsAsync();

                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
示例#2
0
 public override void Create()
 {
     WebPages.Add(new LoginPage());
     WebPages.Add(new ProductPage());
     WebPages.Add(new ProjectPage());
     WebPages.Add(new ContactPage());
 }
        public ActionResult _Create(WebPages WebPages, FormCollection form)
        {
            try
            {
                #region Added by shakir (Currency parameter)
                var selectCurrency = (dynamic)null;
                if (form["selectCurrency"] != null)
                {
                    selectCurrency = Convert.ToInt32(form["selectCurrency"].ToString());
                }
                else
                {
                    selectCurrency = Convert.ToInt32(Session["SelectedCurrency"].ToString());
                }

                UtilityClass.GetSelectedCurrecy(selectCurrency);
                #endregion

                if (ModelState.IsValid)
                {
                    WebPages.CreateDate = DateTime.Now;
                    ServiceRepository   serviceObj = new ServiceRepository();
                    HttpResponseMessage response   = serviceObj.PostResponse("api/WebPages/InsertWebPage", WebPages);
                    response.EnsureSuccessStatusCode();
                    UtilityClass.ActivityMonitor(Convert.ToInt32(Session["UserID"]), Session.SessionID, Request.UserHostAddress.ToString(), new Guid().ToString(), JsonConvert.SerializeObject(WebPages), this.RouteData.Values["action"].ToString(), Request.RawUrl.ToString());
                    return(RedirectToAction("WebPages"));
                }
            }
            catch (Exception ex) { }
            return(PartialView("_Create", WebPages));
        }
示例#4
0
        /// <summary>
        ///         ''' Called from APServerRequestHandler
        ///         ''' </summary>
        public static string ProcessAPServerRequest(string Request)
        {
            // ****** Parse Request here

            string ReturnString = WebPages.StatusPage("ESP8266C in AP Mode");

            return(ReturnString + Constants.vbCrLf + Constants.vbCrLf);
        }
示例#5
0
        /// <summary>
        ///         ''' Called from ServerRequestHandler
        ///         ''' </summary>
        public static string ProcessServerRequest(string Request)
        {
            // ****** Parse Request here

            string ReturnString = WebPages.DefaultPage();


            return(ReturnString + Constants.vbCrLf + Constants.vbCrLf);
        }
示例#6
0
        private static void SendFavicon()
        {
            CurrentMode = (int)Mode.TCPSending;

            // Send this first
            string strResp = "HTTP/1.1 200 OK" + CrLf + "Content-Type: image/x-icon; charset = UTF - 8" +
                             CrLf + "Cache - Control: no - cache" + CrLf + "Connection: close" + CrLf + CrLf;

            byte[] arr = Encoding.UTF8.GetBytes(strResp);

            SendData("AT+CIPSENDBUF=" + LinkedID + "," + arr.Length + CrLf);

            SendDataBytes(arr);

            Console.WriteLine("HTTP response length: >>" + arr.Length);

            // Send the image
            byte[] icon = WebPages.faviconpage();

            Console.WriteLine("Icon Length: >> " + icon.Length);

            int BytesSent = 0;

            int FileLength = icon.Length;

            while (BytesSent < FileLength)
            {
                int BytesToRead = FileLength - BytesSent;

                if (BytesToRead > SMAX_BUFF)
                {
                    BytesToRead = SMAX_BUFF;
                }

                SendData("AT+CIPSENDBUF=" + LinkedID + "," + BytesToRead + CrLf);

                //Array.
                //string DataToSend = srd.Substring(BytesSent, BytesToRead);

                byte[] DataToSend = new byte[SMAX_BUFF];

                //int index = Array.IndexOf(icon,BytesSent,BytesToRead );
                // Array.Copy(icon, index, DataToSend);
                Array.Copy(icon, BytesSent, DataToSend, 0, BytesToRead);


                //SendDatab(DataToSend);
                SendDataBytes(DataToSend);

                BytesSent += BytesToRead;
            }

            SendData("AT+CIPCLOSE=" + LinkedID + CrLf);
        }
 public override int GetHashCode()
 {
     unchecked {
         const int randomPrime = 397;
         int       hashCode    = Id.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Adress != null ? Adress.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Country != null ? Country.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Phone != null ? Phone.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (WebPages != null ? WebPages.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#8
0
        public void CustomCard(IMessageActivity message, WebPages webPages)
        {
            message.AttachmentLayout = AttachmentLayoutTypes.Carousel;
            message.Attachments      = new List <Attachment>();

            foreach (var cardContent in webPages.value)
            {
                List <AdaptiveElement> items = new List <AdaptiveElement>();
                items.Add(new AdaptiveColumnSet()
                {
                    Columns = new List <AdaptiveColumn>()
                    {
                        new AdaptiveColumn()
                        {
                            Items = new List <AdaptiveElement>()
                            {
                                new AdaptiveTextBlock()
                                {
                                    Text   = cardContent.name,
                                    Weight = AdaptiveTextWeight.Bolder,
                                    Size   = AdaptiveTextSize.Small,
                                    Wrap   = true
                                }
                            }
                        }
                    }
                });

                AdaptiveCard card = new AdaptiveCard()
                {
                    Body = items
                };
                card.Actions.Add(new AdaptiveOpenUrlAction()
                {
                    Url   = new Uri(cardContent.url),
                    Title = "Click me To Open"
                });
                Attachment attachment = new Attachment()
                {
                    ContentType = AdaptiveCard.ContentType,
                    Content     = card
                };

                message.Attachments.Add(attachment);
            }
        }
 public ActionResult Update(WebPages WebPages)
 {
     try
     {
         if (ModelState.IsValid)
         {
             WebPages.UpdateDate = DateTime.Now;
             ServiceRepository   serviceObj = new ServiceRepository();
             HttpResponseMessage response   = serviceObj.PutResponse("api/WebPages/UpdateWebPage", WebPages);
             response.EnsureSuccessStatusCode();
             UtilityClass.ActivityMonitor(Convert.ToInt32(Session["UserID"]), Session.SessionID, Request.UserHostAddress.ToString(), new Guid().ToString(), JsonConvert.SerializeObject(WebPages), this.RouteData.Values["action"].ToString(), Request.RawUrl.ToString());
             return(RedirectToAction("WebPages"));
         }
     }
     catch (Exception ex) { }
     return(RedirectToAction("WebPages"));
 }
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="Rest.ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (QueryContext != null)
     {
         QueryContext.Validate();
     }
     if (WebPages != null)
     {
         WebPages.Validate();
     }
     if (Images != null)
     {
         Images.Validate();
     }
     if (News != null)
     {
         News.Validate();
     }
     if (RelatedSearches != null)
     {
         RelatedSearches.Validate();
     }
     if (SpellSuggestions != null)
     {
         SpellSuggestions.Validate();
     }
     if (TimeZone != null)
     {
         TimeZone.Validate();
     }
     if (Videos != null)
     {
         Videos.Validate();
     }
     if (Computation != null)
     {
         Computation.Validate();
     }
     if (RankingResponse != null)
     {
         RankingResponse.Validate();
     }
 }
示例#11
0
        /// <summary>
        /// Sends the data requested
        /// </summary>
        private void SendServerRequest()
        {
            try
            {
                string srd = string.Empty;

                string rstr = FindGetRequest();

                Console.WriteLine("Server Request: >> " + rstr);

                if (InString(rstr, "favicon"))
                {
                    // Console.WriteLine("HTTP/1.1 404 NOT FOUND\r\nConnection: close\r\nContent-Length: 0" + CrLf + CrLf);
                    SendFavicon();
                }

                else
                {
                    if (APServerMode)
                    {
                        //****** Proccess AP server request here
                        srd = WebPages.RouterSettingsPage();
                    }

                    else

                    {
                        //****** Process server request here
                        this.ProcessServerRequest(rstr);

                        srd = WebPages.DefaultPage(Status) + CrLf + CrLf;
                    }



                    CurrentMode = (int)Mode.TCPSending;

                    int BytesSent = 0;

                    int FileLength = srd.Length;

                    while (BytesSent < FileLength)
                    {
                        int BytesToRead = FileLength - BytesSent;

                        if (BytesToRead > SMAX_BUFF)
                        {
                            BytesToRead = SMAX_BUFF;
                        }

                        SendData("AT+CIPSENDBUF=" + LinkedID + "," + BytesToRead + CrLf);

                        string DataToSend = srd.Substring(BytesSent, BytesToRead);

                        SendData(DataToSend);

                        BytesSent += BytesToRead;
                    }

                    SendData("AT+CIPCLOSE=" + LinkedID + CrLf);
                }
            }

            catch (Exception ex)
            {
                Console.WriteLine("Error: SendServerRequest: " + ex.ToString());
            }
        }
 public override void Create()
 {
     WebPages.Add(new ProfilePage());
     WebPages.Add(new ContactPage());
 }
示例#13
0
        private static IEnumerable <InlineQueryResultArticle> ConvertWebPagesToInlineQueryResultArticle(WebPages pages)
        {
            if (pages == null)
            {
                return(new List <InlineQueryResultArticle>());
            }
            var pageValues = pages.Value;
            var result     = pageValues.Select(p => new InlineQueryResultArticle
            {
                Id                  = Guid.NewGuid().ToString(),
                Title               = p.Name,
                Description         = p.Snippet,
                Url                 = p.Url,
                InputMessageContent = new InputTextMessageContent
                {
                    MessageText = p.Url
                }
            });

            return(result.ToArray());
        }