Sigurd Snørteland


TinyApps: SeByen (unofficial)

“SeByen is an independent Norwegian TV channel. The channel broadcasts culture, news, sports and series.”

This is an unofficial SeByen WP7 streaming client.

Download the source code:

Advertisements

iPhone styled WP7 apps

Tab Bar Navigation

Download the source code:

Page Scrolling Navigation

Download the source code:


MSDN Live 2011

This blog post contains links to the WP7  example apps (busted & myChannel9), as well as links to more information relevant to the session I gave during this round of MSDN Live in Norway. Over the last two weeks the MSDN Live 2011 road-show have visited Stavanger, Bergen, Trondheim and Oslo

Download the slides:

busted

Download the source code:
  

myChannel9

Download the source code:

Useful links:
http://silverlight.net/getstarted/devices/windows-phone
https://windowsphone.create.msdn.com/app/list
http://wp7applist.com
http://www.meetup.com/Windows-Phone-Developer-Community/messages/boards/thread/10459901
http://www.admob.com
https://pubcenter.microsoft.com


viu² touch – one of the norwegian wp7 app contest winners

More info:
http://www.vs2010.no
http://blogs.msdn.com/b/dpenorway/archive/2011/01/27/3-vinner-av-wp7-app-konkurransen-er-k-229-ret.aspx

viu² touch is a WP7 based version of my silverlight mediacenter app viu² (www.viu2.com).
More information about viu² touch will be published soon!!


BabySmash7 – a wp7 children’s game (source code included)

BabySmash7 is a wp7 based version of Scott Hanselmans ‘BabySmash

“As babies smash on the phone, colored shapes, letters and numbers appear on the screen”

Go to the bottom of this article to find a link to the source code.

 

The MainPage.xaml is quite small and it’s dominated by the Canvas-object, where the colored shapes, letters and numbers will be added.

    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FFA0A0A0" Offset="0"/>
                <GradientStop Color="Black" Offset="1"/>
            </LinearGradientBrush>
        </Grid.Background>

        <TextBlock x:Name="PageTitle" Opacity="0.8" Text="BabySmash7" Foreground="#FF4C4C4C" Margin="21,10,0,28" Style="{StaticResource PhoneTextTitle1Style}"/>
        <MediaElement x:Name="media" Width="0" Height="0" Visibility="Collapsed" />
        <Canvas Name="figuresCanvas" Background="Transparent" MouseLeftButtonDown="figuresCanvas_MouseLeftButtonDown"/>
    </Grid>

The ‘figuresCanvas_MouseLeftButtonDown’ event is raised each time the user touches the screen.

        private void figuresCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            PageTitle.Visibility = Visibility.Collapsed;

            addRandomUserControl();
            playRandomSound();

            if (figuresCanvas.Children.Count > 6)
            {
                figuresCanvas.Children.RemoveAt(0);
            }
        }
        private void addRandomUserControl()
        {
            int randomNumber = Utils.RandomBetweenTwoNumbers(1, 4);
            //randomNumber = 1;
            switch (randomNumber)
            {
                case 1:
                    addRandomLetter();
                    break;
                case 2:
                    addRandomNumber();
                    break;
                case 3:
                    addRandomSymbol();
                    break;
                case 4:
                    addRandomSymbol();
                    break;
            }
        }

This method adds a random colored letter to the screen.

        private void addRandomLetter()
        {
            UserControl userControl = new UserControl();

            string[] numbers = new string[52] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
            int randomNumber = Utils.RandomBetweenTwoNumbers(0, 51);

            userControl = new Shapes.CoolLetter(numbers[randomNumber].ToString(), Utils.GetRandomColor());

            userControl.Width = 320;
            userControl.Height = 260;

            if (Orientation == PageOrientation.Landscape || Orientation == PageOrientation.LandscapeLeft || Orientation == PageOrientation.LandscapeRight)
            {
                Canvas.SetLeft(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(550)));
                Canvas.SetTop(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(250)));
            }
            else
            {
                Canvas.SetLeft(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(260)));
                Canvas.SetTop(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(550)));
            }

            figuresCanvas.Children.Add(userControl);
        }

This method adds a random colored number to the screen.

private void addRandomNumber()
        {
            UserControl userControl = new UserControl();

            int[] numbers = new int[10] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            int randomNumber = Utils.RandomBetweenTwoNumbers(0, 9);

            userControl = new Shapes.CoolLetter(numbers[randomNumber].ToString(), Utils.GetRandomColor());

            userControl.Width = 320;
            userControl.Height = 260;

            if (Orientation == PageOrientation.Landscape || Orientation == PageOrientation.LandscapeLeft || Orientation == PageOrientation.LandscapeRight)
            {
                Canvas.SetLeft(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(600)));
                Canvas.SetTop(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(250)));
            }
            else
            {
                Canvas.SetLeft(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(300)));
                Canvas.SetTop(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(550)));
            }

            figuresCanvas.Children.Add(userControl);
        }

This method adds a random colored symbol to the screen.

        private void addRandomSymbol()
        {
            UserControl userControl = new UserControl();

            int randomNumber = Utils.RandomBetweenTwoNumbers(1, 7);
            Color randomColor = Utils.GetRandomColor();

            switch (randomNumber)
            {
                case 1:
                    userControl = new Shapes.CoolCircle(Utils.GetGradientBrush(randomColor));
                    break;
                case 2:
                    userControl = new Shapes.CoolHeart(Utils.GetGradientBrush(randomColor));
                    break;
                case 3:
                    userControl = new Shapes.CoolHexagon(Utils.GetGradientBrush(randomColor));
                    break;
                case 4:
                    userControl = new Shapes.CoolRectangle(Utils.GetGradientBrush(randomColor));
                    break;
                case 5:
                    userControl = new Shapes.CoolSquare(Utils.GetGradientBrush(randomColor));
                    break;
                case 6:
                    userControl = new Shapes.CoolStar(Utils.GetGradientBrush(randomColor));
                    break;
                case 7:
                    userControl = new Shapes.CoolTrapezoid(Utils.GetGradientBrush(randomColor));
                    break;
                case 8:
                    userControl = new Shapes.CoolTriangle(Utils.GetGradientBrush(randomColor));
                    break;
            }

            userControl.Width = 100;   //Utils.RandomBetweenTwoNumbers(0, 100);
            userControl.Height = 100;  //Utils.RandomBetweenTwoNumbers(0, 100);

            //Canvas.SetLeft(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(this.ActualWidth - userControl.Width)));
            //Canvas.SetTop(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(this.ActualHeight - userControl.Height)));

            if (Orientation == PageOrientation.Landscape || Orientation == PageOrientation.LandscapeLeft || Orientation == PageOrientation.LandscapeRight)
            {
                Canvas.SetLeft(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(700)));
                Canvas.SetTop(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(300)));
            }
            else
            {
                Canvas.SetLeft(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(200)));
                Canvas.SetTop(userControl, Utils.RandomBetweenTwoNumbers(0, Convert.ToInt32(600)));
            }

            figuresCanvas.Children.Add(userControl);
        }

This method plays a random sound.

        private void playRandomSound()
        {
            int randomSound = Utils.RandomBetweenTwoNumbers(1, 7);
            media.Source = new Uri("Audio/" + randomSound + ".wav", UriKind.Relative);
            media.Play();
        }

Download the source code: