private void SaveButton_OnClick(object sender, RoutedEventArgs e) { if (expense == null) { // new expense var exp = new Expense { value = Utilities.ParseDecimalString(ValueTextBox.Text), date = ExpenseDatePicker.SelectedDate ?? DateTime.Today, category = (ExpenseCategory)CategoriesComboBox.SelectedItem, monthlyExpense = MonthlyExpenseCheckBox.IsChecked ?? false, comment = CommentTextBox.Text }; AppData.billingPeriods.ElementAt(AppData.currentPeriod).expenses.Add(exp); } else { // existing expense expense.value = Utilities.ParseDecimalString(ValueTextBox.Text); expense.date = ExpenseDatePicker.SelectedDate ?? DateTime.Today; expense.category = (ExpenseCategory)CategoriesComboBox.SelectedItem; expense.monthlyExpense = MonthlyExpenseCheckBox.IsChecked ?? false; expense.comment = CommentTextBox.Text; } AppData.isDataChanged = true; parent.Hide(); }
private void OnGoToDayButtonClickAsync(object sender, RoutedEventArgs e) { flyout.Hide(); DateTime endTime = new DateTime(year, month, day); //App.Database.SaveQuestsAsync(App.Database.GetQuestsOnDateAsync(endTime)); ViewModel.TempQuests.Clear(); ViewModel.TempQuests = App.Database.GetQuestsOnDateAsync(endTime); string shortString = endTime.ToShortDateString(); ViewModel.SelectedDay = shortString; Items.SelectedItem = DayPivot; this.Bindings.Update(); }
public static void ShowMessage(string message, double duration) { var label = new TextBlock { Text = message, Foreground = new SolidColorBrush(Windows.UI.Colors.Black), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, }; var style = new Style { TargetType = typeof(FlyoutPresenter) }; style.Setters.Add(new Setter(Control.BackgroundProperty, new SolidColorBrush(Windows.UI.Colors.White))); style.Setters.Add(new Setter(FrameworkElement.MaxHeightProperty, 1)); var flyout = new Flyout { Content = label, Placement = FlyoutPlacementMode.Bottom, FlyoutPresenterStyle = style, }; flyout.ShowAt(Window.Current.Content as FrameworkElement); var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(duration) }; timer.Tick += (sender, e) => { timer.Stop(); flyout.Hide(); }; timer.Start(); }
private void btnAddCourse_Click(object sender, RoutedEventArgs e) { //隐藏Flyout Flyout flyout = btnUserControl.Flyout as Flyout; if (flyout != null) { flyout.Hide(); } //禁用用户选项 btnUserControl.IsEnabled = false; //清空面板上的数据 txtCourseName.Text = ""; txtClassroom.Text = ""; txtTeacher.Text = ""; txtCredit.Text = ""; txtClassify.Text = ""; ComboDayOfWeek.SelectedIndex = -1; ComboCourseStart.SelectedIndex = -1; ComboCourseEnd.SelectedIndex = -1; ComboSelectedMode.SelectedIndex = -1; ComboWeekStart.SelectedIndex = -1; ComboWeekEnd.SelectedIndex = -1; AddCourseGrid.Visibility = Visibility.Visible; }
private void ShowPopup(FrameworkElement el) { ListView listView = new ListView() { Header = Input.Title, DisplayMemberPath = "Content", ItemsSource = Input.Children, SelectedItem = Input.Children.FirstOrDefault(i => i.Id == Value), IsItemClickEnabled = true }; Flyout flyout = new Flyout(); flyout.Content = new StackPanel() { Width = 300, Children = { listView } }; listView.ItemClick += (s, e) => { SelectItem(e.ClickedItem as Selection); flyout.Hide(); }; flyout.ShowAt(el); }
public async Task<Tuple<bool, bool>> GetUserConfirmationBeforeDeletingBinderAsync(CancellationToken cancToken) { var result = new Tuple<bool, bool>(false, false); Flyout dialog = null; ConfirmationBeforeDeletingBinder dialogContent = null; await RunInUiThreadAsync(delegate { dialog = new Flyout(); dialogContent = new ConfirmationBeforeDeletingBinder(); dialog.Closed += OnDialog_Closed; dialog.Content = dialogContent; dialogContent.UserAnswered += OnYesNoDialogContent_UserAnswered; _isHasUserAnswered = false; dialog.ShowAt(Window.Current.Content as FrameworkElement); }).ConfigureAwait(false); while (!_isHasUserAnswered && !cancToken.IsCancellationRequested) { await Task.Delay(DELAY, cancToken).ConfigureAwait(false); } await RunInUiThreadAsync(delegate { dialog.Closed -= OnDialog_Closed; dialogContent.UserAnswered -= OnYesNoDialogContent_UserAnswered; dialog.Hide(); result = new Tuple<bool, bool>(dialogContent.YesNo, dialogContent.IsHasUserInteracted); }).ConfigureAwait(false); return result; }
private static void SwapFlyouts(Flyout oldFlyout, Flyout newFlyout) { if (oldFlyout != null) { oldFlyout.Closed -= OnFlyoutClosed; oldFlyout.Hide(); ((FrameworkElement)oldFlyout.Content).DataContext = null; } if (titleBar == null) { titleBar = CoreApplication.GetCurrentView().TitleBar; UpdateInset(); titleBar.LayoutMetricsChanged += (o, e) => UpdateInset(); } CurrentFlyout = newFlyout; if (newFlyout != null) { newFlyout.Closed += OnFlyoutClosed; CurrentFlyout.ShowAt(TargetElement, new FlyoutShowOptions { Position = new Point(TargetElement.ActualWidth / 2, FlyoutInset + 40), ShowMode = FlyoutShowMode.Transient }); } }
static void OnPageActionSheet(object sender, ActionSheetArguments options) { bool userDidSelect = false; var flyoutContent = new FormsFlyout(options); var actionSheet = new Flyout { FlyoutPresenterStyle = (Windows.UI.Xaml.Style)Windows.UI.Xaml.Application.Current.Resources["FormsFlyoutPresenterStyle"], Placement = Windows.UI.Xaml.Controls.Primitives.FlyoutPlacementMode.Full, Content = flyoutContent }; flyoutContent.OptionSelected += (s, e) => { userDidSelect = true; actionSheet.Hide(); }; actionSheet.Closed += (s, e) => { if (!userDidSelect) { options.SetResult(null); } }; actionSheet.ShowAt(((Page)sender).GetOrCreateRenderer().ContainerElement); }
private void SecondaryCommandBarButton_Click(object sender, RoutedEventArgs e) { if (_cachedSecondaryFlyout != null) { _cachedSecondaryFlyout.Hide(); } }
public void Close() { if (null != Flyout) { Flyout.Hide(); } }
private async void Accept_Click(object sender, RoutedEventArgs e) { Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder; await storageFolder.CreateFileAsync("username.txt", Windows.Storage.CreationCollisionOption.OpenIfExists); await checkUser(); // hier moet je uit dat textveld waar die acceptbutton in staat even die waarden eruit halen en die variabele in de methode hieronder zetten i.p.v 8000 en 127.0.0.1 try { string[] strings = loginBox.Text.Trim().Split(':'); await EH.ConnectToBridge("lol", strings[1], strings[0]); EH.SAR.ip = strings[0]; EH.SAR.port = strings[1]; await EH.getAlldata(); //collectionlamp = EH.lamps; foreach (Lamp l in EH.lamps) { collectionlamp.Add(l); } Flyout f = Resources["Login"] as Flyout; f.Hide(); LoginButton.IsEnabled = false; } catch (Exception) { Flyout flyout = new Flyout(); TextBlock b = new TextBlock(); b.Text = "Please make sure you entered the adress correctly"; flyout.Content = b; flyout.ShowAt(Elipse); } }
private void B_Click(object sender, RoutedEventArgs e) { media.MediaPlayer.Pause(); rootGrid.IsHitTestVisible = true; Flyout.Hide(); Grid_Tapped(null, null); }
protected override void OnNavigatedFrom(NavigationEventArgs e) { dt.Stop(); Flyout.Hide(); media.MediaPlayer.Pause(); base.OnNavigatedFrom(e); }
static Flyout ActionSheetFlyout(ActionSheetArguments options) { bool userDidSelect = false; var flyoutContent = new FormsFlyout(options); var actionSheet = new Flyout { FlyoutPresenterStyle = (Style)Application.Current.Resources["FormsFlyoutPresenterStyle"], Placement = FlyoutPlacementMode.Full, Content = flyoutContent }; flyoutContent.OptionSelected += (s, e) => { userDidSelect = true; actionSheet.Hide(); }; actionSheet.Closed += (s, e) => { if (!userDidSelect) { options.SetResult(null); } }; return(actionSheet); }
private async void Confirm_OnClick(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(Url)) { await(new MessageDialog(string.Format("请填写{0}", UrlTextBox.Header))).ShowAsync(); } Dialoug.Hide(); }
private void PropertyChangedHandler(object sender, PropertyChangedEventArgs e) { // Hide the flyout when the call ends. if (e.PropertyName == "State" && _audioCallViewModel.State == AudioCallViewModel.CallState.Default) { _microphoneIsNotAvailableFylout?.Hide(); } }
private void SaveButton_OnClick(object sender, RoutedEventArgs e) { if (category != null) { category.name = NameTextBox.Text; AppData.isDataChanged = true; } else { AppData.expenseCategories.Add(new ExpenseCategory() { name = NameTextBox.Text }); } AppData.isDataChanged = true; parent.Hide(); }
private async void Button_Click(object sender, RoutedEventArgs e) { InputBox.Document.GetText(TextGetOptions.UseObjectText, out string contentText); contentText = contentText.Replace("\r", "\r\n"); if (string.IsNullOrWhiteSpace(contentText)) { return; } using (MultipartFormDataContent content = new MultipartFormDataContent(GetBoundary())) { switch (mode) { case MakeFeedMode.Feed: content.Add(new StringContent(contentText), "message"); content.Add(new StringContent("feed"), "type"); content.Add(new StringContent("0"), "is_html_article"); if (await Tools.Post("/feed/createFeed", content)) { Frame.GoBack(); Tools.ShowMessage("发送成功"); } break; case MakeFeedMode.Reply: content.Add(new StringContent(contentText), "message"); if (await Tools.Post($"/feed/reply?id={feedId}&type=feed", content)) { Tools.ShowMessage("发送成功"); InputBox.Document.SetText(TextSetOptions.None, string.Empty); flyout.Hide(); } break; case MakeFeedMode.ReplyReply: content.Add(new StringContent(contentText), "message"); if (await Tools.Post($"/feed/reply?id={feedId}&type=reply", content)) { Tools.ShowMessage("发送成功"); InputBox.Document.SetText(TextSetOptions.None, string.Empty); flyout.Hide(); } break; } } }
private void DeleteConfirmation_Click(object sender, RoutedEventArgs e) { Flyout f = this.Control1.Flyout as Flyout; if (f != null) { f.Hide(); } }
private void OnFlyoutSetingButtonClicked(object sender, RoutedEventArgs e) { Flyout settingItem = assign_developer.Flyout as Flyout; if (settingItem != null) { settingItem.Hide(); } }
private void CloseDeleteFlyout(object sender, Windows.UI.Xaml.RoutedEventArgs e) { if (_activeFlyout != null) { _activeFlyout.Hide(); } _activeFlyout = null; }
private void HideFlyout() { if (_flyout != null) { _flyout.Hide(); _flyout = null; _flyoutContent = null; } }
public void Dispose() { Flyout original = Interlocked.Exchange(ref this.flyout, null); if (original != null) { original.Hide(); } }
private void DeleteConfirmation_Click(object sender, RoutedEventArgs e) { Flyout f = FlyoutService.GetFlyout(Control1) as Flyout; if (f != null) { f.Hide(); } }
private void textBox_KeyUp(object sender, KeyRoutedEventArgs e) { switch (e.Key) { case VirtualKey.Control: isCtrlKeyPressed = false; //TweetTextBox.AcceptsReturn = true;//コントロールキー押下中は改行をゆるさない...絶対にゆるさないっ!! break; case VirtualKey.Enter: if (isCtrlKeyPressed) { TweetButtonClicked(TweetButton, e); } else { if (textingReplyFlg) { var item = (UserAccessToken)ReplyUserSuggestionList.SelectedItem; var screenName = item.user.screen_name; var before = TweetTextBox.Text.Substring(0, screenNameBeginFrom - 1); var after = TweetTextBox.Text.Substring(TweetTextBox.SelectionStart); TweetTextBox.Text = before + "@" + screenName + " " + after; ReplyUserSuggestionFlyout.Hide(); //TweetTextBox.AcceptsReturn = true; textingReplyFlg = false; TweetTextBox.SelectionStart = before.Length + screenName.Length + 2; } } break; case VirtualKey.Space: if (!isCtrlKeyPressed) { if (textingReplyFlg) { //TweetTextBox.AcceptsReturn = true; textingReplyFlg = false; ReplyUserSuggestionFlyout.Hide(); } } break; } }
void OnActionSheetRequested(Page sender, ActionSheetArguments arguments) { bool userDidSelect = false; if (arguments.FlowDirection == FlowDirection.MatchParent) { // TODO: Check EffectiveFlowDirection } var actionSheetContent = new ActionSheetContent(arguments); var actionSheet = new Flyout { Placement = UI.Xaml.Controls.Primitives.FlyoutPlacementMode.Full, Content = actionSheetContent }; actionSheetContent.OptionSelected += (s, e) => { userDidSelect = true; actionSheet.Hide(); }; actionSheet.Closed += (s, e) => { if (!userDidSelect) { arguments.SetResult(null); } }; try { var pageParent = sender.ToPlatform(MauiContext).Parent as FrameworkElement; if (pageParent != null) { actionSheet.ShowAt(pageParent); } else { arguments.SetResult(null); } } catch (ArgumentException) // If the page is not in the visual tree { if (UI.Xaml.Window.Current != null && UI.Xaml.Window.Current.Content is FrameworkElement mainPage) { actionSheet.ShowAt(mainPage); } else { arguments.SetResult(null); } } }
private void AttributeSaveButton_Click(object sender, RoutedEventArgs e) { string newValue = this.AttributeNameField.Text; if (!String.IsNullOrWhiteSpace(newValue)) { _instance.AttributeName = newValue; _flyout.Hide(); } }
private void EraseAllInk(object sender, RoutedEventArgs e) { //_pencilStrokes.Clear(); //_otherStrokes.Clear(); _inkStrokes.Clear(); DrawingCanvas.Invalidate(); _eraseAllFlyout.Hide(); }
private async void ListView_ItemClick(object sender, ItemClickEventArgs e) { _flyout.Hide(); var success = await ConnectedService.Instance.ConnectToSystem(e.ClickedItem as AdventureRemoteSystem, "slideshow/" + _adventure.Id); if (success) { Frame.Navigate(typeof(SlideshowClientPage), _adventure.Id.ToString()); } }
public TextWithCopy(string text, bool link = false) { this.ColumnDefinitions.Add(new ColumnDefinition { Width = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto) }); this.ColumnDefinitions.Add(new ColumnDefinition { Width = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto) }); var block = new TextBlock { Text = text, VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center }; this.Children.Add(block); if (link) { block.Foreground = new SolidColorBrush(Colors.Blue); block.PointerPressed += async(a, b) => await Windows.System.Launcher.LaunchUriAsync(new Uri((new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b").IsMatch(text) ? "http://" : "") + text)); } var copy = new Button { Content = new FontIcon { Glyph = "\uE8C8" }, CornerRadius = new Windows.UI.Xaml.CornerRadius(3), Background = new SolidColorBrush(Colors.Transparent), Margin = new Windows.UI.Xaml.Thickness(5, 0, 0, 0), VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center }; Grid.SetColumn(copy, 1); this.Children.Add(copy); copy.Click += (a, b) => { var pkg = new DataPackage(); pkg.SetText(text); Clipboard.SetContent(pkg); var flyout = new Flyout { Content = new TextBlock { Text = Utils.LocString("Copied") } }; flyout.ShowAt(copy); Task.Factory.StartNew(() => { Thread.Sleep(1000); App.UIThread(() => flyout.Hide()); }); }; }
private void AttributeSaveButton_Click(object sender, RoutedEventArgs e) { string newValue = this.AttributeNameField.Text; PrimitiveTypes newType = (PrimitiveTypes)Enum.Parse(typeof(PrimitiveTypes), (this.AttributeTypeField.SelectedItem as ComboBoxItem).Content.ToString()); if (!String.IsNullOrWhiteSpace(newValue)) { _instance.AddPrimitiveAttribute(newValue, newType); _flyout.Hide(); } }
public static Flyout ToPopup(this IContextMenu source) { var flyout = new Flyout(); ItemsControl items = new ItemsControl(); foreach(var item in source.Items) { Button button = new Button(); button.Content = item.Header; button.Command = new RelayCommand<object>( (param) => { flyout.Hide(); item.Command.Execute(param); }, (param) => item.Command.CanExecute(param)); button.CommandParameter = item.CommandParameter; button.HorizontalAlignment = HorizontalAlignment.Stretch; items.Items.Add(button); } Border border = new Border(); border.Padding = new Thickness(12); border.MinWidth = 480; border.HorizontalAlignment = HorizontalAlignment.Stretch; border.VerticalAlignment = VerticalAlignment.Bottom; border.Child = items; flyout.Content = border; return flyout; }
private void SendCommand_Tapped(object sender, TappedRoutedEventArgs e) { Flyout flyOut = new Flyout(); flyOut.Placement = FlyoutPlacementMode.Top; flyOut.FlyoutPresenterStyle = new Style(typeof(FlyoutPresenter)); flyOut.FlyoutPresenterStyle.Setters.Add(new Setter(FlyoutPresenter.RequestedThemeProperty, ElementTheme.Dark)); flyOut.FlyoutPresenterStyle.Setters.Add(new Setter(FlyoutPresenter.PaddingProperty, 10)); StackPanel panel = new StackPanel(); panel.Width = 300; panel.Margin = new Thickness(10); panel.Orientation = Orientation.Vertical; panel.Children.Add(new TextBlock() { Text = "Command name", FontSize = 14.8 }); TextBox commandName = new TextBox(); panel.Children.Add(commandName); panel.Children.Add(new TextBlock() { Text = "Params", FontSize = 14.8, Margin = new Thickness(0, 10, 0, 0) }); TextBox commandParams = new TextBox(); panel.Children.Add(commandParams); panel.Children.Add(new TextBlock() { Text = "JSON or empty string" }); Button sendButton = new Button() { Content = "Send", Margin = new Thickness(0, 10, 0, 0) }; panel.Children.Add(sendButton); if (CommandSelected != null) { commandName.Text = CommandSelected.Name; commandParams.Text = (string)new ObjectToJsonStringConverter().Convert(CommandSelected.Parameters, null, null, null); } sendButton.Command = new DelegateCommand(async () => { if (commandName.Text.Trim() == "") { new MessageDialog("Empty command name", "Send command").ShowAsync(); return; } panel.ControlsEnable(false); LoadingItems++; try { var command = new Command(commandName.Text, commandParams.Text != "" ? JObject.Parse(commandParams.Text) : null); Debug.WriteLine("CMD SEND START"); await ClientService.Current.SendCommandAsync(deviceId, command, CommandResultCallback); Debug.WriteLine("CMD SEND END"); flyOut.Hide(); } catch (Exception ex) { new MessageDialog(ex.Message, "Send command").ShowAsync(); } panel.ControlsEnable(true); LoadingItems--; }); flyOut.Content = panel; flyOut.ShowAt((FrameworkElement)sender); }
public async Task ShowTextAsync(string text, CancellationToken cancToken) { Flyout dialog = null; TextViewer tv = null; await RunInUiThreadAsync(delegate { dialog = new Flyout(); tv = new TextViewer(text); dialog.Closed += OnDialog_Closed; dialog.Content = tv; tv.UserAnswered += OnTextViewer_UserAnswered; ; _isHasUserAnswered = false; dialog.ShowAt(Window.Current.Content as FrameworkElement); }).ConfigureAwait(false); while (!_isHasUserAnswered && !cancToken.IsCancellationRequested) { await Task.Delay(DELAY, cancToken).ConfigureAwait(false); } await RunInUiThreadAsync(delegate { dialog.Closed -= OnDialog_Closed; tv.UserAnswered -= OnTextViewer_UserAnswered; dialog.Hide(); }).ConfigureAwait(false); }
public async Task<Tuple<BriefcaseVM.ImportBinderOperations, string>> GetUserChoiceBeforeImportingBinderAsync(string targetBinderName, CancellationToken cancToken) { var result = new Tuple<BriefcaseVM.ImportBinderOperations, string>(BriefcaseVM.ImportBinderOperations.Cancel, string.Empty); Flyout dialog = null; ChoiceBeforeImportingBinder dialogContent = null; await RunInUiThreadAsync(delegate { dialog = new Flyout(); dialogContent = new ChoiceBeforeImportingBinder(targetBinderName); dialog.Closed += OnDialog_Closed; dialog.Content = dialogContent; dialogContent.UserAnswered += OnThreeBtnDialogContent_UserAnswered; _isHasUserAnswered = false; dialog.ShowAt(Window.Current.Content as FrameworkElement); }).ConfigureAwait(false); while (!_isHasUserAnswered && !cancToken.IsCancellationRequested) { await Task.Delay(DELAY, cancToken).ConfigureAwait(false); } await RunInUiThreadAsync(delegate { dialog.Closed -= OnDialog_Closed; dialogContent.UserAnswered -= OnThreeBtnDialogContent_UserAnswered; dialog.Hide(); result = new Tuple<BriefcaseVM.ImportBinderOperations, string>(dialogContent.Operation, dialogContent.DBName); }).ConfigureAwait(false); return result; }