private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args) { if (Source1Model != null) { Source1Model.GetShareContent(args.Request); } }
public async Task <IHttpActionResult> BankCurrencyList() { List <Source1ListModel> bankCurrencyList = new List <Source1ListModel>(); var bankList = _scripts.BankNames(); foreach (var item in bankList) { Uri URL = new Uri("https://kur.doviz.com/" + item); List <Source1Model> currencyList = new List <Source1Model>(); string html = client.DownloadString(URL); HtmlDocument document = new HtmlDocument(); document.LoadHtml(html); try { var tableRow = document.DocumentNode.Descendants("tr"); int count = 0; foreach (var node in tableRow) { var array = node.InnerText.Replace(" ", "").Trim().Split('\n'); if (count < 1) { count++; } else { Source1Model model = new Source1Model(); model.Name = _scripts.NameControl(array[0]); model.Buyin = array[3]; model.Sales = array[4]; model.UpdateTime = array[5]; count++; currencyList.Add(model); } } Source1ListModel ListModel = new Source1ListModel { BankName = item, CurrencyList = currencyList }; bankCurrencyList.Add(ListModel); } catch (Exception) { return(Ok("null")); } } ResultModel <Source1ListModel> model2 = new ResultModel <Source1ListModel> { _Title = "Curency Data", _DateTime = DateTime.Now.ToString(), _Result = bankCurrencyList, _Count = bankCurrencyList.Count }; return(Ok(model2)); }
/// <summary> /// Refresh ViewModel items asynchronous /// </summary> public async Task RefreshData(bool isNetworkAvailable) { var refreshTasks = new Task[] { Source1Model.RefreshItems(isNetworkAvailable), Source2Model.RefreshItems(isNetworkAvailable), Source3Model.RefreshItems(isNetworkAvailable), }; await Task.WhenAll(refreshTasks); }
/// <summary> /// Load ViewModel items asynchronous /// </summary> public async Task LoadData(bool isNetworkAvailable) { var loadTasks = new Task[] { Source1Model.LoadItems(isNetworkAvailable), Source2Model.LoadItems(isNetworkAvailable), Source3Model.LoadItems(isNetworkAvailable), }; await Task.WhenAll(loadTasks); }
private void btnSimple_Click(object sender, EventArgs e) { Source1Model sm = new Source1Model() { SomeValue = 20, OtherValue = "111" }; OutputObjPropInfo(sm); Stopwatch watch = new Stopwatch(); watch.Start(); Destination1Model dm = Mapper.Map <Destination1Model>(sm); watch.Stop(); Console.WriteLine($"Mapper.Map<Destination1Model>(sm)花费时间:{watch.ElapsedMilliseconds} 毫秒."); OutputObjPropInfo(dm); }