Exemplo n.º 1
0
 public void Transition(Panorama p = null, float time = 0)
 {
     if (!busy)
     {
         StartCoroutine(TransitionRoutine(p, time));
     }
 }
Exemplo n.º 2
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            // load our background image
            var imageUrl       = viewModel.Location.PanoramaImage;
            var originalBitmap = await BitmapHelper.LoadBitmapFromUrl(imageUrl);

            // resize the image for the screen
            var     imageScale   = Panorama.CanvasSize.Height / originalBitmap.Height;
            SKSizeI newImageSize = new SKSizeI((int)(originalBitmap.Width * imageScale),
                                               (int)(originalBitmap.Height * imageScale));

            backgroundBitmap = originalBitmap.Resize(newImageSize, SKFilterQuality.High);

            foreach (var fish in viewModel.Location.Fish)
            {
                FishAnnotation annotation = await CreateAnnotations(fish);

                fishAnnotations.Add(fish, annotation);
            }


            Panorama.InvalidateSurface();
        }
Exemplo n.º 3
0
        protected override void Initialize()
        {
            // Need to change this in Initialize to work on linux
            graphics.PreferredBackBufferHeight = 505;
            graphics.PreferredBackBufferWidth  = 288;
            graphics.ApplyChanges();

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            this.Services.AddService <SpriteBatch>(spriteBatch);

            physics = new PhysicsEngine(this);
            this.Components.Add(physics);

            tweener = new TweenEngine();
            this.Services.AddService(tweener);

            panorama = new Panorama(this);
            this.Components.Add(panorama);

            bird = new Bird(this);
            this.Components.Add(bird);
            physics.AddBody(bird);

            ground = new Ground(this);
            this.Components.Add(ground);

            pipes = new List <Pipes>();

            width = Window.ClientBounds.Width;

            base.Initialize();
        }
Exemplo n.º 4
0
        public void WhenAAA()
        {
            var panorama = new Panorama();

            Assert.IsNull(panorama.Background);
            var b = new PanoramaBackgroundSwitchBehavior {
                Type = "bbb"
            };

            b.ImagePairs = new List <ImagePair>
            {
                new ImagePair {
                    Type = "aaa", Path = "AAA"
                },
                new ImagePair {
                    Type = "bbb", Path = "BBB"
                },
                new ImagePair {
                    Type = "ccc", Path = "CCC"
                },
            };
            b.Attach(panorama);
            Assert.AreEqual("BBB", ((panorama.Background as ImageBrush).ImageSource as BitmapImage).UriSource.ToString());
            b.Type = "ccc";
            Assert.AreEqual("CCC", ((panorama.Background as ImageBrush).ImageSource as BitmapImage).UriSource.ToString());
            b.Type = "notExist";
            Assert.IsNull(panorama.Background);
        }
Exemplo n.º 5
0
        public ActionResult Create(Panorama panorama, HttpPostedFileBase photo)
        {
            if (photo != null)
            {
                panorama.PictureUrl = photo.FileName;
            }

            panorama.UserId  = User.Identity.GetUserId();
            panorama.AddedOn = DateTime.Now;

            if (ModelState.IsValid && photo != null)
            {
                db.Panorama.Add(panorama);
                db.SaveChanges();

                string extension = Path.GetExtension(photo.FileName);
                FileUploader.Upload(photo, panorama.Id + extension);

                int[] PanoramaIds = new int[] { panorama.Id };
                ExecuteKrpanotools(PanoramaIds, "sphere", 360, 180);
                return(RedirectToAction("Index"));

                //return RedirectToAction("CreatePano", new { id = panorama.Id, userId = panorama.UserId });
            }

            return(View(panorama));
        }
Exemplo n.º 6
0
        public GamesViewPage()
        {
            InitializeComponent();

            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();
            }

            ListView = new LongListSelector()
            {
                ItemsSource = App.ViewModel.MainGameView.GamesList, FontWeight = FontWeights.Thin
            };
            ListView.ItemTemplate = (DataTemplate)Resources["ListTemplate"];

            GridView = new Panorama()
            {
                ItemsSource = App.ViewModel.MainGameView.GamesList, FontWeight = FontWeights.Thin
            };
            GridView.ItemTemplate   = (DataTemplate)Resources["GridTemplate"];
            GridView.HeaderTemplate = (DataTemplate)Resources["PanoramaHeaderTemplate"];

            BuildContentPanel();

            pickBackgroundColor();

            BuildLocalizedApplicationBar();
        }
Exemplo n.º 7
0
    // This function and coroutine handle the transition from viewing one panorama to another.
    // This is called by the PanoramaManager when any of the panorama buttons are clicked.

    public void PanoramaToPanorama(Panorama p)
    {
        if (currentState == AppState.ViewingPanorama && p != null)
        {
            StartCoroutine(PanoramaToPanoramaRoutine(p));
        }
    }
Exemplo n.º 8
0
 void Start()
 {
     pos        = GetComponent <Transform>();
     initialPos = pos.position;
     currOffset = new Vector3(0.0f, 0.0f, 0.0f);
     panorama   = GameObject.Find("Panorama").GetComponent <Panorama>();
 }
Exemplo n.º 9
0
    public void Initialize(PanoramaManager manager, Panorama panorama)
    {
        this.manager  = manager;
        this.panorama = panorama;

        icon        = GetComponent <Image>();
        icon.sprite = panorama.icon;
    }
Exemplo n.º 10
0
 private void InvokeOnPanorama(Panorama panorama)
 {
     if (panorama == null)
     {
         return;
     }
     panorama.DefaultItem = panorama.Items[_selector.SelectedIndex];
 }
Exemplo n.º 11
0
 public PanoramaModel(Panorama panoramaEntity)
 {
     Id         = panoramaEntity.Id;
     AddedOn    = panoramaEntity.AddedOn;
     Name       = panoramaEntity.Name;
     PictureUrl = panoramaEntity.PictureUrl;
     UserId     = panoramaEntity.UserId;
 }
Exemplo n.º 12
0
Arquivo: Cam1.cs Projeto: M1F/TourCMS
    //Прыгаем в другую сферу по кнопке - кнопка должна называться jump+"имя сферы", на кнопку вешаем эту функцию
    public void NewPanorama(string PanoName)
    {
        //Material mat = new Material(Shader.Find("Unlit / Pano360Shader"));
        //mat.mainTexture = walltex;
        //sphere.GetComponent<Renderer>().material = mat;
        Texture2D walltex   = (Texture2D)Resources.Load("Materials/sgugit/" + PanoName);
        Shader    wallshade = Shader.Find("Unlit/Pano360Shader");

        sphere.GetComponent <Renderer>().material.mainTexture = walltex;
        sphere.GetComponent <Renderer>().material.shader      = wallshade;

        SelectedPanorama = Panoramas.Find(item => item.Name == PanoName);
        buttons          = new GameObject[Panoramas.Count];
        int i = 0;

        foreach (Buttons button in SelectedPanorama.Buttons)
        {
            float RawHorizontalAngle  = (float)button.PositionX / SelectedPanorama.Width * 360;
            float CalcHorizontalAngle = RawHorizontalAngle * Mathf.Deg2Rad;

            float RawVerticalAngle;
            int   HalfPanoHeight = SelectedPanorama.Height / 2;
            if (button.PositionY >= HalfPanoHeight)
            {
                RawVerticalAngle = (float)(button.PositionY - HalfPanoHeight) / HalfPanoHeight * -90;
            }
            else
            {
                RawVerticalAngle = (float)(button.PositionY / HalfPanoHeight) * 90;
            }
            float CalcVerticalAngle = RawVerticalAngle * Mathf.Deg2Rad;

            float x = (float)(28 * Math.Sin(CalcHorizontalAngle) * Math.Cos(CalcVerticalAngle));
            float z = (float)(28 * Math.Cos(CalcHorizontalAngle) * Math.Cos(CalcVerticalAngle));
            float y = (float)(28 * Math.Sin(CalcVerticalAngle)); //Vertical ofset

            buttons[i] = Instantiate(originalButton, new Vector3(x, y + 30, z), Quaternion.identity);
            buttons[i].transform.parent = Jumper.transform;                                                                     //Setting parent
            buttons[i].transform.LookAt(buttons[i].transform.position - C1.transform.position + buttons[i].transform.position); //Orient button to camera and inverse Look direcion
            buttons[i].name = button.Link;
            i++;
        }
        //foreach (Buttons button in SelectedPanorama.Buttons)
        //{
        //    float RawAngle = (float)button.PositionX / SelectedPanorama.Width * 360;
        //    float CalcAngle = (float)(Math.PI * RawAngle / 180.0);
        //    Debug.Log(RawAngle);
        //    float x = (float)(27 * Math.Sin(CalcAngle));
        //    float z = (float)(27 * Math.Cos(CalcAngle));
        //    buttons[i] = Instantiate(originalButton, new Vector3(x, 30, z), Quaternion.identity);
        //    buttons[i].transform.parent = Jumper.transform; //Setting parent
        //    buttons[i].transform.LookAt(buttons[i].transform.position - C1.transform.position + buttons[i].transform.position);  //Orient button to camera and inverse Look direcion
        //    buttons[i].name = button.Link;
        //    i++;
        //}
        //SceneManager.UnloadScene("main");
        //SceneManager.LoadScene("Menu");
    }
Exemplo n.º 13
0
        private void Pivot_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            Panorama p = (Panorama)sender;

            if (p.SelectedIndex == 1)
            {
                getLeaderboard();
            }
        }
Exemplo n.º 14
0
        public Panorama MapToEntity(Panorama panoramaEntity)
        {
            panoramaEntity.Id         = Id;
            panoramaEntity.AddedOn    = AddedOn;
            panoramaEntity.Name       = Name;
            panoramaEntity.PictureUrl = PictureUrl;
            panoramaEntity.UserId     = UserId;

            return(panoramaEntity);
        }
Exemplo n.º 15
0
    public void Initialize(MapManager manager, Panorama panorama)
    {
        this.manager  = manager;
        this.panorama = panorama;

        text = GetComponentInChildren <Text>();
        if (text)
        {
            text.text = panorama.name;
        }
    }
Exemplo n.º 16
0
 public PanoramaModel()
 {
     var panoramaEntity = new Panorama()
     {
         Id         = Id,
         AddedOn    = AddedOn,
         Name       = Name,
         PictureUrl = PictureUrl,
         UserId     = UserId
     };
 }
Exemplo n.º 17
0
        private void Panorama_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Panorama p = sender as Panorama;

            //
            // Initial fill for Panorama pages that was opened firstly.
            //
            if (loadedPosts[p.SelectedIndex] == 0 && !busyJSONLoader[0] && !busyJSONLoader[1] && !busyJSONLoader[2] && !busyJSONLoader[3])
            {
                PData.GetPosts((Period)p.SelectedIndex);
            }
        }
Exemplo n.º 18
0
        public ActionResult Edit(Panorama panorama)
        {
            panorama.UserId = User.Identity.GetUserId();

            if (ModelState.IsValid)
            {
                db.Entry(panorama).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(panorama));
        }
Exemplo n.º 19
0
    // A function which allows the AppCoordinator to display or hide a panorama's name.

    public void DisplayPanoramaName(Panorama p, float time)
    {
        if (p != null)
        {
            panoramaName.text = p.name;
            panoramaNameFade.In(time);
        }

        else
        {
            panoramaNameFade.Out(time);
        }
    }
Exemplo n.º 20
0
        public Panorama MapToEntity()
        {
            var panoramaEntity = new Panorama()
            {
                Id         = Id,
                UserId     = UserId,
                AddedOn    = AddedOn,
                Name       = Name,
                PictureUrl = PictureUrl
            };

            return(panoramaEntity);
        }
Exemplo n.º 21
0
        public ActionResult DeleteConfirmed(int id)
        {
            Panorama panorama = db.Panorama.Find(id);

            db.Panorama.Remove(panorama);
            db.SaveChanges();

            var rootFolderPath = System.Web.HttpContext.Current.Server.MapPath(@"/Documents/Panoramas/");

            Directory.Delete(rootFolderPath + id, true);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 22
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Panorama panorama = db.Panorama.Find(id);

            if (panorama == null)
            {
                return(HttpNotFound());
            }
            return(View(panorama));
        }
Exemplo n.º 23
0
        private bool MovePano(Panorama pano)
        {
            bool result = false;

            if (PivotNext)
            {
                pano.DefaultItem = pano.Items[(pano.SelectedIndex + 1) % pano.Items.Count];
                result           = true;
            }
            else if (PivotLast)
            {
                if (pano.SelectedIndex == 0)
                {
                    pano.DefaultItem = pano.Items[pano.Items.Count - 1];
                    result           = true;
                }
                else
                {
                    pano.DefaultItem = pano.Items[pano.SelectedIndex - 1];
                    result           = true;
                }
            }
            else if (!string.IsNullOrWhiteSpace(PivotName))
            {
                var panoToGo =
                    pano.Items.Cast <PanoramaItem>()
                    .FirstOrDefault(item => item.Name.ToLowerInvariant().StartsWith(PivotName.ToLowerInvariant())
                                    ||
                                    item.GetValue(AutomationProperties.NameProperty)
                                    .ToString()
                                    .StartsWith(PivotName.ToLowerInvariant()));

                if (panoToGo != null)
                {
                    pano.DefaultItem = panoToGo;
                    result           = true;
                }
                else
                {
                    SendNotFoundResult(string.Format("PivotCommand: Could not find the Panorama : {0}", PivotName));
                }
            }
            else
            {
                SendNotFoundResult("PivotCommand: Could nto find the Panorama element");
            }

            return(result);
        }
        void PanoramaRequestCallback(Panorama panorama, NSError error)
        {
            if (error != null)
            {
                var alertController = UIAlertController.Create("warning".LocalizedString("Warning title"),
                                                               "street_view_error".LocalizedString("Street view error"), UIAlertControllerStyle.Alert);
                alertController.AddAction(UIAlertAction.Create("ok".LocalizedString("OK title for button"), UIAlertActionStyle.Destructive, null));
                PresentViewController(alertController, false, null);
                return;
            }

            var streetViewController = new StreetViewController(viewModel.Place.Geometry.Location, viewModel.Place.Name);

            NavigationController.PushViewController(streetViewController, false);
        }
Exemplo n.º 25
0
    //transit from one panorama to another
    public void Move(int id)
    {
        Panorama current_photo = GetPanoramaById(id);

        if (id == 0)
        {
            trackball.ToDefault();
        }
        if (editing)
        {
            FindObjectOfType <PanoramaEditor>().Select(current_photo);
        }
        else
        {
            camera.position = current_photo.transform.position;
        }
    }
Exemplo n.º 26
0
    private IEnumerator PanoramaToPanoramaRoutine(Panorama p)
    {
        currentState = AppState.Busy;

        panoramaManager.DisplayPanoramaName(null, 0.3f);
        commentDisplayManager.CloseCommenting();
        fade.Out(0.3f);
        yield return(new WaitForSeconds(0.4f));

        appCamera.Transition(p);
        panoramaManager.DisplayPanorama(p);
        panoramaManager.DisplayPanoramaName(p, 0.3f);
        fade.In(0.3f);
        yield return(new WaitForSeconds(0.4f));

        commentDisplayManager.OpenCommentingForLocation(p.name);

        currentState = AppState.ViewingPanorama;
    }
Exemplo n.º 27
0
        protected AppBarConductor(IConductActiveItem conductor, PhoneApplicationPage page)
        {
            _conductor = conductor;
            _page      = page;

            _pivot    = _page.GetVisualDescendants().OfType <Pivot>().FirstOrDefault();
            _panorama = _page.GetVisualDescendants().OfType <Panorama>().FirstOrDefault();

            if (_pivot == null && _panorama == null)
            {
                throw new ArgumentException("The appbar conductor must have a Pivot or Panorama to sync with.");
            }

            if (_pivot != null)
            {
                _pivot.LoadedPivotItem += PivotOnLoadedPivotItem;
            }

            if (_panorama != null)
            {
                _panorama.SelectionChanged += PanoramaOnSelectionChanged;

                // Load first appbar in Panorama after animations are complete
                var firstViewAware = conductor.ActiveItem as IViewAware;

                if (firstViewAware != null)
                {
                    EventHandler <ViewAttachedEventArgs> attachedHandler = null;

                    attachedHandler = (sender, args) =>
                    {
                        SyncAppBar(args.View as DependencyObject);

                        firstViewAware.ViewAttached -= attachedHandler;
                    };

                    firstViewAware.ViewAttached += attachedHandler;
                }
            }

            HandleDeferLoad();
        }
Exemplo n.º 28
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string type = this.NavigationContext.QueryString["q"];

            // change the title to query string.
            this.LayoutRoot.Children.Clear();

            //Initializing the Panorama Control and Assigning base values
            Panorama panoramactrl = new Panorama();

            panoramactrl.Title = type;

            string[] types   = { "草原", "花卉", "建筑", "山景", "水景", "夜景" };
            int      nResIdx = 0;

            for (int j = 0; j < types.Length; j++)
            {
                if (types[j].Equals(type))
                {
                    nResIdx = j;
                    break;
                }
            }

            for (int i = 1; i <= 3; i++)
            {
                //Initializing the Panorama Control Items
                PanoramaItem panoramaCtrlItem = new PanoramaItem();
                panoramaCtrlItem.Header = type + i.ToString();

                //Initializing Textblock to display some text
                Image  img   = new Image();
                string fname = "/Assets/" + nResIdx + "/" + i.ToString() + ".jpg";
                img.Source = new BitmapImage(new Uri(fname, UriKind.Relative));
                panoramaCtrlItem.Content = img;

                panoramactrl.Items.Add(panoramaCtrlItem);
            }

            this.LayoutRoot.Children.Add(panoramactrl);
        }
Exemplo n.º 29
0
        public static void SlideToPage(this Panorama self, int item)
        {
            var slide_transition = new SlideTransition()
            {
            };

            slide_transition.Mode = SlideTransitionMode.SlideRightFadeOut;
            ITransition transition = slide_transition.GetTransition(self);

            transition.Completed += delegate
            {
                self.DefaultItem = self.Items[item];

                //PanoramaItem panItem = (PanoramaItem)self.Items[1];

                //self.Items.Remove(panItem);

                //self.Items.Insert(0, panItem);
                transition.Stop();
            };
            transition.Begin();
        }
Exemplo n.º 30
0
    private IEnumerator MapToPanoramaRoutine(Panorama p)
    {
        currentState = AppState.Busy;

        mapManager.SetMapInteractivity(false);
        appCamera.Transition(p, 1.5f);
        yield return(new WaitForSeconds(0.5f));

        fade.Out(0.5f);
        yield return(new WaitForSeconds(0.6f));

        mapManager.SetMapVisibility(false);
        panoramaManager.DisplayPanorama(p);
        panoramaManager.DisplayPanoramaName(p, 0.4f);
        panoramaManager.SetUIVisibility(true);
        fade.In(0.4f);
        yield return(new WaitForSeconds(0.5f));

        commentDisplayManager.OpenCommentingForLocation(p.name);

        currentState = AppState.ViewingPanorama;
    }
		void PanoramaRequestCallback (Panorama panorama, NSError error)
		{
			if (error != null) {
				var alertController = UIAlertController.Create ("warning".LocalizedString("Warning title"),
					"street_view_error".LocalizedString("Street view error"), UIAlertControllerStyle.Alert);
				alertController.AddAction (UIAlertAction.Create ("ok".LocalizedString("OK title for button"), UIAlertActionStyle.Destructive, null));
				PresentViewController (alertController, false, null);
				return;
			}

			var streetViewController = new StreetViewController (viewModel.Place.Geometry.Location, viewModel.Place.Name);
			NavigationController.PushViewController(streetViewController, false);
		}
Exemplo n.º 32
0
        private static MakeSuggestionCtl addMakeSuggestionCtlToPanorama(Panorama para, IApplicationBar applicationBar, int id, string header, string fileName, string pluralName, string singularName, int historyCount, EventHandler newItemClick)
        {            
            var item = new PanoramaItem
            {
                FontSize = 42
            };
            var sug = new MakeSuggestionCtl
            {
                Id = id,
                FileName = fileName,
                PluralName = pluralName,
                SingularName = singularName,
                HistoryCount = historyCount                
            };
            sug.DoSelect();
            item.Content = sug;
            para.Items.Add(item);

            var newItem = new MyApplicationBarMenuItem
            {
                Text = pluralName,
                MyMakeSuggestionCtl = sug,
                MyPanoramaItem = item
            };
            newItem.Click += newItemClick;
            applicationBar.MenuItems.Add(newItem);

            return sug;
        }
Exemplo n.º 33
0
 private static void loadSuggestionListToUI(Panorama para, IApplicationBar appBar, EventHandler newItemClick, SuggestionList li)
 {
     addMakeSuggestionCtlToPanorama(para, appBar, li.Id, li.HeaderText, li.ListFileName, li.PluralName, li.SingularName, li.HistoryCount, newItemClick);
 }
        private bool MovePano(Panorama pano)
        {
            bool result = false;
            if (PivotNext)
            {
                pano.DefaultItem = pano.Items[(pano.SelectedIndex + 1) % pano.Items.Count];
                result = true;
            }
            else if (PivotLast)
            {
                if (pano.SelectedIndex == 0)
                {
                    pano.DefaultItem = pano.Items[pano.Items.Count - 1];
                    result = true;
                }
                else
                {
                    pano.DefaultItem = pano.Items[pano.SelectedIndex - 1];
                    result = true;
                }
            }
            else if (!string.IsNullOrWhiteSpace(PivotName))
            {
                var panoToGo = pano.Items.Cast<PanoramaItem>().FirstOrDefault(item => item.Name.ToLowerInvariant().StartsWith(PivotName.ToLowerInvariant())
                                                                || item.GetValue(AutomationProperties.NameProperty).ToString().StartsWith(PivotName.ToLowerInvariant()));

                if (panoToGo != null)
                {
                    pano.DefaultItem = panoToGo;
                    result = true;
                }
                else
                {
                    SendNotFoundResult(string.Format("PivotCommand: Could not find the Panorama : {0}", PivotName));
                }
            }
            else
            {
                SendNotFoundResult("PivotCommand: Could nto find the Panorama element");
            }

            return result;
        }
Exemplo n.º 35
0
        private void addTrialModeCtlToPanorama(Panorama para, IApplicationBar applicationBar, string header)
        {
            var item = new PanoramaItem
            {
                FontSize = 42
            };
            var tmc = new TrialModeCtl();
            item.Content = tmc;
            para.Items.Add(item);

            var newItem = new MyApplicationBarMenuItem
            {
                Text = header,
                MyPanoramaItem = item
            };
            newItem.Click += newItem_Click;
            applicationBar.MenuItems.Add(newItem);
        }
 public void OnGetPanorama(Panorama p, int error)
 {
     //使用pid进入时添加标注
     if (error != 0)
     {
         Toast.MakeText(panoramaDemoActivityMain,
                 "抱歉,未能检索到全景数据", ToastLength.Long).Show();
     }
     if (p != null)
     {
         panoramaDemoActivityMain.mPanoramaView.Panorama = p;
         panoramaDemoActivityMain.mRoadName.Text = p.StreetName;
     }
 }
Exemplo n.º 37
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Default the Calculator Item as disabled
            Calculator.IsEnabled = false;
            //Calculator.Opacity = 0.1;


            // Make the Application Bar
            ApplicationBar = new ApplicationBar();
            ApplicationBar.Mode = ApplicationBarMode.Minimized;
            ApplicationBar.Opacity = 1.0;
            ApplicationBar.BackgroundColor = (Color)Application.Current.Resources["PhoneAccentColor"];
            ApplicationBar.IsVisible = true;
            ApplicationBar.IsMenuEnabled = true;
            

            ApplicationBarMenuItem ratebutton = new ApplicationBarMenuItem();
            ratebutton.Text = "rate this app";
            ApplicationBar.MenuItems.Add(ratebutton);

            ratebutton.Click += new EventHandler(ratebutton_click);

            //ApplicationBarMenuItem buybutton = new ApplicationBarMenuItem();
            //buybutton.Text = "Get ad-free version";
            //ApplicationBar.MenuItems.Add(buybutton);

            //buybutton.Click += new EventHandler(buybutton_click);



            // Set the data context of the listbox control to the sample data
            DataContext = App.ViewModel;

            ReceiveDataInApplicationVariable();

            Panorama myPanorama = new Panorama();
            myPanorama.Name = "HomePanorama";

            /*********************** Set the Unit Boxes ************************/
            int conversionType = (Application.Current as App).conversionType;
            int unitIndex1 = (Application.Current as App).unitIndex1;
            int unitIndex2 = (Application.Current as App).unitIndex2;

            switch (conversionType)
            {
                case 1: // length
                    {
                        if (unitIndex1 == 0) // from inches
                            inputUnitBlock.Text = "inches";
                        else if (unitIndex1 == 1) // from feet
                            inputUnitBlock.Text = "feet";
                        else if (unitIndex1 == 2) // from yards
                            inputUnitBlock.Text = "yards";
                        else if (unitIndex1 == 3) // from miles
                            inputUnitBlock.Text = "miles";
                        else if (unitIndex1 == 4) // from millimeters
                            inputUnitBlock.Text = "millimeters";
                        else if (unitIndex1 == 5) // from centimeters
                            inputUnitBlock.Text = "centimeters";
                        else if (unitIndex1 == 6) // from meters
                            inputUnitBlock.Text = "meters";
                        else if (unitIndex1 == 7) // from kilometers
                            inputUnitBlock.Text = "kilometers";
                  // Output Unit Block
                        if (unitIndex2 == 0) // to inches
                            outputUnitBlock.Text = "inches";
                        else if (unitIndex2 == 1) // to feet
                            outputUnitBlock.Text = "feet";
                        else if (unitIndex2 == 2) // to yards
                            outputUnitBlock.Text = "yards";
                        else if (unitIndex2 == 3) // to miles
                            outputUnitBlock.Text = "miles";
                        else if (unitIndex2 == 4) // to millimeters
                            outputUnitBlock.Text = "millimeters";
                        else if (unitIndex2 == 5) // to centimeters
                            outputUnitBlock.Text = "centimeters";
                        else if (unitIndex2 == 6) // to meters
                            outputUnitBlock.Text = "meters";
                        else if (unitIndex2 == 7) // to kilometers
                            outputUnitBlock.Text = "kilometers"; 
                    } break;
                case 2: // weight
                    {
                        if (unitIndex1 == 0) // from ounces
                            inputUnitBlock.Text = "ounces";
                        else if (unitIndex1 == 1) // from pounds
                            inputUnitBlock.Text = "pounds";
                        else if (unitIndex1 == 2) // from tons (US)
                            inputUnitBlock.Text = "tons (US)";
                        else if (unitIndex1 == 3) // from tons (UK)
                            inputUnitBlock.Text = "tons (UK)";
                        else if (unitIndex1 == 4) // from metric tons
                            inputUnitBlock.Text = "metric tons";
                        else if (unitIndex1 == 5) // from grams
                            inputUnitBlock.Text = "grams";
                        else if (unitIndex1 == 6) // from kilograms
                            inputUnitBlock.Text = "kilograms";

                        // Output Unit Block
                        if (unitIndex2 == 0) // to ounces
                            outputUnitBlock.Text = "ounces";
                        else if (unitIndex2 == 1) // to pounds
                            outputUnitBlock.Text = "pounds";
                        else if (unitIndex2 == 2) // to tons (US)
                            outputUnitBlock.Text = "tons (US)";
                        else if (unitIndex2 == 3) // to tons (UK)
                            outputUnitBlock.Text = "tons (UK)";
                        else if (unitIndex2 == 4) // to metric tons
                            outputUnitBlock.Text = "metric tons";
                        else if (unitIndex2 == 5) // to grams
                            outputUnitBlock.Text = "grams";
                        else if (unitIndex2 == 6) // to kilograms
                            outputUnitBlock.Text = "kilograms"; 
                    } break;
                case 3: // volume
                    {
                        if (unitIndex1 == 0) // from liquid ounces
                            inputUnitBlock.Text = "liquid ounces";
                        else if (unitIndex1 == 1) // from pints (US)
                            inputUnitBlock.Text = "pints (US)";
                        else if (unitIndex1 == 2) // from cubic inches
                            inputUnitBlock.Text = "cubic inches";
                        else if (unitIndex1 == 3) // from cubic feet
                            inputUnitBlock.Text = "cubic feet";
                        else if (unitIndex1 == 4) // from cups (US)
                            inputUnitBlock.Text = "cups (US)";
                        else if (unitIndex1 == 5) // from metric cups
                            inputUnitBlock.Text = "metric cups";
                        else if (unitIndex1 == 6) // from gallons (US)
                            inputUnitBlock.Text = "gallons (US)";
                        else if (unitIndex1 == 7) // from milliliters
                            inputUnitBlock.Text = "milliliters";
                        else if (unitIndex1 == 8) // from centiliters
                            inputUnitBlock.Text = "centiliters";
                        else if (unitIndex1 == 9) // from liters
                            inputUnitBlock.Text = "liters";
                        else if (unitIndex1 == 10) // from barrels
                            inputUnitBlock.Text = "barrels";
                        // Output Unit Block
                        if (unitIndex2 == 0) // to liquid ounces
                            outputUnitBlock.Text = "liquid ounces";
                        else if (unitIndex2 == 1) // to pints (US)
                            outputUnitBlock.Text = "pints (US)";
                        else if (unitIndex2 == 2) // to cubic inches
                            outputUnitBlock.Text = "cubic inches";
                        else if (unitIndex2 == 3) // to cubic feet
                            outputUnitBlock.Text = "cubic feet";
                        else if (unitIndex2 == 4) // to cups (US)
                            outputUnitBlock.Text = "cups (US)";
                        else if (unitIndex2 == 5) // to metric cups
                            outputUnitBlock.Text = "metric cups";
                        else if (unitIndex2 == 6) // to gallons (US)
                            outputUnitBlock.Text = "gallons (US)";
                        else if (unitIndex2 == 7) // to milliliters
                            outputUnitBlock.Text = "milliliters";
                        else if (unitIndex2 == 8) // to centiliters
                            outputUnitBlock.Text = "centiliters";
                        else if (unitIndex2 == 9) // to liters
                            outputUnitBlock.Text = "liters";
                        else if (unitIndex2 == 10) // to barrels
                            outputUnitBlock.Text = "barrels";
                    } break;
                case 4: // data
                    {
                        // Input Units
                        if (unitIndex1 == 0) // bit
                            inputUnitBlock.Text = "bits";
                        else if (unitIndex1 == 1) // byte
                            inputUnitBlock.Text = "bytes";
                        else if (unitIndex1 == 2)
                            inputUnitBlock.Text = "kilobytes";
                        else if (unitIndex1 == 3)
                            inputUnitBlock.Text = "megabytes";
                        else if (unitIndex1 == 4)
                            inputUnitBlock.Text = "gigabytes";
                        else if (unitIndex1 == 5)
                            inputUnitBlock.Text = "terabytes";

                        // Output Units
                        if (unitIndex2 == 0)
                            outputUnitBlock.Text = "bits";
                        else if (unitIndex2 == 1)
                            outputUnitBlock.Text = "bytes";
                        else if (unitIndex2 == 2)
                            outputUnitBlock.Text = "kilobytes";
                        else if (unitIndex2 == 3)
                            outputUnitBlock.Text = "megabytes";
                        else if (unitIndex2 == 4)
                            outputUnitBlock.Text = "gigabytes";
                        else if (unitIndex2 == 5)
                            outputUnitBlock.Text = "terabytes";
                    } break;
                case 5: // temperature
                    {
                        // Input Units
                        if (unitIndex1 == 0) // kelvin
                            inputUnitBlock.Text = "kelvin";
                        else if (unitIndex1 == 1) // celsius
                            inputUnitBlock.Text = "celsius";
                        else if (unitIndex1 == 2) // fahrenheit
                            inputUnitBlock.Text = "fahrenheit";

                        // Output Units
                        if (unitIndex2 == 0) // kelvin
                            outputUnitBlock.Text = "kelvin";
                        else if (unitIndex2 == 1) // celsius
                            outputUnitBlock.Text = "celsius";
                        else if (unitIndex2 == 2) // fahrenheit
                            outputUnitBlock.Text = "fahrenheit";
                    } break;
                case 6: // cooking
                    {
                        if (unitIndex1 == 0) // from milliliters
                            inputUnitBlock.Text = "milliliters";
                        else if (unitIndex1 == 1) // from metric cups
                            inputUnitBlock.Text = "metric cups";
                        else if (unitIndex1 == 2) // from liters
                            inputUnitBlock.Text = "liters";
                        else if (unitIndex1 == 3) // from teaspoons (US)
                            inputUnitBlock.Text = "teaspoons (US)";
                        else if (unitIndex1 == 4) // from tablespoons (US)
                            inputUnitBlock.Text = "tablespoons (US)";
                        else if (unitIndex1 == 5) // from cups (US)
                            inputUnitBlock.Text = "cups (US)";
                        else if (unitIndex1 == 6) // from 
                            inputUnitBlock.Text = "pints (US)";
                        else if (unitIndex1 == 7) // from 
                            inputUnitBlock.Text = "quarts (US)";
                        else if (unitIndex1 == 8) // from gallons (US)
                            inputUnitBlock.Text = "gallons (US)";
                        else if (unitIndex1 == 9) // from 
                            inputUnitBlock.Text = "teaspoons (UK)";
                        else if (unitIndex1 == 10) // from 
                            inputUnitBlock.Text = "tablespoons (UK)";
                        else if (unitIndex1 == 11) // from 
                            inputUnitBlock.Text = "fluid ounces (UK)";
                        else if (unitIndex1 == 12) // from 
                            inputUnitBlock.Text = "gallons (UK)";
                        // Output Unit Block
                        if (unitIndex2 == 0) // to milliliters
                            outputUnitBlock.Text = "milliliters";
                        else if (unitIndex2 == 1) // from metric cups
                            outputUnitBlock.Text = "metric cups";
                        else if (unitIndex2 == 2) // from liters
                            outputUnitBlock.Text = "liters";
                        else if (unitIndex2 == 3) // from teaspoons (US)
                            outputUnitBlock.Text = "teaspoons (US)";
                        else if (unitIndex2 == 4) // from tablespoons (US)
                            outputUnitBlock.Text = "tablespoons (US)";
                        else if (unitIndex2 == 5) // from cups (US)
                            outputUnitBlock.Text = "cups (US)";
                        else if (unitIndex2 == 6) // from 
                            outputUnitBlock.Text = "pints (US)";
                        else if (unitIndex2 == 7) // from 
                            outputUnitBlock.Text = "quarts (US)";
                        else if (unitIndex2 == 8) // from gallons (US)
                            outputUnitBlock.Text = "gallons (US)";
                        else if (unitIndex2 == 9) // from 
                            outputUnitBlock.Text = "teaspoons (UK)";
                        else if (unitIndex2 == 10) // from 
                            outputUnitBlock.Text = "tablespoons (UK)";
                        else if (unitIndex2 == 11) // from 
                            outputUnitBlock.Text = "fluid ounces (UK)";
                        else if (unitIndex2 == 12) // from 
                            outputUnitBlock.Text = "gallons (UK)";
                    } break;
            };

            //EqualSign.Source = new System.Windows.Media.Imaging.BitmapImage("/Images/Equal Sign tan.jpg");

            // If RemoveBackEntry is called on an empty back stack, an InvalidOperationException is thrown.
            // Check to make sure the BackStack has entries before calling RemoveBackEntry.

            //if (RootFrame.BackStack.Count() > 0)
            //    App.RootFrame.RemoveBackEntry();

            //// Refresh the history list since the back stack has been modified.
            //UpdateHistory();

        }