2 Replies - 6595 Views - Last Post: 28 January 2013 - 09:21 AM

#1 celikk  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-July 12

Dynamically Drawn UI Events

Posted 28 January 2013 - 07:27 AM

I want to do something like the Notes app on the iPhone for Windows Phone but with more capabilities.
When the app starts I want to have a note selection screen which displays the headers of your notes but I don't know how to code that view

private void ReadFiles()
            IsolatedStorageFileStream savedNote = storage.OpenFile("noteHeaders.txt", FileMode.Open, FileAccess.Read);
            StreamReader reader = new StreamReader(savedNote);
            string notes = reader.ReadToEnd();

            for (int i = 0; i < CountLinesInString(notes); i++)
                block[i] = new TextBlock();
                block[i].Text = "hello world";
                block[i].DoubleTap += MainPage_DoubleTap;

        void MainPage_DoubleTap(object sender, System.Windows.Input.GestureEventArgs e)
            //open up the note taking window

Is This A Good Question/Topic? 0
  • +

Replies To: Dynamically Drawn UI Events

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 6158
  • View blog
  • Posts: 21,236
  • Joined: 05-May 12

Re: Dynamically Drawn UI Events

Posted 28 January 2013 - 07:50 AM

Ouch! Your CountLinesInString() is going to be O(n2) unless you are doing some kind of interning.

Since I don't own an iPhone, I don't know what exact UI experience you are looking for, but looking at what you've written above, it looks like you've already succeeded in getting "hello, world" to show up in a (stack?) panel for each note. Probably just change "hello, world" to be the first few characters of each note, and you should be good to go.
Was This Post Helpful? 0
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6530
  • View blog
  • Posts: 14,446
  • Joined: 02-June 10

Re: Dynamically Drawn UI Events

Posted 28 January 2013 - 09:21 AM

I suspect you are fairly new to coding because...
  • Arrays not List<>
  • No try...catch error checking
  • No check if the target file even exists
  • You're using a .txt file instead of a database
  • Your ReadFiles takes no parameters and has a hardcoded path
  • Your ReadFiles method doesn't return values but directly updates the GUI - Thus doesn't do its one and only job and it tightly bound to the GUI.
  • ReadFiles method doesn't return any success/fail to the caller

So my first advice is to do more about learning/studying and not worry about trying to architect a program from scratch until you're ready.

There is a free Windows Phone 8 course here that would be a good start.

My standard beginner resources post - Updated JAN 2013

Plan your study route:
There are three routes people seem to take when learning programming.
  • Just start trying to create programs
  • Start taking apart other programs and try to figure out the language by reverse engineering
  • Follow a guided learning course (school or self-teaching books)

For the life of me I can't figure out why people try 1 & 2. I strongly suggest taking the guided learning approach. Those book authors go in a certain order for a reason: They know what they're doing and they know the best order to learn the materials.

  • First learn the language by working 2-5 "Learn C# in 30 days" type books cover to cover.
  • Do a dozen on-line tutorial projects where you build what you're told to build, the way you are told to build it WITH AN EXPLANATION OF WHY so you can learn.
  • Learn to plan before you type.
  • THEN you start designing software with a purpose.

I don't learn from reading books: I learn by doing.

Newbie/Rookie said:

I have little/no programming experience but I need to write a program by Friday that does XYZ.

Resources, references and suggestions for new programmers.

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1