private void NextStep_Tap(object sender, System.Windows.Input.GestureEventArgs e) { if (build.Items.Any()) { if (build.Items.Count > selectedIndex + 1) { selectedIndex++; build.SelectedIndex = selectedIndex; Object_SC item = (Object_SC)build.SelectedItem; //items.Background = new SolidColorBrush(Colors.Orange); Debug.WriteLine("Initial selected index is " + build.SelectedIndex); Debug.WriteLine("selected name is " + item.Name); Uri uri = new Uri(item.Imagesource, UriKind.Relative); ImageSource imgSource = new BitmapImage(uri); current_icon.Source = imgSource; current_name.Text = item.Name; current_mineral.Text = item.Mineral + ""; current_gas.Text = item.Gas + ""; current_food.Text = item.Food + ""; current_time.Text = item.Time + ""; } else { MessageBox.Show("Done"); } } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { // turn on antilock screen PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; //Set BackGround Random rand = new Random(); int n = rand.Next(1, 48); // while (n == 6 || n == 13 || n == 45) { n = rand.Next(1, 51); } String bgpath = "/Images/Backgrounds/bg" + n + ".jpg/"; BitmapImage bitmapImage = new BitmapImage(new Uri(bgpath, UriKind.Relative)); ImageBrush imageBrush = new ImageBrush(); imageBrush.ImageSource = bitmapImage; LayoutRoot.Background = imageBrush; //Current Build Panel bgpath = "/Images/Backgrounds/bg_translucent.png/"; bitmapImage = new BitmapImage(new Uri(bgpath, UriKind.Relative)); imageBrush = new ImageBrush(); imageBrush.ImageSource = bitmapImage; currentbuild_panel.Background = imageBrush; //Query Database mRace = NavigationContext.QueryString["race"]; buildname = NavigationContext.QueryString["buildname"]; index_id = Int16.Parse(NavigationContext.QueryString["index_id"]); PageTitle.Text = buildname; DB_Helper.connect(); builds = DB_Helper.get_Build_Order_By_Index_Id(index_id); for (int i = 0; i < builds.Count; i++) { current_build_order.Add(DB_Helper.get_Object_SC_by_Obj_Id(builds.ElementAt <Build_Order>(i).Obj_Id).ElementAt <Object_SC>(0)); } build.ItemsSource = current_build_order; if (build.Items.Any()) { selectedIndex = 0; build.SelectedIndex = selectedIndex; Object_SC item = (Object_SC)build.SelectedItem; //items.Background = new SolidColorBrush(Colors.Orange); Debug.WriteLine("Initial selected index is " + build.SelectedIndex); Debug.WriteLine("selected name is " + item.Name); Uri uri = new Uri(item.Imagesource, UriKind.Relative); ImageSource imgSource = new BitmapImage(uri); current_icon.Source = imgSource; current_name.Text = item.Name; current_mineral.Text = item.Mineral + ""; current_gas.Text = item.Gas + ""; current_food.Text = item.Food + ""; current_time.Text = item.Time + ""; } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { // turn on antilock screen PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; //Set BackGround Random rand = new Random(); int n = rand.Next(1, 48); // while (n == 6 || n == 13 || n == 45) { n = rand.Next(1, 51); } String bgpath = "/Images/Backgrounds/bg" + n + ".jpg/"; BitmapImage bitmapImage = new BitmapImage(new Uri(bgpath, UriKind.Relative)); ImageBrush imageBrush = new ImageBrush(); imageBrush.ImageSource = bitmapImage; bghandler.Background = imageBrush; //Current Build Panel bgpath = "/Images/Backgrounds/bg_translucent_darker.png/"; bitmapImage = new BitmapImage(new Uri(bgpath, UriKind.Relative)); imageBrush = new ImageBrush(); imageBrush.ImageSource = bitmapImage; LayoutRoot.Background = imageBrush; //Query Database mRace = NavigationContext.QueryString["race"]; buildname = NavigationContext.QueryString["buildname"]; index_id = Int16.Parse(NavigationContext.QueryString["index_id"]); PageTitle.Text = buildname; DB_Helper.connect(); builds = DB_Helper.get_Build_Order_By_Index_Id(index_id); for (int i = 0; i < builds.Count; i++) { Build_Order current_step = builds.ElementAt <Build_Order>(i); Object_SC unit = DB_Helper.get_Object_SC_by_Obj_Id(current_step.Obj_Id).ElementAt <Object_SC>(0); current_build_order.Add(new unitforBuildOrder(unit.Name, unit.Food, unit.Mineral, unit.Gas, unit.Time, unit.Imagesource, "@" + current_step.When, current_step.Note)); } build.ItemsSource = current_build_order; Before.Text = NavigationContext.QueryString["note"]; if (Before.Text == "") { Before_Button.Visibility = Visibility.Collapsed; } After.Text = NavigationContext.QueryString["notefooter"]; if (After.Text == "") { After_Button.Visibility = Visibility.Collapsed; } }