0
votes

How to press RoutedEventArgs e button (button in page) from EventArgs e button (button on application bar) in windows phone 7

    private void button3_Click(object sender, EventArgs e)
    {
        button0_Click(sender, e);
    }

    private void button0_Click(object sender, RoutedEventArgs e)
    {

    }

when i am using above code its giving me

cannot convert from 'System.EventArgs' to 'System.Windows.RoutedEventArgs'

Please Help

SMS CODE:

    SmsComposeTask SCT = new SmsComposeTask();

    PhoneApplicationService PAS = PhoneApplicationService.Current;

    public string SMSNO;

    protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
    {
        object sample;
        if (PAS.State.TryGetValue("numbertext", out sample))
            SMSNO = sample as string;
        if (PAS.State.TryGetValue("messagetext", out sample))
            txtOutput.Text = sample as string;
        base.OnNavigatedTo(e);
    }

    private void button2_Click(object sender, RoutedEventArgs e)
    {
        if (txtOutput.Text != "")
        {
            SCT.To = SMSNO;
            SCT.Body = txtOutput.Text;
            SCT.Show();
        }
        else
        {
            MessageBox.Show("Output is Empty to send SMS.", "Wait!", MessageBoxButton.OK);
        }
    }

    protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
    {
        PAS.State["numbertext"] = SMSNO;
        PAS.State["messagetext"] = txtOutput.Text;
        base.OnNavigatedFrom(e);
    }
1

1 Answers

1
votes

If you don't use the parameter inside button0_Click, you can just call button0_Click(sender, null); (the reason is that the event from the application bar don't bubble that's why they don't have a RoutedEventArg parameter)