Exemplo n.º 1
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();
            await SetupPage.SaveMyData(ListOfData);

            deferral.Complete();
        }
Exemplo n.º 2
0
        private async void button_Click(object sender, RoutedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            SetReminderData();


            bool check = await SetupPage.SaveMyData(App.ListOfData);

            rootFrame.BackStack.Remove(rootFrame.BackStack.Last());
            rootFrame.BackStack.Remove(rootFrame.BackStack.Last());
        }
Exemplo n.º 3
0
        private void createButton()
        {
            foreach (ReminderData element in App.ListOfData)
            {
                Button     button       = new Button();
                SymbolIcon deleteButton = new SymbolIcon();

                button.Content = element.Name;
                button.HorizontalContentAlignment = HorizontalAlignment.Center;
                button.VerticalContentAlignment   = VerticalAlignment.Center;
                button.Width  = 175;
                button.Height = 50;
                Thickness margin = button.Margin;
                margin.Top              = 20;
                button.Margin           = margin;
                button.Background       = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 246, 162, 0));
                button.FontSize         = 20;
                button.IsHoldingEnabled = false;
                button.Name             = App.ListOfData.IndexOf(element).ToString();


                button.Click += (s, e) =>
                {
                    var notifier  = ToastNotificationManager.CreateToastNotifier();
                    var scheduled = notifier.GetScheduledToastNotifications();


                    for (int i = 0, len = scheduled.Count; i < len; i++)

                    {
                        if (scheduled[i].Tag == App.ListOfData[int.Parse(button.Name)].Name && scheduled[i].DeliveryTime.Hour == App.ListOfData[int.Parse(button.Name)].Time.Hours && scheduled[i].DeliveryTime.Minute == App.ListOfData[int.Parse(button.Name)].Time.Minutes)
                        {
                            notifier.RemoveFromSchedule(scheduled[i]);
                        }
                    }
                    this.Frame.Navigate(typeof(EditPage), button.Name);
                };


                deleteButton.Symbol           = Symbol.Delete;
                deleteButton.Width            = 50;
                deleteButton.Height           = 50;
                deleteButton.Margin           = margin;
                deleteButton.IsHoldingEnabled = false;
                deleteButton.Name             = App.ListOfData.IndexOf(element).ToString();

                deleteButton.Tapped += async(s, e) =>
                {
                    var notifier  = ToastNotificationManager.CreateToastNotifier();
                    var scheduled = notifier.GetScheduledToastNotifications();


                    for (int i = 0, len = scheduled.Count; i < len; i++)

                    {
                        if (scheduled[i].Tag == App.ListOfData[int.Parse(button.Name)].Name && scheduled[i].DeliveryTime.Hour == App.ListOfData[int.Parse(button.Name)].Time.Hours && scheduled[i].DeliveryTime.Minute == App.ListOfData[int.Parse(button.Name)].Time.Minutes)
                        {
                            notifier.RemoveFromSchedule(scheduled[i]);
                        }
                    }
                    App.ListOfData.RemoveAt(int.Parse(deleteButton.Name));
                    await SetupPage.SaveMyData(App.ListOfData);

                    this.Frame.Navigate(typeof(Reminders));
                };


                listBox.Items.Add(button);
                listBox1.Items.Add(deleteButton);
            }
        }
Exemplo n.º 4
0
 private async Task getData()
 {
     App.ListOfData = await SetupPage.GetMyData();
 }