public ViewModel() { urlStart = "http"; myUrl = ""; urlSize = "Please Wait"; myStopwatch = new Stopwatch(); StartCommand = new DelegateCommand(() => { CheckUrl(MyUrl); }, () => { return(MyUrl.StartsWith(urlStart)); }); Task.Run(() => { while (true) { StartCommand.RaiseCanExecuteChanged(); Thread.Sleep(500); } }); Task.Run(() => { while (true) { StopWatchValue = MyStopwatch.ElapsedMilliseconds.ToString(); } }); }
/// <summary> /// Load web page from txt_address box and update history. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Load_WebPage_Click(object sender, EventArgs e) { string MyUrl; MyUrl = txt_Address.Text; if (MyUrl != "") { // Make sure url starts with HTTP protocol if (MyUrl.StartsWith("http://") == false & MyUrl.StartsWith("https://") == false) { MyUrl = "http://" + MyUrl; } try { webBrowser1.Navigate(new Uri(MyUrl, UriKind.RelativeOrAbsolute)); Add_Url_to_History(MyUrl); } catch (SystemException sec) { Console.WriteLine(sec.Message); } catch (Exception x) { Console.WriteLine(x.Message); } } // End if }
public async Task <ActionResult> CreateUrl([FromBody] MyUrlCreateDto model) { string shortUrl = Guid.NewGuid().ToString().GetHashCode().ToString("x"); var myUrl = new MyUrl { LongUrl = model.LongUrl, ShortUrl = $"http://shortenerurl/{shortUrl}", Description = model.Description, AplicationUserId = model.AplicationUserId }; _urlShortenerDbContext.MyUrls.Add(myUrl); await _urlShortenerDbContext.SaveChangesAsync(); return(Ok()); }
/// <summary> /// Returns the hashcode of this Object /// </summary> /// <returns>Hash code (int)</returns> public override int GetHashCode() { // Credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { int hash = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hash = hash * 59 + Id.GetHashCode(); } if (Name != null) { hash = hash * 59 + Name.GetHashCode(); } if (Description != null) { hash = hash * 59 + Description.GetHashCode(); } if (MyBoolean != null) { hash = hash * 59 + MyBoolean.GetHashCode(); } if (MyCreditCard != null) { hash = hash * 59 + MyCreditCard.GetHashCode(); } if (MyCurrency != null) { hash = hash * 59 + MyCurrency.GetHashCode(); } if (MyDateTime != null) { hash = hash * 59 + MyDateTime.GetHashCode(); } if (MyDouble != null) { hash = hash * 59 + MyDouble.GetHashCode(); } if (MyEmail != null) { hash = hash * 59 + MyEmail.GetHashCode(); } if (MyFloat != null) { hash = hash * 59 + MyFloat.GetHashCode(); } if (MyImageUrl != null) { hash = hash * 59 + MyImageUrl.GetHashCode(); } if (MyInteger != null) { hash = hash * 59 + MyInteger.GetHashCode(); } if (MyLong != null) { hash = hash * 59 + MyLong.GetHashCode(); } if (MyPhone != null) { hash = hash * 59 + MyPhone.GetHashCode(); } if (MyPostalCode != null) { hash = hash * 59 + MyPostalCode.GetHashCode(); } if (MyString != null) { hash = hash * 59 + MyString.GetHashCode(); } if (MyTextArea != null) { hash = hash * 59 + MyTextArea.GetHashCode(); } if (MyTicks != null) { hash = hash * 59 + MyTicks.GetHashCode(); } if (MyUrl != null) { hash = hash * 59 + MyUrl.GetHashCode(); } if (Comments != null) { hash = hash * 59 + Comments.GetHashCode(); } if (AuditEntered != null) { hash = hash * 59 + AuditEntered.GetHashCode(); } if (AuditEnteredBy != null) { hash = hash * 59 + AuditEnteredBy.GetHashCode(); } if (AuditUpdated != null) { hash = hash * 59 + AuditUpdated.GetHashCode(); } if (AuditUpdatedBy != null) { hash = hash * 59 + AuditUpdatedBy.GetHashCode(); } return(hash); } }
public string CreateSafeNetId(string netName) { return(MyUrl.UrlizeString(netName)); }
public MyUrl(MyUrl url) { Option = url.Option; LeftUrl = url.LeftUrl; RightUrl = url.RightUrl; }