From FlexAPI 1.6.17 to a WPF application

  • 4
  • Idea
  • Updated 12 months ago
Hello all...

I'm starting down the path to get my WPF chops back up to speed (we have not done much at work for a while) and I thought I would venture down the lane of creating a full app based on the Flex 1.6.17 API.

I have some personal desires for station control and I'm going to use this app as my basis for creating those controls.

I know that a number of you are playing with the API and there are some far more advanced than others and I'm sure I'm somewhere in the middle but I thought I would suggest making my effort "open source" so we can all learn in parallel.

If you are playing the API, trying to learn and would like to venture into the WPF world this might be fun for you to work along with the code as I develop it, ask questions and even suggest improvements.

If you are an API/WPF expert and you see something we could be doing better please by all means educate us and help us along.

If you just think you might like the code for your own purposes then great... I'll even help you with specifics if you want.

If there is interest I'll post this on a public repository on GitHub and we can use some other medium for interaction on it.  I don't think we should put our comments, questions, concerns here on Flex Community.  So let's look at where we could all interact on this.

Anyway here is what I'm trying to accomplish:

1) Radio connection - Find radios, provide a place to connect to one of them
2) A radio window where the currently connected radio can be controlled
3) A panadapter with frequency readout and spots from HRI and also DX clusters
4) Amp and other peripheral control

In short if I can do it I want to be able to run my station from this app.  IE SmartSDR is perhaps not needed unless I want to do something I don't provide for in the app.

I think it will take some time to get to that point but it could be fun journey.  Let me know if you are interested in riding along or if you want to get your hands dirty and play.

Mark - WS7M
Photo of Mark - WS7M

Mark - WS7M

  • 1373 Posts
  • 514 Reply Likes

Posted 4 years ago

  • 4
Photo of James Whiteway

James Whiteway

  • 1061 Posts
  • 303 Reply Likes
Sounds like fun! WPF is where I want to go. I started out with Winforms, as that is more familar to me.
And to be honest, I am not sure how I feel using XAML.
It seems more like web app development, than a Windows program. But, I've seen some pretty amazing things done in XAML. (SSDR for one) And I know, in the right hands, (probably not mine!) a lot of things can be accomplished. So, that is one reason, I will eventually move to using WPF for my app. Plus, it's something else to learn.
I'll follow along with what you do the best I can.
Who knows, I might learn something!
Photo of Mark - WS7M

Mark - WS7M

  • 1373 Posts
  • 514 Reply Likes
Well James, lets go bravely into the WPF realm and see what we think.

I have to use it for work but it is very controlled and different as I don't get to do all the pieces.  We have UI designer that mainly deals with the XAML part.

I'll post some startup stuff shortly.
Photo of Mark - WS7M

Mark - WS7M

  • 1373 Posts
  • 514 Reply Likes
Here is the first video, a very simple video on creating a solution that encompasses the Flex Radio API projects and resolves build errors.
Photo of Henning - DL6DH

Henning - DL6DH

  • 25 Posts
  • 2 Reply Likes

sorry for digging out this old thread...
Unfortunately, the link to the video does not work anymore. Is it still available or have anyone a copy of it?

73 Henning
Photo of Mark - WS7M

Mark - WS7M

  • 1373 Posts
  • 514 Reply Likes
I will dig up a fresh link this weekend for you.

Photo of Dan -- KC4GO

Dan -- KC4GO

  • 341 Posts
  • 70 Reply Likes
Thanks Mark. 
Photo of Mark - WS7M

Mark - WS7M

  • 1373 Posts
  • 514 Reply Likes
Ok here is the first part.  I called it radio connection but really it is radio discovery because that is really what it does at this point.

I want to be clear that I'm not a WPF expert and some of this is stuff I've learned through my work.  Like anything, there are better and worse ways to do things.  I am totally open to better ways to do what I am doing.

Below are parts 1 2 and 3.   I'm doing these as videos at this point and I will check in the code to github probably this weekend.  For now I figure the videos move slow enough you can probably type in the code fast enough to keep up with me.

Part 1 takes you through setting up the main view and a little bit about XAML

Part 2 expands on XAML a little more and begins down the path of MVVM

Part 3 we finish up and get the radio to be discovered in a truly WPF manner.

Like in almost any language there are better ways or rather different ways to do many things.  A more experienced WPF programmer might look at my work and scoff and think why do it that way!?  Another person my see my way is better.  Just remember that there is a personal preference to things and not all things are right or wrong.  Some things are just better or perhaps worse.

In part 2/3 I create a model which is a wrapper around the Flex API Radio object.  It is very clear the Radio object could be directly used without a model wrapper.  But the benefit of a model wrapper in my eyes is that I get to control how it behaves.  If I directly used the Flex Radio Object then I'm going to have to accept how it behaves.  So the lesson here is that wrappers help to shield object from the outside world and define their behavior in a way you want.

This is however personal preference.  It is more code to write, it is another layer to deal with.  But in the long run this model layer will not change much but will give us a lot of power and functionality.

I apologize for the quality of the videos.  I don't make many and hopefully I'll get better over time.

Here is is the link covering all three parts:

Don't be too harsh on me.  I am learning this process too!
Photo of Kevin


  • 931 Posts
  • 271 Reply Likes
Mark... I finally found this video and I'm working through it. You mention at the end there may be additional videos. Has that happened?

Another thing I have to try and learn more about is the concept  of model, view, viewmodel (am I saying that right)? 
Photo of Mark - WS7M

Mark - WS7M

  • 1373 Posts
  • 514 Reply Likes
Life and time became short Kevin, but if you have specific questions I am always open to an email or even an on the air chat and I will do what I can to help.

Photo of Jason Walther

Jason Walther

  • 15 Posts
  • 1 Reply Like
Hey Mark,
I get to adding the lines in MainWindow.xaml for my viewModels:MainWindowViewModel. It has in the error list: "MainWindowViewModel" is not supported in a Windows Presentation Foundation (WPF) project. This is followed by a plethora of other errors. Also, says "The namespace "ViewModels" is not defined" although I have double checked for upper case characters in the name, etc. It is spelled correctly. The namespace definition for "ViewModels" is in MainWindowViewModel.cs.

Again, THANK YOU for this excellent XAML primer!
Photo of Mark - WS7M

Mark - WS7M

  • 1373 Posts
  • 514 Reply Likes
Jason, I am terribly sorry about letting this go so long but honestly the board has stopped sending my notification of changes to threads so I just lost track of it.

If you are still plucking at this and having issues, send me an email!