My first app with Windows Phone

ilan

Expert
Licensed User
Longtime User
Schaut wirklich super aus. wars wirklich so einfach wie es aussieht?

Wie lange hat es gedauert diese App zu erstellen?

Ich hab mir auch ein Windows Phone gekauft, ich denke
Windows Apps sind der neachste Hit. Werde mich in den neachsten Tagen
damit einbisschen mehr bescheaftigen.

Congratulations :)
 
D

Deleted member 103

Guest
Thanks Ilan!

For completion I have about 2 months used. Most of the time I got used to understand how the program works, such as Create Layout.
But if we have understood this, then it goes very quickly.

I can accept up to about 60% in Windows Phone from my B4a Code.

For my app I wanted to use any standard Windows Phone Controls, therefore I have the necessary controls need to program yourself.
For example: Context-Menu, PreferenceManager, dialogue, Keyboard, Menu, PreferenceMenu, Image Button, ToggleButton.

If you need help you can contact me. :)
 

ilan

Expert
Licensed User
Longtime User
If you need help you can contact me.

thanx filippo for your offer, i will need a little help in the beginning, if you got a simple example how to use scrollviews, menu, buttons, dialog, msgbox, .. that would be fantastic..

and again Good Luck with Windows Apps, dont forget to tell us about the publishing process.

btw does windows apps need cetifications like apple? or just open dev account create your app and upload like google play?
 
D

Deleted member 103

Guest
thanx filippo for your offer, i will need a little help in the beginning, if you got a simple example how to use scrollviews, menu, buttons, dialog, msgbox, .. that would be fantastic..

and again Good Luck with Windows Apps, dont forget to tell us about the publishing process.

btw does windows apps need cetifications like apple? or just open dev account create your app and upload like google play?
I just today opened a Developer account(17,20 Euro). Whether the need for a cetifications apps like Apple, I do not know yet.
I'll make an example of scroll views, menu, buttons, dialog, msgbox.
 
D

Deleted member 103

Guest
Hi ilan,

For this example I have used approximately one hour.
But you have the package "Coding4Fun.Toolkit.Controls.2.1.7" install, I had to uninstall it because otherwise the zip-file for the Forum would become too large.

fg-example.JPG
Coding4Fun-Tootlkit.JPG
 

Attachments

  • FG-Example.zip
    389.3 KB · Views: 288

ilan

Expert
Licensed User
Longtime User
Thank you filippo, i will take a look at it when i get home.
i will try to port a b4x app to windows mobile to see how it goes, and also open a win mobile dev account.

i believe win10 is the next big thing in the mobile industry.
And because it has not that much apps like appstore and google play there is a good chance for indie developers like us...
 

ilan

Expert
Licensed User
Longtime User
it is much harder then i thought, simple stuff are so complicated and i dont find the way to do them.
like add controls to the page in designer, when i add a button its ok but the add another control replace the old button.

why??
 
D

Deleted member 103

Guest
it is much harder then i thought, simple stuff are so complicated and i dont find the way to do them.
like add controls to the page in designer, when i add a button its ok but the add another control replace the old button.

why??
these are just the beginner's mistake. you should something with Grid and StackPanel play. you'll see it's really very simple.
 

ilan

Expert
Licensed User
Longtime User
yes i allready found out that i have to add a grid and then i can add some controls to it.
also how to add files to the assets folder is also clear for me now :)

i guess this is the beginning period headache :confused:, i have no clue how to use multiple pages and play sound, timer,... (VB2010 is much much easier)

will need to google a little

thanx filippo
 
D

Deleted member 103

Guest
Here you have a few examples:
B4X:
########## Timer-Example ##############
    Imports System.Windows.Threading

    Private timer As DispatcherTimer

    Public Sub New()
        SetupTimerSpeed()
    End Sub

    Private Sub SetupTimerSpeed()
        '  DispatcherTimer setup
        timerSpeed = New DispatcherTimer()
        AddHandler timerSpeed.Tick, AddressOf timerSpeed_Tick
        timerSpeed.Interval = New System.TimeSpan(0, 0, 0, 0, 10) '10 milli sec.
        timerSpeed.Start()
    End Sub

    Private Sub timerSpeed_Tick()
        ....
        ....
    End Sub
#######################################

########## Sound-Example ##############
    Imports System.Windows.Media

    Public Sub New()
        play("Assets/mysound.wav")
    End Sub
   
    Private Sub play(ByVal file As String)
        Dim stream As Stream = TitleContainer.OpenStream(file)
        Dim sound As SoundEffect = SoundEffect.FromStream(stream)
        FrameworkDispatcher.Update()
        sound.Play(0.5, 0, 0)
    End Sub
#######################################

########## Read/Write-Example ##############

     Public Function ReadFileAsString(fileName As String) As String
        Dim file As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
        Dim filestream As IsolatedStorageFileStream = file.OpenFile(fileName, FileMode.Open, FileAccess.Read)
        'Dim data As String = ""
        Dim sb As New StringBuilder

        Using reader As New StreamReader(filestream)
            'data = reader.ReadToEnd
            Do While reader.Peek() >= 0
                'data = data & reader.ReadLine & vbCrLf
                sb.Append(reader.ReadLine).Append(vbCrLf)
            Loop
        End Using

        'System.Diagnostics.Debug.WriteLineIf(True, "ReadFromFile:" & data)
        'Return data
        Return sb.ToString
    End Function

    Public Function ReadFileAsList(fileName As String) As List(Of String)
        Dim file As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
        Dim filestream As IsolatedStorageFileStream = file.OpenFile(fileName, FileMode.Open, FileAccess.Read)
        Dim data As New List(Of String)

        Using reader As New StreamReader(filestream)
            Do While reader.Peek() >= 0
                data.Add(reader.ReadLine)
            Loop
        End Using

        'System.Diagnostics.Debug.WriteLineIf(True, "ReadFromFile:" & data)
        Return data
    End Function

    Public Sub WriteListAsText(ByVal file As String, ByVal lst As List(Of String))

        Dim ISF As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
        'create new file
        Using SW As New StreamWriter(New IsolatedStorageFileStream(file, FileMode.Create, FileAccess.Write, ISF))

            For i As Integer = 0 To lst.Count - 1
                SW.WriteLine(lst.Item(i))
            Next
            SW.Close()

        End Using

    End Sub
#######################################
 

ilan

Expert
Licensed User
Longtime User
hi filippo, do you know how to set the button background to NULL when it is pressed?

i mean control the visual state of the button (Hold, Release)

now i have a button with an image as background when i press it the button background change to a blue square (i believe this is default)

but i dont want it to change to anything.

how can i do it?
 
D

Deleted member 103

Guest
Hi ilan,

here is an example with my UserControl "ImageButton". :)

Imagebutton.PNG
 

Attachments

  • FgImageButton.zip
    353.6 KB · Views: 292

ilan

Expert
Licensed User
Longtime User
hi filippo, when i try your code examples non of them work for me.

i dont know why, maybe i choosed the wrong template but nothing is working

really simple stuff are so complicated, like play sound or change background image.

nothing works only errors.

and if i google you cannot find any informations, if erel will make b4w he will be for sure succesful

so frustrating :(
 
D

Deleted member 103

Guest
hi filippo, when i try your code examples non of them work for me.

i dont know why, maybe i choosed the wrong template but nothing is working

really simple stuff are so complicated, like play sound or change background image.

nothing works only errors.

and if i google you cannot find any informations, if erel will make b4w he will be for sure succesful

so frustrating :(
None of my examples it work?
Did you also installed "Microsoft Visual Studio 3013 Community"?

Here are a few links:
http://www.geekchamp.com/tips/windo...rogrammatically-set-common-control-properties
https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465351.aspx
 

ilan

Expert
Licensed User
Longtime User

ilan

Expert
Licensed User
Longtime User
i am trying to change the background and pressedbackground of an imagebutton

like this:

B4X:
    Private Sub soundbtn_Click(sender As Object, e As EventArgs) Handles soundbtn.Click
        Select Case soundon
            Case 0
                soundon = 1
                'mp1.Play()
                soundbtn.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("ms-appx:///Assets/s1.png"))
                soundbtn.PressedSource = New System.Windows.Media.Imaging.BitmapImage(New Uri("ms-appx:///Assets/s1.png"))
                soundbtn.Stretch = Stretch.Fill
            Case 1
                soundon = 0
                'mp1.Pause()
                soundbtn.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("ms-appx:///Assets/s0.png"))
                soundbtn.PressedSource = New System.Windows.Media.Imaging.BitmapImage(New Uri("ms-appx:///Assets/s0.png"))
                soundbtn.Stretch = Stretch.Fill
        End Select
    End Sub

and it is not working, the button background change to blank

or play sound like this:

B4X:
        Dim mp1 As New MediaElement
        mp1.AutoPlay = True
        mp1.Source = New Uri("ms-appx:///Audio/backm.mp3")
        mp1.Volume = 1

no sound is played

if i try your code i am getting error like something is missing

winphone1.jpg
 
D

Deleted member 103

Guest
"Microsoft Visual Studio 3013 Community"
no, should i?
Yes

no sound is played
MP3 is not supported, you need mp3 to wav convert. ( Converter Mp3 to Wav )

Your code:
B4X:
Dim mp1 As New MediaElement
        mp1.AutoPlay = True
        mp1.Source = New Uri("ms-appx:///Audio/backm.mp3")
        mp1.Volume = 1

Change to:
B4X:
    Imports Microsoft.Xna.Framework.Audio

     play("Audio/backm.wav")

    Private Sub play(ByVal file As String)
        Dim stream As Stream = TitleContainer.OpenStream(file)
        Dim sound As SoundEffect = SoundEffect.FromStream(stream)
        FrameworkDispatcher.Update()
        sound.Play(plyVolume, 0, 0)
    End Sub

Your code:
B4X:
Private Sub soundbtn_Click(sender As Object, e As EventArgs) Handles soundbtn.Click
        Select Case soundon
            Case 0
                soundon = 1
                'mp1.Play()
                soundbtn.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("ms-appx:///Assets/s1.png"))
                soundbtn.PressedSource = New System.Windows.Media.Imaging.BitmapImage(New Uri("ms-appx:///Assets/s1.png"))
                soundbtn.Stretch = Stretch.Fill
            Case 1
                soundon = 0
                'mp1.Pause()
                soundbtn.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("ms-appx:///Assets/s0.png"))
                soundbtn.PressedSource = New System.Windows.Media.Imaging.BitmapImage(New Uri("ms-appx:///Assets/s0.png"))
                soundbtn.Stretch = Stretch.Fill
        End Select
    End Sub

Change to:
B4X:
    Private Sub soundbtn_Click(sender As Object, e As EventArgs) Handles soundbtn.Click
        Select Case soundon
            Case 0
                soundon = 1
                'mp1.Play()
                soundbtn.Source = GetImageSource("s1.png")
                soundbtn.PressedSource = GetImageSource("s1.png")
                soundbtn.Stretch = Stretch.Fill
            Case 1
                soundon = 0
                'mp1.Pause()
                soundbtn.Source = GetImageSource("s0.png")
                soundbtn.PressedSource = GetImageSource("s0.png")
                soundbtn.Stretch = Stretch.Fill
        End Select
    End Sub

    Public Function GetImageSource(ByVal Image As String) As ImageSource
        Dim imageBrush As New ImageBrush()
        Dim uri As New Uri("/Assets/" & Image, UriKind.RelativeOrAbsolute)
        imageBrush.ImageSource = New BitmapImage(uri)
        Return imageBrush.ImageSource
    End Function
 
Top