Can I get some help with C# Windows phone app (flashlight)?

  • Thread starter Windows Central Question
  • Start date
W

Windows Central Question

Help with C# windows phone app (flashlight)

I need some help fixing my windows phone application program in C#. I need help in figuring out how to use the menuitem color to change from color to color when I click on it under each button (SOS and strobe).

The point of the program is to make a app that will act like a flashlight. The two icons on the bottom will be SOS and Strobe; when you click on SOS it will display whatever color is selected with the SOS sequence and when you click on Strobe it will flash the color you choose. (the color by default will be white).

If anyone could help me figure this out, I would be grateful.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Media;

namespace Assgn2_v1_0
{
public partial class MainPage : PhoneApplicationPage
{

private void BSOSIcon_Click(object sender, EventArgs e)
{
ApplicationBarIconButton btn = (ApplicationBarIconButton)ApplicationBar.Buttons[0];
//btn.Text = "pause";
//MessageBox.Show("SOS works!");
btn.IconUri = new Uri("/Images/appbar.cancel.rest.png", UriKind.Relative);
//String clr = (sender as IApplicationBarMenuItem).Text;
btn.IsEnabled = false;
String clr = "white";

this.onBrush = (SolidColorBrush)this.Resources[clr];
this.ContentPanel.Background = onBrush;

}
private void BSTROBEIcon_Click(object sender, EventArgs e)
{
ApplicationBarIconButton btn = (ApplicationBarIconButton)ApplicationBar.Buttons[1];

//btn.Text = "pause";
//MessageBox.Show("STROBE works!");
String clr1 = "green";

this.onBrush = (SolidColorBrush)this.Resources[clr1];
this.ContentPanel.Background = onBrush;
btn.IconUri = new Uri("/Images/appbar.cancel.rest.png", UriKind.Relative);
btn.IsEnabled = false;
//SOSIcon.IconUri = new Uri("/Images/appbar_sync_rest.png", UriKind.Relative);
//SOSIcon.IsEnabled = true;
}

private void MenuItem_click (object sender, EventArgs e)
{
ApplicationBarMenuItem menuItem1 = new ApplicationBarMenuItem();
menuItem1.Text = "red";
ApplicationBar.MenuItems.Add(menuItem1);
menuItem1.Click += new EventHandler(menuItem1_Click);

}
}
 

Members online

Forum statistics

Threads
323,257
Messages
2,243,532
Members
428,052
Latest member
ayven