async public Task Activated(ShareTargetActivatedEventArgs args) { _share = args.ShareOperation; var xml_text = await args.ShareOperation.Data.GetTextAsync(); var xml = XElement.Parse(xml_text); _customer = new BMXCustomerInfo { CustomerID = Guid.NewGuid(), }; //red xml into local values var customer_name = xml.Element("name").Value; var customer_email = xml.Element("email").Value; var customer_dob = xml.Element("dob").Value; var dob = DateTime.Parse(customer_dob); //set values of controls txt_name.Text = customer_name; txt_email.Text = customer_email; control_dob.Date = dob; grid_overlay.Visibility = Visibility.Collapsed; _share_activated = true; //set this as the window Window.Current.Content = this; Window.Current.Activate(); }
async private void LoadToken(object sender, RoutedEventArgs e) { var token = txt_token.Text; var file = await SharedStorageAccessManager.RedeemTokenForFileAsync(token); if (file != null) { //initialize customer _customer = new BMXCustomerInfo { CustomerID = Guid.NewGuid(), }; //load xml var xml_text = await file.ReadTextAsync(); var xml = XElement.Parse(xml_text); //red xml into local values var customer_name = xml.Element("name").Value; var customer_email = xml.Element("email").Value; var customer_dob = xml.Element("dob").Value; var dob = DateTime.Parse(customer_dob); //set values of controls txt_name.Text = customer_name; txt_email.Text = customer_email; control_dob.Date = dob; //hide overlay grid_overlay.Visibility = Visibility.Collapsed; } }
async private void OnLoadCachedCustomer(object sender, RoutedEventArgs e) { var folder = ApplicationData.Current.GetPublisherCacheFolder("bxm_shared_state"); var file = await folder.GetFileAsync("customer.xml"); //initialize customer _customer = new BMXCustomerInfo { CustomerID = Guid.NewGuid(), }; //load xml var xml_text = await file.ReadTextAsync(); var xml = XElement.Parse(xml_text); //red xml into local values var customer_name = xml.Element("name").Value; var customer_email = xml.Element("email").Value; var customer_dob = xml.Element("dob").Value; var dob = DateTime.Parse(customer_dob); //set values of controls txt_name.Text = customer_name; txt_email.Text = customer_email; control_dob.Date = dob; //hide overlay grid_overlay.Visibility = Visibility.Collapsed; }
private void CreateNew(object sender, RoutedEventArgs e) { grid_overlay.Visibility = Visibility.Collapsed; _customer = new BMXCustomerInfo { CustomerID = Guid.NewGuid(), }; }