private (Button, Button, TextBox, TextBox, CalendarDatePicker, StewardessDTO) RenderDetail(ItemClickEventArgs e) { var stewardess = (StewardessDTO)e.ClickedItem; SingleItem.Children.Clear(); var id = new TextBlock(); id.Text = "Pilot id:" + stewardess.Id; id.FontWeight = Windows.UI.Text.FontWeights.Bold; id.Margin = new Thickness(0, 100, 10, 10); id.Width = 200; var firstname = new TextBox { Header = "FirstName", Text = stewardess.FirstName, Width = 200, HorizontalAlignment = HorizontalAlignment.Center }; var lastname = new TextBox { Header = "Lastname", Text = stewardess.LastName, Width = 200, HorizontalAlignment = HorizontalAlignment.Center }; var birthday = new CalendarDatePicker { Header = "Experience", Date = DateTime.Parse(stewardess.DateOfBirth), Width = 200, HorizontalAlignment = HorizontalAlignment.Center }; var btnUpdate = new Button { Content = "Update", Width = 100 }; var btnDelete = new Button { Content = "Delete", Width = 100 }; var buttonsStack = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 20, 0, 0) }; SingleItem.Children.Add(id); SingleItem.Children.Add(firstname); SingleItem.Children.Add(lastname); SingleItem.Children.Add(birthday); buttonsStack.Children.Add(btnUpdate); buttonsStack.Children.Add(btnDelete); SingleItem.Children.Add(buttonsStack); return(btnUpdate, btnDelete, firstname, lastname, birthday, stewardess); }
private void BirthdayPicker_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { this._currentStudent.DoB = sender.Date.Value.ToString("yyyy-MM-dd"); }
private async void Picker_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { Display.ItemsSource = await library.ListAsync((DateTimeOffset)Picker.Date); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar; titleBar.ButtonBackgroundColor = Colors.Transparent; titleBar.ButtonInactiveBackgroundColor = Colors.Transparent; formato_seleccionado = (e.Parameter) as Formato; string sFilePath = "Formatos/" + formato_seleccionado.formato_id + ".pdf"; sFilePathWord = "Formatos/" + formato_seleccionado.formato_id + ".docx"; var uri = new Uri("ms-appx:///Formatos/" + formato_seleccionado.formato_id + ".pdf"); Source = uri; #region CheckBox_GridView checkb_grid = new GridView(); checkb_grid.Width = double.NaN; checkb_grid.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; checkb_grid.HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; #endregion #region ComboBox_GridView combob_grid = new GridView(); combob_grid.Width = double.NaN; combob_grid.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; combob_grid.HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; #endregion textbox_sp = new StackPanel(); textbox_sp.Width = double.NaN; string texto = await pdfTextExtract(sFilePath); //int contador = charCounter(ref texto); textAreas = GetWordBasedOn(ref texto, "<[", "]>"); comboBoxes[0].Items.Clear(); comboBoxes[1].Items.Clear(); comboBoxes[2].Items.Clear(); comboBoxes[0].SelectionChanged += async(sender, x) => { comboBoxes[1].ItemsSource = await DBAssets.getGruposOnCarreraAsync((App.Current as App).ConnectionString, comboBoxes[0].SelectedItem.ToString()); }; comboBoxes[1].SelectionChanged += async(sender, x) => { comboBoxes[2].ItemsSource = await DBAssets.GetAlumnosBasedOnGrupoAsync((App.Current as App).ConnectionString, (comboBoxes[1].SelectedItem as InfoGruposGS).grupo, (comboBoxes[1].SelectedItem as InfoGruposGS).semestre); }; for (int i = 0; i < textAreas.Count; i++) { if (textAreas[i].Length <= 1) { CheckBox incisos = new CheckBox(); incisos.Name = textAreas[i]; incisos.Width = double.NaN; incisos.Height = double.NaN; incisos.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; incisos.HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; incisos.Margin = new Thickness(10, 3, 10, 3); incisos.FlowDirection = FlowDirection.LeftToRight; incisos.Content = textAreas[i] + ")"; checkBoxes.Add(incisos); checkb_grid.Items.Add(incisos); } else { if (textAreas[i].ToLower().Contains("no oficio") || textAreas[i].ToLower().Contains("no semestre") || textAreas[i].ToLower().Contains("no constancias")) { TextBox oficio = new TextBox(); textBoxes.Add(oficio); oficio.Name = textAreas[i].Replace(' ', '_'); oficio.IsReadOnly = false; oficio.Text = "1"; oficio.Margin = new Thickness(10, 3, 10, 3); oficio.Height = double.NaN; oficio.Width = 200; oficio.Header = textAreas[i]; oficio.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center; oficio.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; combob_grid.Items.Add(oficio); } else if (textAreas[i].ToLower().Contains("año") || textAreas[i].ToLower().Contains("periodo")) { DatePicker fecha = new DatePicker(); if (textAreas[i].ToLower().Contains("año")) { fecha.DayVisible = false; fecha.MonthVisible = false; } else { fecha.DayVisible = false; fecha.YearVisible = false; } fecha.Name = textAreas[i].Replace(' ', '_'); fecha.CharacterSpacing = 0; fecha.Header = textAreas[i]; fecha.Margin = new Thickness(10, 3, 10, 3); fecha.Height = double.NaN; fecha.HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Left; datePickers.Add(fecha); combob_grid.Items.Add(fecha); } else if (textAreas[i].ToLower().Contains("fecha")) { CalendarDatePicker dp = new CalendarDatePicker(); dp.Name = textAreas[i].Replace(' ', '_'); dp.Header = textAreas[i]; dp.Height = double.NaN; dp.Margin = new Thickness(10, 3, 10, 3); dp.Width = 200; dp.PlaceholderText = "Seleccione la fecha"; dp.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center; dp.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; calendarDatePickers.Add(dp); combob_grid.Items.Add(dp); } else if (textAreas[i].ToLower().Contains("situacion") || textAreas[i].ToLower().Contains("descripcion") || textAreas[i].ToLower().Contains("asunto") || textAreas[i].ToLower().Contains("cargo")) { RichEditBox info = new RichEditBox(); info.Name = textAreas[i].Replace(' ', '_'); info.Width = double.NaN; info.Height = 100; info.Header = textAreas[i]; info.Margin = new Thickness(30, 3, 10, 3); richEditBoxes.Add(info); textbox_sp.Children.Add(info); } else if (textAreas[i].ToLower().ToLower().Contains("jefe") || textAreas[i].ToLower().ToLower().Contains("grupo") || textAreas[i].ToLower().ToLower().Contains("correo") || textAreas[i].ToLower().ToLower().Contains("imagen")) { //if (textAreas[i].ToLower().Contains("Jefe de Tutorias")); //replace(Pagina_Configuracion.); } else if (textAreas[i] != "Carrera") { ComboBox desplegables = new ComboBox(); desplegables.Name = textAreas[i].Replace(' ', '_'); desplegables.Width = 200; desplegables.Margin = new Thickness(10, 3, 10, 3); desplegables.Height = double.NaN; desplegables.Header = textAreas[i]; desplegables.PlaceholderText = "Seleccione un item"; desplegables.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center; desplegables.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; desplegables.Text = textAreas[i]; comboBoxes.Add(desplegables); switch (desplegables.Name) { case "Nombre_Docente": desplegables.ItemsSource = await DBAssets.getProfesoresTutoresAsync((App.Current as App).ConnectionString); break; case "Ciudad_Estado": CiudadesEstados.getCiudadesEstados().ForEach(p => desplegables.Items.Add(p.Capital + ", " + p.Estado)); break; case "Nombre_Tutor": desplegables.ItemsSource = await DBAssets.getProfesoresTutoresAsync((App.Current as App).ConnectionString); break; } combob_grid.Items.Add(desplegables); } else { comboBoxes[0].ItemsSource = await DBAssets.getStringsAsync((App.Current as App).ConnectionString, "SELECT DISTINCT carrera FROM Tutores;"); } } } primary.Children.Add(combob_grid); primary.Children.Add(checkb_grid); primary.Children.Add(textbox_sp); primary.Children.Add(guardarBtn); }
private void FlyoutCalendarDatePicker_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { App.AppStatisticDataViewModel.SetTotalTodosAndNamePerADay(args.NewDate.Value.Date); SetJournalText(args.NewDate.Value.Date); }
private void change_time(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { this.hhh.birthday = sender.Date.Value.ToString("yyyy-MM-dd"); }
private void CalendarDatePicker3_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { tb3.Text = FilDate.Date.ToString(); }
private void EndDatePicker_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { EndDateClearButton.Visibility = Visibility.Visible; if (EndDatePicker.Date == null) { EndHourTimePicker.Time = new TimeSpan(0, 0, 0); EndDateClearButton.Visibility = Visibility.Collapsed; } }
private void CalendarDatePicker_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { tb1.Text = OrdDate.Date.ToString(); }
private void CalendarDatePicker2_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { tb2.Text = LevDate.Date.ToString(); }
public CalendarDatePickerEvents(CalendarDatePicker This) : base(This) { this.This = This; }
private void RankDateTimeCalendarDatePicker_OnDateChangedWhenLoaded(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { ChangeSource(); }
private void CalendarDatePicker_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { }
private async void DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { await RetrievePhoto(); }
private async void dateMonthCalender_DateChangedAsync(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { await RetrievePhoto(); }
private void BirthDay_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { Debug.WriteLine("ngay sinh"); }
private void DateValue_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) => SetPrimaryButtonEnabling();
/// <summary> /// Shows a dialog to allow copy a node link to the clipboard or share it using other app /// </summary> /// <param name="node">Node to share the link</param> public static async void ShowShareLink(NodeViewModel node) { var dialog = new MegaContentDialog { Background = (Brush)Application.Current.Resources["MegaAppBackgroundBrush"], BorderBrush = (Brush)Application.Current.Resources["MegaDialogBorderBrush"], CloseButtonVisibility = Visibility.Visible, IsPrimaryButtonEnabled = true, IsSecondaryButtonEnabled = true, Margin = new Thickness(0, 0, 24, 24), PrimaryButtonText = ResourceService.UiResources.GetString("UI_Copy"), SecondaryButtonText = ResourceService.UiResources.GetString("UI_Share"), Style = (Style)Application.Current.Resources["MegaAlertDialogStyle"], Title = ResourceService.UiResources.GetString("UI_ExportLink") }; dialog.CloseButtonCommand = new RelayCommand(() => dialog.Hide()); var stackPanel = new StackPanel { Margin = new Thickness(24, 24, 0, 0) }; var messageText = new TextBlock { Text = node.ExportLink, Margin = new Thickness(0, 20, 0, 12), TextWrapping = TextWrapping.WrapWholeWords, HorizontalAlignment = HorizontalAlignment.Stretch, }; var linkWithoutKey = new RadioButton { Content = ResourceService.UiResources.GetString("UI_LinkWithoutKey") }; linkWithoutKey.Checked += (sender, args) => messageText.Text = node.OriginalMNode.getPublicLink(false); var decryptionKey = new RadioButton { Content = ResourceService.UiResources.GetString("UI_DecryptionKey") }; decryptionKey.Checked += (sender, args) => messageText.Text = node.OriginalMNode.getBase64Key(); var linkWithKey = new RadioButton { Content = ResourceService.UiResources.GetString("UI_LinkWithKey"), IsChecked = true }; linkWithKey.Checked += (sender, args) => messageText.Text = node.OriginalMNode.getPublicLink(true); stackPanel.Children.Add(linkWithoutKey); stackPanel.Children.Add(decryptionKey); stackPanel.Children.Add(linkWithKey); var stackPanelLinkWithExpirationDate = new StackPanel { Orientation = Orientation.Horizontal }; var linkWithExpirationDateLabel = new TextBlock { Text = node.SetLinkExpirationDateText, Margin = new Thickness(0, 20, 0, 8), TextWrapping = TextWrapping.WrapWholeWords, HorizontalAlignment = HorizontalAlignment.Stretch, }; var enableLinkExpirationDateSwitch = new ToggleSwitch { IsOn = node.LinkWithExpirationTime, IsEnabled = AccountService.AccountDetails.IsProAccount }; var expirationDateCalendarDatePicker = new CalendarDatePicker { IsEnabled = enableLinkExpirationDateSwitch.IsOn, DateFormat = "{day.integer(2)}/{month.integer(2)}/{year.full}", Date = node.LinkExpirationDate }; expirationDateCalendarDatePicker.Opened += (sender, args) => { expirationDateCalendarDatePicker.LightDismissOverlayMode = LightDismissOverlayMode.On; expirationDateCalendarDatePicker.MinDate = DateTime.Today.AddDays(1); }; expirationDateCalendarDatePicker.DateChanged += (sender, args) => { expirationDateCalendarDatePicker.IsCalendarOpen = false; if (expirationDateCalendarDatePicker.Date == null) { enableLinkExpirationDateSwitch.IsOn = false; if (node.LinkExpirationTime > 0) { node.SetLinkExpirationTime(0); } } else if (node.LinkExpirationDate == null || !node.LinkExpirationDate.Value.ToUniversalTime().Equals(expirationDateCalendarDatePicker.Date.Value.ToUniversalTime())) { node.SetLinkExpirationTime(expirationDateCalendarDatePicker.Date.Value.ToUniversalTime().ToUnixTimeSeconds()); } }; enableLinkExpirationDateSwitch.Toggled += (sender, args) => { expirationDateCalendarDatePicker.IsEnabled = enableLinkExpirationDateSwitch.IsOn; if (enableLinkExpirationDateSwitch.IsOn) { expirationDateCalendarDatePicker.Date = node.LinkExpirationDate; } else { expirationDateCalendarDatePicker.Date = null; } }; stackPanelLinkWithExpirationDate.Children.Add(enableLinkExpirationDateSwitch); stackPanelLinkWithExpirationDate.Children.Add(expirationDateCalendarDatePicker); stackPanel.Children.Add(linkWithExpirationDateLabel); stackPanel.Children.Add(stackPanelLinkWithExpirationDate); stackPanel.Children.Add(messageText); dialog.Content = stackPanel; var result = await dialog.ShowAsyncQueue(); switch (result) { case ContentDialogResult.None: break; case ContentDialogResult.Primary: ShareService.CopyLinkToClipboard(messageText.Text); break; case ContentDialogResult.Secondary: ShareService.ShareLink(messageText.Text); break; default: throw new ArgumentOutOfRangeException(); } }
private void MyDatePicker_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { AccommodationViewModel.FromDate = DatePickerParser(MyDatePicker); }
private void cdp_Date_AddGrade_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { }
private void OnModified(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { CalendarPage.Current.OnModified(); }
private void CDP_Fecha_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { TransFormDataValidation(); }
public static void UpdateDate(this CalendarDatePicker nativeDatePicker, IDatePicker datePicker) { var date = datePicker.Date; nativeDatePicker.UpdateDate(date); }
private void TodoListDisplayDate_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { FilterTodosList(); }
public static void UpdateDate(this CalendarDatePicker nativeDatePicker, DateTime dateTime) { nativeDatePicker.Date = dateTime; }
private void CalDate_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { ReloadView(); }
public static void UpdateMaximumDate(this CalendarDatePicker nativeDatePicker, IDatePicker datePicker) { nativeDatePicker.MaxDate = datePicker.MaximumDate; }
private void Birthday_cheched(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { this.currenMember.birthday = sender.Date.Value.DateTime.ToString("yyyy-MM-dd"); }
public static void UpdateCharacterSpacing(this CalendarDatePicker nativeDatePicker, IDatePicker datePicker) { nativeDatePicker.CharacterSpacing = datePicker.CharacterSpacing.ToEm(); }
/// <summary> /// Creates the item that adds new tasks /// </summary> /// <param name="c">Class to add it to</param> /// <param name="class">Listview to add it to</param> public static void AddCreateButton(Class c, ListView @class) { #region Containers // Main ListViewItem ListViewItem create = new ListViewItem { Height = 30, Background = MainPage.TransparentBrush, Tag = false, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Top, Padding = new Thickness(0), BorderBrush = MainPage.MediumGrayBrush, BorderThickness = new Thickness(0) }; // Item contents Grid content = new Grid { Background = MainPage.LightGrayBrush, Margin = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Tag = true }; #endregion #region Buttons // '+' button Button expand = new Button { FontFamily = Icons.IconFont, Content = Icons.Add, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0, 7.5, 0, 0), Visibility = Visibility.Visible }; // 'x' button Button collapse = new Button { FontFamily = Icons.IconFont, Content = Icons.Cancel, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0, 7.5, 40, 0), Visibility = Visibility.Collapsed }; // Check mark button Button confirm = new Button { FontFamily = Icons.IconFont, Content = Icons.Accept, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(40, 7.5, 0, 0), Visibility = Visibility.Collapsed }; #endregion #region TitleBox TextBox title = new TextBox { Height = 25, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(5, 45, 0, 0), Text = "Title" }; title.GotFocus += (sender, args) => { if (title.Text == "Title") { title.Text = string.Empty; } }; title.LostFocus += (sender, args) => { if (title.Text == string.Empty) { title.Text = "Title"; } }; #endregion TitleBox #region InfoBox TextBox info = new TextBox { HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Stretch, Margin = new Thickness(5, 80, 0, 5), AcceptsReturn = true, TextWrapping = TextWrapping.Wrap, Text = "Info" }; info.GotFocus += (sender, args) => { if (info.Text == "Info") { info.Text = string.Empty; } }; info.LostFocus += (sender, args) => { if (info.Text == string.Empty) { info.Text = "Info"; } }; #endregion #region Date and Time CalendarDatePicker startCalendar = new CalendarDatePicker { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Background = MainPage.MediumGrayBrush, BorderBrush = MainPage.TransparentBrush, Margin = new Thickness(5, 45, 5, 5), PlaceholderText = "Select Start Date", Date = DateTime.Today }; TimePicker startTime = new TimePicker { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Background = MainPage.MediumGrayBrush, BorderBrush = MainPage.TransparentBrush, Margin = new Thickness(5, 80, 5, 5), MinWidth = 30 }; CalendarDatePicker endCalendar = new CalendarDatePicker { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Background = MainPage.MediumGrayBrush, BorderBrush = MainPage.TransparentBrush, Margin = new Thickness(5, 130, 5, 5), PlaceholderText = "Select End Date" }; TimePicker endTime = new TimePicker { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Background = MainPage.MediumGrayBrush, BorderBrush = MainPage.TransparentBrush, Margin = new Thickness(5, 165, 5, 5), MinWidth = 30, Time = TimeSpan.Parse(c.Time) }; endCalendar.CalendarViewDayItemChanging += (sender, args) => { DateTimeOffset? startDate = startCalendar.Date; if (args.Item?.Date < startDate) { args.Item.IsBlackout = true; } }; endCalendar.DateChanged += (sender, args) => { if (args.NewDate == null) { return; } if (endCalendar.Date.Value.Date != startCalendar.Date.Value.Date) { } }; #endregion #region Progress Bar Preview Grid progressGrid = new Grid { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(5, 208, 5, 5), Height = 80 }; CircularProgressBar progressBack = new CircularProgressBar { Percentage = 100, SegmentColor = MainPage.MediumGrayBrush, Radius = 30, StrokeThickness = 5, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; CircularProgressBar progressFront = new CircularProgressBar { Percentage = 0, SegmentColor = MainPage.BlueBrush, Radius = 30, StrokeThickness = 5, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = progressBack.Margin, Transitions = new TransitionCollection() }; TextBlock timeLeft = new TextBlock { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Text = "--", FontSize = 12, Foreground = MainPage.BlueBrush, TextAlignment = TextAlignment.Center }; Border border = new Border { BorderBrush = MainPage.BlueBrush, BorderThickness = new Thickness(0), Child = timeLeft, Height = 70, Width = 70, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = progressFront.Margin }; progressGrid.Children.Add(progressBack); progressGrid.Children.Add(progressFront); progressGrid.Children.Add(border); Action updateProgress = () => { DateTimeOffset? sDate = startCalendar.Date; TimeSpan sTime = startTime.Time; DateTimeOffset? eDate = endCalendar.Date; TimeSpan eTime = endTime.Time; if (sDate == null || eDate == null) { timeLeft.Text = "--"; return; } DateTime sDt = new DateTime( sDate.Value.Year, sDate.Value.Month, sDate.Value.Day, sTime.Hours, sTime.Minutes, sTime.Seconds ); DateTime eDt = new DateTime( eDate.Value.Year, eDate.Value.Month, eDate.Value.Day, eTime.Hours, eTime.Minutes, eTime.Seconds ); progressFront.Percentage = Math.Min(Util.GetPercentTime(sDt, eDt) * 100, 100); bool finished; if (progressFront.Percentage.Equals(100.0)) { finished = true; progressFront.SegmentColor = MainPage.OrangeRedBrush; timeLeft.Foreground = MainPage.OrangeRedBrush; } else { finished = false; progressFront.SegmentColor = MainPage.BlueBrush; timeLeft.Foreground = MainPage.BlueBrush; } timeLeft.Text = $"{Util.GetTimeString(eDt, finished)}{(finished ? " ago" : string.Empty)}"; }; updateProgress(); ThreadPoolTimer.CreatePeriodicTimer( async poolTimer => { await progressFront.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { updateProgress(); }); }, new TimeSpan(0, 0, 0, 1)); #endregion #region Sizing and Contents // Resize controls when the parent container is resized create.SizeChanged += (sender, args) => { double width = args.NewSize.Width / 2 - 7.5; content.Height = args.NewSize.Height; title.Width = width; info.Width = width; startCalendar.Width = width; endCalendar.Width = width; startTime.Width = width; endTime.Width = width; progressGrid.Width = width; }; // Add the elemetns to the content grid content.Children.Add(expand); content.Children.Add(collapse); content.Children.Add(confirm); content.Children.Add(title); content.Children.Add(info); content.Children.Add(startCalendar); content.Children.Add(startTime); content.Children.Add(endCalendar); content.Children.Add(endTime); content.Children.Add(progressGrid); // Set the contents of the item create.Content = content; #endregion #region Interactions and Animations // Handles expanding of the item when the '+' button is pressed expand.Tapped += (sender, args) => { startTime.Time = DateTime.Now.TimeOfDay; const int to = 300; // Expands to 300px tall Storyboard anim = Util.CreateAnimation(150, expand, 1, 0, "Opacity"); anim.Completed += (o, o1) => { expand.Visibility = Visibility.Collapsed; collapse.Opacity = 0; confirm.Opacity = 0; collapse.Visibility = Visibility.Visible; confirm.Visibility = Visibility.Visible; Util.CreateAnimation(300, collapse, 0, 1, "Opacity").Begin(); Util.CreateAnimation(300, confirm, 0, 1, "Opacity").Begin(); }; anim.Begin(); Util.CreateAnimation(150, create, null, to, "Height").Begin(); create.Tag = true; }; // This runs when the user cancels the new task Action collapseAction = () => { const int to = 40; Storyboard anim = Util.CreateAnimation(150, collapse, 1, 0, "Opacity"); Storyboard anim2 = Util.CreateAnimation(150, confirm, 1, 0, "Opacity"); anim.Completed += (o, o1) => { collapse.Visibility = Visibility.Collapsed; confirm.Visibility = Visibility.Collapsed; expand.Opacity = 0; expand.Visibility = Visibility.Visible; Util.CreateAnimation(300, expand, 0, 1, "Opacity").Begin(); }; anim.Begin(); anim2.Begin(); Util.CreateAnimation(150, create, null, to, "Height").Begin(); create.Tag = false; // Signifies that the panel is now closed // Reset control data endCalendar.Date = null; endTime.Time = TimeSpan.Parse(c.Time); startCalendar.Date = DateTime.Today; startTime.Time = DateTime.Now.TimeOfDay; title.Text = "Title"; info.Text = "Info"; }; // "Are you sure" message when the user presses the cancel button collapse.Tapped += async (sender, args) => { bool reallyDelete = false; MessageDialog popup = new MessageDialog("Are you sure you want to delete the unfinished task? Your changes will be lost."); popup.Commands.Insert(0, new UICommand("Yes")); popup.Commands.Insert(1, new UICommand("No", command => { reallyDelete = true; })); await popup.ShowAsync(); if (reallyDelete) { return; } collapseAction(); }; // Adds the new task when the user accepts confirm.Tapped += async (sender, args) => { // Make sure title is valid if (title.Text.EqualsAny(string.Empty, "Title")) { MessageDialog popup = new MessageDialog("Enter a valid title."); popup.Commands.Insert(0, new UICommand("OK")); await popup.ShowAsync(); return; } // Create new task object and populate title and info Task newTask = new Task(); newTask.Title = title.Text.Trim(); newTask.Info = info.Text; // Get date/time info DateTimeOffset? sDate = startCalendar.Date; TimeSpan sTime = startTime.Time; DateTimeOffset? eDate = endCalendar.Date; TimeSpan eTime = endTime.Time; // Check to make sure the date/time info is correct if (sDate == null || eDate == null || eDate < sDate) { MessageDialog popup = new MessageDialog("Invalid date/time selection."); popup.Commands.Insert(0, new UICommand("OK")); await popup.ShowAsync(); return; } // Get assigned on and due on dates/times DateTime assignedOn = new DateTime( sDate.Value.Year, sDate.Value.Month, sDate.Value.Day, sTime.Hours, sTime.Minutes, sTime.Seconds ); DateTime dueOn = new DateTime( eDate.Value.Year, eDate.Value.Month, eDate.Value.Day, eTime.Hours, eTime.Minutes, eTime.Seconds ); // Check to make sure the due date is after the assigned date if (dueOn < assignedOn) { MessageDialog popup = new MessageDialog("Invalid date/time selection."); popup.Commands.Insert(0, new UICommand("OK")); await popup.ShowAsync(); return; } // Add info to the task object newTask.AssignedOn = assignedOn.ToString(); newTask.DueOn = dueOn.ToString(); newTask.ClassId = c.Id; collapseAction(); // Close the new panel expand.Visibility = Visibility.Visible; collapse.Visibility = Visibility.Collapsed; confirm.Visibility = Visibility.Collapsed; Util.CreateAnimation(300, create, null, 40, "Height").Begin(); TaskList.AddTask(c, @class, newTask, true); long newId = DataHandler.AddTask(newTask); Notifications.ScheduleTaskReminders(dueOn, c.Name, newTask.Title, newId); create.Tag = false; // Signifies that the panel is closed // Reset control data endCalendar.Date = null; endTime.Time = TimeSpan.Parse(c.Time.ToString()); startCalendar.Date = DateTime.Today; startTime.Time = DateTime.Now.TimeOfDay; title.Text = "Title"; info.Text = "Info"; }; // Add the new task @class.Items?.Add(create); #endregion }
public static void UpdateFont(this CalendarDatePicker nativeDatePicker, IDatePicker datePicker, IFontManager fontManager) => nativeDatePicker.UpdateFont(datePicker.Font, fontManager);
private (Button, Button, TextBox, TextBox, CalendarDatePicker, ComboBox, PlaneDTO) RenderDetail(ItemClickEventArgs e) { var plane = (PlaneDTO)e.ClickedItem; SingleItem.Children.Clear(); var id = new TextBlock(); id.Text = "Plane id:" + plane.Id; id.FontWeight = Windows.UI.Text.FontWeights.Bold; id.Margin = new Thickness(0, 100, 10, 10); id.Width = 200; var name = new TextBox { Header = "Name", Text = plane.Name, Width = 200, HorizontalAlignment = HorizontalAlignment.Center }; var timespan = new TextBox { Header = "Timespan", Text = plane.LifeTime, Width = 200, HorizontalAlignment = HorizontalAlignment.Center }; var created = new CalendarDatePicker { Header = "Created", Date = DateTime.Parse(plane.Created), Width = 200, HorizontalAlignment = HorizontalAlignment.Center }; var types = new ComboBox { Header = "Plane types", PlaceholderText = "types", Width = 200, Margin = new Thickness(0, 10, 0, 0), ItemsSource = planetypesList, HorizontalAlignment = HorizontalAlignment.Center }; var btnUpdate = new Button { Content = "Update", Width = 100 }; var btnDelete = new Button { Content = "Delete", Width = 100 }; var buttonsStack = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 20, 0, 0) }; SingleItem.Children.Add(id); SingleItem.Children.Add(name); SingleItem.Children.Add(timespan); SingleItem.Children.Add(created); SingleItem.Children.Add(types); buttonsStack.Children.Add(btnUpdate); buttonsStack.Children.Add(btnDelete); SingleItem.Children.Add(buttonsStack); return(btnUpdate, btnDelete, name, timespan, created, types, plane); }
public static void UpdateTextColor(this CalendarDatePicker nativeDatePicker, IDatePicker datePicker, WBrush?defaultForeground) { Color textColor = datePicker.TextColor; nativeDatePicker.Foreground = textColor == null ? (defaultForeground ?? textColor?.ToNative()) : textColor.ToNative(); }
private async void ShowRegister(object sender, RoutedEventArgs e) { var stackPanel = new StackPanel(); var emailBox = new TextBox { Header = "Email", Name = "Email", Margin = new Thickness(0, 5, 0, 10) }; var passBox = new PasswordBox { Header = "Mật Khẩu", Name = "Password", }; var firstNameBox = new TextBox { Header = "First Name", Name = "FirstName", Margin = new Thickness(0, 10, 0, 0) }; var lastNameBox = new TextBox { Header = "Last Name", Name = "LastName", Margin = new Thickness(0, 10, 0, 0) }; var birthDayBox = new CalendarDatePicker { Header = "Birthday", Name = "Birthday", Margin = new Thickness(0, 10, 0, 0) }; birthDayBox.DateChanged += BirthDay_DateChanged; //Tao ham gioi tinh var genderBlock = new TextBlock { Text = "Giới Tính", Margin = new Thickness(0, 10, 0, 0) }; var stackpanelGender = new StackPanel { Orientation = Orientation.Horizontal }; var male = new RadioButton { Content = "Nam", Tag = 1 }; var female = new RadioButton { Content = "Nữ", Tag = 0 }; var other = new RadioButton { Content = "Khác", Tag = 2 }; stackpanelGender.Children.Add(male); stackpanelGender.Children.Add(female); stackpanelGender.Children.Add(other); male.Checked += Gender_Checked; female.Checked += Gender_Checked; other.Checked += Gender_Checked; var addressBox = new TextBox { Header = "Địa Chỉ", Name = "Address", AcceptsReturn = true, Height = 60, Margin = new Thickness(0, 10, 0, 0) }; var introductionBox = new TextBox { Header = "Giới Thiệu", Name = "Introduction", AcceptsReturn = true, Height = 60, Margin = new Thickness(0, 10, 0, 0) }; var captureBox = new Button { Content = "Chọn Ảnh", Name = "Introduction", Margin = new Thickness(0, 10, 0, 0) }; captureBox.Click += CaptureBox_Click; var imageAvatar = new Image { Name = "MyAvatar", Margin = new Thickness(0, 10, 0, 0), Width = 140, Height = 140 }; var urlImageBox = new TextBox { Header = "Url Ảnh", Name = "ImageUrl", Margin = new Thickness(0, 10, 0, 0) }; var scrollViewer = new ScrollViewer { Content = stackPanel }; //Add cac ham ow tren stackPanel.Children.Add(emailBox); stackPanel.Children.Add(passBox); stackPanel.Children.Add(firstNameBox); stackPanel.Children.Add(lastNameBox); stackPanel.Children.Add(genderBlock); stackPanel.Children.Add(stackpanelGender); stackPanel.Children.Add(birthDayBox); stackPanel.Children.Add(addressBox); stackPanel.Children.Add(introductionBox); stackPanel.Children.Add(captureBox); stackPanel.Children.Add(imageAvatar); stackPanel.Children.Add(urlImageBox); ContentDialog dialog = new ContentDialog() { Title = "Đăng Ký", MaxWidth = this.ActualWidth, PrimaryButtonText = "Đăng Ký", Content = scrollViewer, CloseButtonText = "Cancel", }; await dialog.ShowAsync(); }
private void StartDatePicker_DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChangedEventArgs args) { // prevent from setting null date if (StartDatePicker.Date == null) StartDatePicker.Date = DateTimeOffset.Now; }