Care.MainPage.Timer_Tick C# (CSharp) Method

Timer_Tick() private method

private Timer_Tick ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void Timer_Tick(object sender, EventArgs e)
        {
            if (hubtiles == null || hubtiles.Count == 0)
                return;
            Random r = new Random();
            foreach(HubTile hub in hubtiles)
            {
                int result = r.Next(5);

                String tag = hub.Tag as String;
                if (tag == "Expanded")
                {
                    if (result <= 3)
                    {
                        hub.Tag = "Expanded";
                        VisualStateManager.GoToState(hub, "Expanded", true);
                    }
                    else if (result <= 4)
                    {
                        hub.Tag = "Flipped";
                        VisualStateManager.GoToState(hub, "Flipped", true);
                    }
                }
                else if (tag == "Flipped")
                {
                    hub.Tag = "Expanded";
                    VisualStateManager.GoToState(hub, "Expanded", true);
                }
            }
        }