locked
Help with create method to chcek day and use it in app

    Question

  • Hello 

    I have problem ot create a method what will get from user a "day" from checkbox and i will can use that to "know" that my app will show him a notification only in that days what he choosen.  


    This is how it's look in my app the page to get "days".
    Its how i have in xaml page :


    <CheckBox
                          x:Name="Monday"
                          Content="Monday" 
                          HorizontalAlignment="Left" 
                          Margin="86,50,0,0"
                          VerticalAlignment="Top"/>

    so how to create function in page.cs file to make that work with the start button form another page for example?

    Looks like :


    exaple from page.cs file:

    private void ButtonClick_startinterval(object sender, RoutedEventArgs e)
            {
    
            }



    Greetings

    Please halp













    • Edited by zibipl69 Thursday, January 08, 2015 11:56 AM
    Wednesday, January 07, 2015 1:54 PM

Answers

  • Hi,

    As my first reply says, you should calculate the interval time and then schedule a  notification by use the interval time value. For example, if you select the Monday, you can use the codes below to get the interval time from today to next Monday:

                    var intervaltime =Convert.ToInt32(1 - Convert.ToInt32(DateTime.Now.DayOfWeek)) + 7; 

    Also, there a lot of method you can try to get the interval time.

    The you can specify the time that the tile notification should be delivered:

    DateTime dueTime = DateTime.Now.AddDays(intervaltime);

    And send the toast notification content and the scheduled delivery time to the constructor.

    ScheduledToastNotification scheduledToast = new ScheduledToastNotification(toastXml, intervaltime)
     

    The link you can refer to know how to schedule toast notification:

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868224.aspx

    And see Toast notifications sample

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.


    Friday, January 09, 2015 2:51 AM

All replies

  • Hi,

    According to your description, do you want to select a day value in checkbox and use the value in another page, when the future date time meets the value, a notification will pop up. If so, you can follow up these steps below:

    First, share the select value between pages:

      #By use Frame.Navigate(TypeName, Object)  method in checkbox Checked event. Then you can get the value in another page OnNavigatedTo method.

    Please see the link to get more information:

         http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh771188.aspx

       #Or you can write the value to a setting and when you want to use it you can read from the setting:

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh700361.aspx

    Second, you should calculate the interval time:

    For example, if you selected value of Monday, you should calculate the next Monday in the future and the interval time between today and next Monday.

    Third, you can schedule a  notification by use the interval time value, then when come up to the next Monday, a notification will pop up:

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868224.aspx

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868223.aspx

     If above method cannot resolve your problem or I misunderstand your problem, please clarify your problem in detail.

    Best Wishes for you!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.



    • Edited by Anne JingMicrosoft contingent staff Thursday, January 08, 2015 9:20 AM edit
    • Marked as answer by zibipl69 Thursday, January 08, 2015 11:50 AM
    • Unmarked as answer by zibipl69 Thursday, January 08, 2015 11:50 AM
    • Marked as answer by zibipl69 Thursday, January 08, 2015 11:57 AM
    • Unmarked as answer by zibipl69 Thursday, January 08, 2015 11:57 AM
    Thursday, January 08, 2015 9:09 AM
  • Thank You for help 

    If its possible can i please example or maybe video (tutrorial) how that can be do, because i was learned from Bob Tabor videos, or you can make just some example ( for monday in training 1 in my app ) it will be more helpful for me to learn how that should be do. 

    To be more clarify what i wont to make :

    In my app i wont create a method that user will choose in what days he wont training next step he will choose the training and press start Button. Then he will heave toast notification for example at 5pm. 


    Greetings thank you for any help


    Here is link to my app 

    https://drive.google.com/folderview?id=0B5Jbyk_ApZizTjJlVm1LNkR0cTQ&usp=sharing

    Thursday, January 08, 2015 11:57 AM
  • Hi,

    As my first reply says, you should calculate the interval time and then schedule a  notification by use the interval time value. For example, if you select the Monday, you can use the codes below to get the interval time from today to next Monday:

                    var intervaltime =Convert.ToInt32(1 - Convert.ToInt32(DateTime.Now.DayOfWeek)) + 7; 

    Also, there a lot of method you can try to get the interval time.

    The you can specify the time that the tile notification should be delivered:

    DateTime dueTime = DateTime.Now.AddDays(intervaltime);

    And send the toast notification content and the scheduled delivery time to the constructor.

    ScheduledToastNotification scheduledToast = new ScheduledToastNotification(toastXml, intervaltime)
     

    The link you can refer to know how to schedule toast notification:

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868224.aspx

    And see Toast notifications sample

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.


    Friday, January 09, 2015 2:51 AM