private async void Button_Click(object sender, RoutedEventArgs e) { if (CountryPhoneCode.SelectedItem != null) { var _id = Guid.NewGuid().ToString("N"); var _countryPhoneCode = (CountryPhoneCode.SelectedItem as Country).PhoneCode; var _countryName = (CountryPhoneCode.SelectedItem as Country).CountryName; var _name = FullName.Text; var _phoneNumber = PhoneNumber.Text; var _password = Password.Password; var client = new HttpClient() { BaseAddress = new Uri("http://yochat.azurewebsites.net/chat/") }; var json = await client.GetStringAsync("createuser?id=" + _id + "&fullName=" + _name + "&password="******"&phoneNumber=" + _phoneNumber + "&countryPhoneCode=" + _countryPhoneCode); var serializer = new DataContractJsonSerializer(typeof(User)); var ms = new MemoryStream(); var user = serializer.ReadObject(ms) as User; Frame.Navigate(typeof(MainPage), user); } else { MessageDialog dialog = new MessageDialog("Lütfen Ülkenizi Seçiniz!"); await dialog.ShowAsync(); } }
/// <summary> /// This is the click handler for the 'Scenario1BtnDefault' button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Scenario1BtnDefault_Click(object sender, RoutedEventArgs e) { String rss = scenario1RssInput.Text; if (null != rss && "" != rss) { try { String xml; var doc = new Windows.Data.Xml.Dom.XmlDocument(); scenario1OriginalData.Document.GetText(Windows.UI.Text.TextGetOptions.None, out xml); doc.LoadXml(xml); // create a rss CDataSection and insert into DOM tree var cdata = doc.CreateCDataSection(rss); var element = doc.GetElementsByTagName("content").Item(0); element.AppendChild(cdata); Scenario.RichEditBoxSetMsg(scenario1Result, doc.GetXml(), true); } catch (Exception exp) { Scenario.RichEditBoxSetError(scenario1Result, exp.Message); } } else { Scenario.RichEditBoxSetError(scenario1Result, "Please type in RSS content in the [RSS Content] box firstly."); } }
private async void Submit_Click(object sender, RoutedEventArgs e) { int steps = 0; double distance = 0; if (!int.TryParse(StepsBox.Text, out steps) || !double.TryParse(DistanceBox.Text, out distance)) { await new MessageDialog("You need to fill in an approximate number of steps and distance.").ShowAsync(); return; } Activity activity = new Activity { Id = id, AccountId = UserState.CurrentId, BeginTime = BeginDate.Date.DateTime + BeginTime.Time, EndTime = EndDate.Date.DateTime + EndTime.Time, Description = "<placeholder>", Steps = steps, Distance = UserState.UseOldUnits ? distance * 3.0 : distance, Type = (ActivityType)TypeBox.SelectedIndex }; var result = await Api.Do.UpdateActivity(activity); activity = result; PageDispatch.ViewActivity(Frame, activity); }
private async void ButtonRequestToken_Click(object sender, RoutedEventArgs e) { var error = string.Empty; try { var response = await WebAuthentication.DoImplicitFlowAsync( endpoint: new Uri(Constants.AS.OAuth2AuthorizeEndpoint), clientId: Constants.Clients.ImplicitClient, scope: "read"); TokenVault.StoreToken(_resourceName, response); RetrieveStoredToken(); } catch (Exception ex) { error = ex.Message; } if (!string.IsNullOrEmpty(error)) { var dialog = new MessageDialog(error); await dialog.ShowAsync(); } }
private async void ButtonAccessResource_Click(object sender, RoutedEventArgs e) { var client = new HttpClient { BaseAddress = _baseAddress }; if (_credential != null) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _credential.AccessToken); } var response = await client.GetAsync("identity"); if (response.StatusCode != System.Net.HttpStatusCode.OK) { var md = new MessageDialog(response.ReasonPhrase); await md.ShowAsync(); return; } var claims = await response.Content.ReadAsAsync<IEnumerable<ViewClaim>>(); foreach (var claim in claims) { ListClaims.Items.Add(string.Format("{0}: {1}", claim.Type, claim.Value)); } }
private async void Launch_Click(object sender, RoutedEventArgs e) { if (FacebookClientID.Text == "") { rootPage.NotifyUser("Please enter an Client ID.", NotifyType.StatusMessage); return; } var uri = new Uri("https://graph.facebook.com/me"); HttpClient httpClient = GetAutoPickerHttpClient(FacebookClientID.Text); DebugPrint("Getting data from facebook...."); var request = new HttpRequestMessage(HttpMethod.Get, uri); try { var response = await httpClient.SendRequestAsync(request); if (response.IsSuccessStatusCode) { string userInfo = await response.Content.ReadAsStringAsync(); DebugPrint(userInfo); } else { string str = ""; if (response.Content != null) str = await response.Content.ReadAsStringAsync(); DebugPrint("ERROR: " + response.StatusCode + " " + response.ReasonPhrase + "\r\n" + str); } } catch (Exception ex) { DebugPrint("EXCEPTION: " + ex.Message); } }
private async void cmdRun_Click(object sender, RoutedEventArgs e) { Task stopAnimation = Task.Factory.StartNew(() => driver.StopAnimationAsync(false)); await stopAnimation; driver.StartDriverAsync(driveMode); RunAvaliable(false); }
private void btnReceive_Click(object sender, RoutedEventArgs e) { if (receiver == null) { try { receiver = new PushettaReceiver(new PushettaConfig() { APIKey = txtAPIKey.Text }); receiver.OnMessage += Receiver_OnMessage; receiver.SubscribeChannel(txtChannel.Text); lblMessageReceived.Visibility = Visibility.Visible; lblMessageReceived.Text = "WAITING FOR MESSAGES...."; } catch (PushettaException pex) { errorBlock.Visibility = Visibility.Visible; txtError.Text = pex.Message; } } }
private void BackButtonClicked(object sender, RoutedEventArgs e) { if (this.Parent is Popup) (this.Parent as Popup).IsOpen = false; SettingsPane.Show(); }
private async void OnCapturePhotoButtonClick(object sender, RoutedEventArgs e) { var file = await TestedControl.CapturePhotoToStorageFileAsync(ApplicationData.Current.TemporaryFolder); var bi = new BitmapImage(); IRandomAccessStreamWithContentType stream; try { stream = await TryCatchRetry.RunWithDelayAsync<Exception, IRandomAccessStreamWithContentType>( file.OpenReadAsync(), TimeSpan.FromSeconds(0.5), 10, true); } catch (Exception ex) { // Seems like a bug with WinRT not closing the file sometimes that writes the photo to. #pragma warning disable 4014 new MessageDialog(ex.Message, "Error").ShowAsync(); #pragma warning restore 4014 return; } bi.SetSource(stream); PhotoImage.Source = bi; CapturedVideoElement.Visibility = Visibility.Collapsed; PhotoImage.Visibility = Visibility.Visible; }
/// <summary> /// This is the click handler for the 'Authenticate' button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void AuthenticateButton_Click(object sender, RoutedEventArgs args) { AuthenticateButton.IsEnabled = false; #if WINDOWS_PHONE_APP // For windows phone we just skip authentication because native WISPr is not supported. // Here you can implement custom authentication. authenticationContext.SkipAuthentication(); rootPage.NotifyUser("Authentication skipped", NotifyType.StatusMessage); #else HotspotCredentialsAuthenticationResult result = await authenticationContext.IssueCredentialsAsync( ConfigStore.UserName, ConfigStore.Password, ConfigStore.ExtraParameters, ConfigStore.MarkAsManualConnect); if (result.ResponseCode == HotspotAuthenticationResponseCode.LoginSucceeded) { rootPage.NotifyUser("Issuing credentials succeeded", NotifyType.StatusMessage); Uri logoffUrl = result.LogoffUrl; if (logoffUrl != null) { rootPage.NotifyUser("The logoff URL is: " + logoffUrl.OriginalString, NotifyType.StatusMessage); } } else { rootPage.NotifyUser("Issuing credentials failed", NotifyType.ErrorMessage); } #endif AuthenticateButton.IsEnabled = true; }
public void HandleMultiple1(object sender, RoutedEventArgs e) { try { // run... var conn = this.GetConnection(); conn.CreateTableAsync<Customer>().ContinueWith(async (r) => { // go... Customer customer = new Customer("foo", "bar", "1"); await customer.InsertAsync(conn); int result1 = customer.CustomerId; // go... customer = new Customer("foo", "bar", "2"); await customer.InsertAsync(conn); int result2 = customer.CustomerId; // go... customer = new Customer("foo", "bar", "3"); await customer.InsertAsync(conn); int result3 = customer.CustomerId; // get all... var all = await conn.TableAsync<Customer>(); await this.ShowAlertAsync(string.Format("Results: {0}, {1}, {2}, count: {3}", result1, result2, result3, all.Count())); }); } catch (Exception ex) { this.ShowAlertAsync(ex); } }
private async void ButtonLogin_Click(object sender, RoutedEventArgs e) { Progress.IsActive = true; TextEmail.IsEnabled = false; TextPass.IsEnabled = false; ButtonLogin.IsEnabled = false; TextError.Visibility = Visibility.Collapsed; var data = await LogIn(TextEmail.Text, TextPass.Password); Progress.IsActive = false; TextEmail.IsEnabled = true; TextPass.IsEnabled = true; ButtonLogin.IsEnabled = true; if (data != null) { var json = JObject.Parse(data); // Set the listen key var model = App.Main; model.ListenKey = (string)json["listen_key"]; // Set account details ApplicationData.Current.LocalSettings.Values["AccountEmail"] = (string)json["email"]; ApplicationData.Current.LocalSettings.Values["FullName"] = (string)json["first_name"] + " " + (string)json["last_name"]; var parent = Parent as Popup; parent.IsOpen = false; } else { TextError.Visibility = Visibility.Visible; } }
/// <summary> /// This is the click handler for the 'Get Activity History' button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> async private void ScenarioGetActivityHistory(object sender, RoutedEventArgs e) { // Reset fields and status ScenarioOutput_Count.Text = "No data"; ScenarioOutput_Activity1.Text = "No data"; ScenarioOutput_Confidence1.Text = "No data"; ScenarioOutput_Timestamp1.Text = "No data"; ScenarioOutput_ActivityN.Text = "No data"; ScenarioOutput_ConfidenceN.Text = "No data"; ScenarioOutput_TimestampN.Text = "No data"; rootPage.NotifyUser("", NotifyType.StatusMessage); var calendar = new Calendar(); calendar.SetToNow(); calendar.AddDays(-1); var yesterday = calendar.GetDateTime(); // Get history from yesterday onwards var history = await ActivitySensor.GetSystemHistoryAsync(yesterday); ScenarioOutput_Count.Text = history.Count.ToString(); if (history.Count > 0) { var reading1 = history[0]; ScenarioOutput_Activity1.Text = reading1.Activity.ToString(); ScenarioOutput_Confidence1.Text = reading1.Confidence.ToString(); ScenarioOutput_Timestamp1.Text = reading1.Timestamp.ToString("u"); var readingN = history[history.Count - 1]; ScenarioOutput_ActivityN.Text = readingN.Activity.ToString(); ScenarioOutput_ConfidenceN.Text = readingN.Confidence.ToString(); ScenarioOutput_TimestampN.Text = readingN.Timestamp.ToString("u"); } }
private async void saveConf_Click(object sender, RoutedEventArgs e) { if(serverExt.Text == "" && token.Text == "" && port.Text == "" && serverInt.Text == "") { MessageDialog msgbox = new MessageDialog("Un ou plusieurs champs sont vide..."); await msgbox.ShowAsync(); } else { localSettings.Values["savedServerExt"] = serverExt.Text; localSettings.Values["savedServerInt"] = serverInt.Text; localSettings.Values["savedToken"] = token.Text; localSettings.Values["savedPort"] = port.Text; if (tts.IsOn) { localSettings.Values["tts"] = true; } else localSettings.Values["tts"] = false; Frame.Navigate(typeof(PageAction)); } }
private void CheckBoxComplete_Checked(object sender, RoutedEventArgs e) { CheckBox cb = (CheckBox) sender; Message message = cb.DataContext as Message; message.Complete = true; UpdateCheckedMessage(message); }
private void AssociatedPageLoaded(object sender, RoutedEventArgs e) { _associatedPage.Loaded -= AssociatedPageLoaded; _associatedPage.SizeChanged += PageBaseSizeChanged; DisplayInformation.GetForCurrentView().OrientationChanged += PageBaseOrientationChanged; DispatcherHelper.RunAsync(CheckOrientationForPage); }
/// <summary> // Launch a URI. Show an Open With dialog that lets the user chose the handler to use. /// </summary> private async void LaunchUriOpenWithButton_Click(object sender, RoutedEventArgs e) { // Create the URI to launch from a string. var uri = new Uri(UriToLaunch.Text); // Calulcate the position for the Open With dialog. // An alternative to using the point is to set the rect of the UI element that triggered the launch. Point openWithPosition = GetOpenWithPosition(LaunchUriOpenWithButton); // Next, configure the Open With dialog. var options = new Windows.System.LauncherOptions(); options.DisplayApplicationPicker = true; options.UI.InvocationPoint = openWithPosition; options.UI.PreferredPlacement = Windows.UI.Popups.Placement.Below; // Launch the URI. bool success = await Windows.System.Launcher.LaunchUriAsync(uri, options); if (success) { rootPage.NotifyUser("URI launched: " + uri.AbsoluteUri, NotifyType.StatusMessage); } else { rootPage.NotifyUser("URI launch failed.", NotifyType.ErrorMessage); } }
private void OnAdd(object sender, RoutedEventArgs e) { if (Added != null) Added(); if (Cancelled != null) Cancelled(); }
private void goToEdit(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(nombre.Text) && !string.IsNullOrWhiteSpace(direccion.Text) && !string.IsNullOrWhiteSpace(correo.Text) && !string.IsNullOrWhiteSpace(descripcion.Text) && !string.IsNullOrWhiteSpace(cuenta_bancaria.Text)) { FundacionParse obj = new FundacionParse(); itm.Nombre = nombre.Text; itm.ObjectId = "Cic5apx3U3"; itm.Descripcion = descripcion.Text; itm.Direccion = direccion.Text; itm.Correo = correo.Text; itm.Cuenta_bancaria = cuenta_bancaria.Text; itm.Telefono = telefono.Text; result.Text = "entra a cuardar"; //if (file != null) //result.Text = itm.Foto; itm.ArchivoImg = file; obj.updateFundacion(itm); //rootFrame.GoBack(); } else { result.Text = "Todos los campos son obligatorios"; } }
//ini method event handler appbar private void AppBarButton_Click(object sender, RoutedEventArgs e) { var appbar = sender as AppBarButton; if (appbar != null) { switch (appbar.Tag.ToString()) { case "Lv": Frame.Navigate(typeof(VListView)); break; case "Pv": Frame.Navigate(typeof(VPivot)); break; case "Hb": Frame.Navigate(typeof(VHub)); break; case "Fv": Frame.Navigate(typeof(VFlipView)); break; case "Gv": Frame.Navigate(typeof(VMain)); break; } } }
private void buyButton_Click(object sender, RoutedEventArgs e) { string products = ""; if ((bool)milkCheck.IsChecked) { products += "milk "; } if ((bool)butterCheck.IsChecked) { products += "butter "; } if ((bool)beerCheck.IsChecked) { products += "beer "; } if ((bool)chickenCheck.IsChecked) { products += "chicken "; } if ((bool)lemonadeCheck.IsChecked) { products += "lemonade "; } listBox.Text = products; }
private void learnMoreBtn_Click(object sender, RoutedEventArgs e) { // Navigate away from the app's extended splash screen after completing setup operations here... this.rootFrame.Navigate(typeof(SelectBatteryPage)); // Place the frame in the current Window Window.Current.Content = rootFrame; }
private async void ButtonFilePick_Click(object sender, RoutedEventArgs e) { var picker = new FileOpenPicker(); picker.ViewMode = PickerViewMode.Thumbnail; picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; picker.FileTypeFilter.Add(".jpg"); picker.FileTypeFilter.Add(".jpeg"); picker.FileTypeFilter.Add(".png"); StorageFile file = await picker.PickSingleFileAsync(); if (file != null) { ImageProperties imgProp = await file.Properties.GetImagePropertiesAsync(); var savedPictureStream = await file.OpenAsync(FileAccessMode.Read); //set image properties and show the taken photo bitmap = new WriteableBitmap((int)imgProp.Width, (int)imgProp.Height); await bitmap.SetSourceAsync(savedPictureStream); BBQImage.Source = bitmap; BBQImage.Visibility = Visibility.Visible; (this.DataContext as BBQRecipeViewModel).imageSource = file.Path; } }
private async void ButtonCamera_Click(object sender, RoutedEventArgs e) { CameraCaptureUI captureUI = new CameraCaptureUI(); captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg; captureUI.PhotoSettings.CroppedSizeInPixels = new Size(600, 600); StorageFile photo = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo); if (photo != null) { BitmapImage bmp = new BitmapImage(); IRandomAccessStream stream = await photo. OpenAsync(FileAccessMode.Read); bmp.SetSource(stream); BBQImage.Source = bmp; FileSavePicker savePicker = new FileSavePicker(); savePicker.FileTypeChoices.Add ("jpeg image", new List<string>() { ".jpeg" }); savePicker.SuggestedFileName = "New picture"; StorageFile savedFile = await savePicker.PickSaveFileAsync(); (this.DataContext as BBQRecipeViewModel).imageSource = savedFile.Path; if (savedFile != null) { await photo.MoveAndReplaceAsync(savedFile); } } }
// Cuts feature geometries with a user defined cut polyline. private async void CutButton_Click(object sender, RoutedEventArgs e) { try { _resultGraphicsOverlay.Graphics.Clear(); // wait for user to draw cut line var cutLine = await MyMapView.Editor.RequestShapeAsync(DrawShape.Polyline, _cutLineSymbol) as Polyline; Polyline polyline = GeometryEngine.NormalizeCentralMeridian(cutLine) as Polyline; // get intersecting features from the feature layer SpatialQueryFilter filter = new SpatialQueryFilter(); filter.Geometry = GeometryEngine.Project(polyline, _statesLayer.FeatureTable.SpatialReference); filter.SpatialRelationship = SpatialRelationship.Crosses; filter.MaximumRows = 52; var stateFeatures = await _statesLayer.FeatureTable.QueryAsync(filter); // Cut the feature geometries and add to graphics layer var states = stateFeatures.Select(feature => feature.Geometry); var cutGraphics = states .Where(geo => !GeometryEngine.Within(polyline, geo)) .SelectMany(state => GeometryEngine.Cut(state, polyline)) .Select(geo => new Graphic(geo, _cutFillSymbol)); _resultGraphicsOverlay.Graphics.AddRange(cutGraphics); } catch (TaskCanceledException) { } catch (Exception ex) { var _x = new MessageDialog("Cut Error: " + ex.Message, "Sample Error").ShowAsync(); } }
private void goBackward_Click(object sender, RoutedEventArgs e) { if (Frame.CanGoBack) { Frame.GoBack(); } }
/// <summary> /// This is the click handler for the 'Display' button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Display_Click(object sender, RoutedEventArgs e) { // This scenario uses the Windows.Globalization.Calendar class to display the parts of a date. // Store results here. StringBuilder results = new StringBuilder(); // Create Calendar objects using different constructors. Calendar calendar = new Calendar(); Calendar japaneseCalendar = new Calendar(new[] { "ja-JP" }, CalendarIdentifiers.Japanese, ClockIdentifiers.TwelveHour); Calendar hebrewCalendar = new Calendar(new[] { "he-IL" }, CalendarIdentifiers.Hebrew, ClockIdentifiers.TwentyFourHour); // Display individual date/time elements. results.AppendLine("User's default calendar system: " + calendar.GetCalendarSystem()); results.AppendLine("Name of Month: " + calendar.MonthAsSoloString()); results.AppendLine("Day of Month: " + calendar.DayAsPaddedString(2)); results.AppendLine("Day of Week: " + calendar.DayOfWeekAsSoloString()); results.AppendLine("Year: " + calendar.YearAsString()); results.AppendLine(); results.AppendLine("Calendar system: " + japaneseCalendar.GetCalendarSystem()); results.AppendLine("Name of Month: " + japaneseCalendar.MonthAsSoloString()); results.AppendLine("Day of Month: " + japaneseCalendar.DayAsPaddedString(2)); results.AppendLine("Day of Week: " + japaneseCalendar.DayOfWeekAsSoloString()); results.AppendLine("Year: " + japaneseCalendar.YearAsString()); results.AppendLine(); results.AppendLine("Calendar system: " + hebrewCalendar.GetCalendarSystem()); results.AppendLine("Name of Month: " + hebrewCalendar.MonthAsSoloString()); results.AppendLine("Day of Month: " + hebrewCalendar.DayAsPaddedString(2)); results.AppendLine("Day of Week: " + hebrewCalendar.DayOfWeekAsSoloString()); results.AppendLine("Year: " + hebrewCalendar.YearAsString()); results.AppendLine(); // Display the results OutputTextBlock.Text=results.ToString(); }
void TravelMap_Tapped(object sender, RoutedEventArgs e) { if (MyOverlay.Visibility == Windows.UI.Xaml.Visibility.Visible) { MyOverlay.Visibility = Windows.UI.Xaml.Visibility.Collapsed; } }
private void rdBtn_Click(object sender, RoutedEventArgs e) { if (sender != null && Frame != null) { Frame.Navigate(typeof(ReleasesPage)); } }
private void BarberOptionRbtn_Checked(object sender, Windows.UI.Xaml.RoutedEventArgs e) { estimatedTime = int.Parse(((RadioButton)sender).Tag.ToString()); }
protected virtual void OnLoaded(Windows.UI.Xaml.RoutedEventArgs e) { }
private void botonBack_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { popup.IsOpen = false; }
private void AudioAlbumView_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { this.Loaded -= AudioAlbumView_Loaded; FadeInAnimation.Begin(); }
/// <summary> /// Will set sub toggles from parent toggle control value /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void ToggleSwitch_Toggled(object sender, Windows.UI.Xaml.RoutedEventArgs e) { ToggleSwitch senderSwitch = sender as ToggleSwitch; Switch_ChildSwitched(senderSwitch.Name, senderSwitch.IsOn); }
private void btnHome_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { this.Frame.Navigate(typeof(GroupedItemsPage), "AllGroups"); }
private void BtnGarbageCollect_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { System.GC.Collect(); System.GC.WaitForPendingFinalizers(); }
private void UwpControl_Indeterminate(object sender, Windows.UI.Xaml.RoutedEventArgs e) { Indeterminate?.Invoke(this, EventArgs.Empty); }
private void UwpControl_Checked(object sender, Windows.UI.Xaml.RoutedEventArgs e) { Checked?.Invoke(this, EventArgs.Empty); }
private void SpecificHistory_Checked(object sender, Windows.UI.Xaml.RoutedEventArgs e) { SpanPicker.Visibility = Visibility.Visible; getAllHistory = false; rootPage.NotifyUser("This will retrieve all the step count history for the selected time span", NotifyType.StatusMessage); }
protected override void OnLostFocus(Windows.UI.Xaml.RoutedEventArgs e) { base.OnLostFocus(e); UpdateWatermarkVisualState(false); }