Showing posts with label WPF. Show all posts
Showing posts with label WPF. Show all posts

Saturday, December 6, 2014

InjectionMap.Wpf: Extension for InjectionMap

InjectionMap.Wpf is a extension to InjectionMap that allows to define the ViewModel in the xaml of the View. InjectionMap will resolve the ViewModel and bind it to the DataContext of the View. All parameters of the constructor can be resolved using ConstructorInjection.

Create a ViewModel. A class that will be added to the DataContext
namespace ViewModels
{
 public class ViewModel : INotifyPropertyChanged
 {
  public ViewModel(ISettings settings)
  {
    ...
  }
 }
}

Map the dependencies

using(var mapper = new InjectionMapper())
{
      mapper.Map<ISettings, Settings>();
}

Bind the ViewModel to the View

<Window x:Class="MainWindow"
 xmlns:wf="http://schemas.wickedflame.ch/2013/xaml/presentation"
        xmlns:vm="clr-namespace:ViewModels"
        wf:InjectionResolver.Resolve="{x:Type vm:ViewModel}">
 <!-- Optional Namespace for InjectionMap.Wpf: xmlns:wf="clr-namespace:InjectionMap;assembly=personalplaner.common" -->
...
</Window>
The ViewModel will be resolved and bound to the DataContext of the UserControl/Window.

Tuesday, April 16, 2013

Xaml Designer

It's been quiet for some time now. But now I finally started a new project an now I am at a state where I can show a little bit.

Xaml Designer

It's a simple editor for xaml with a graphical UI Designer.


I needed a Graphical UI Designer where I could load a *.xaml file and be able to manipulate this. The Project then started as a Test application to see how I could manipulate the XAML. Then I also wanted to see the resulting XAML and be able to manipulate it. So I looked around for a code TextBox. I found a few editors but was not very happy with them so I decided to create a new editor.

I created the Code editor from scratch. There are still some important features missing for a Code edtior like Intelisense (Autocomplete) and the automatic indentation rules.
The Synthaxhighlighting currently only supports C# and XML/XAML. The highlighting Engine is based on xml files. This way the editor can be extended very easily.

The UI Designer was also created from scratch. At the moment it supports selecting an element and Drag & Drop. With this function elements can be moved around and placed in different positions. The elements can be dropped in most Panels and ContentControls. ItemsControl and the remaining Panels still need to be implemented.

At the left side there is the LogicalTree to help selecting elements.

Next I will create a PropertyGrid to be able to change properties without having to edit the XAML.

At the moment I only support WPF but Silverlight is also planned and probably also WinRT.
But at the moment I am far away from any Beta or pre-stable version. I mostly use it in Debug mode and fix the errors on the run.
Hopefuly I will soon have a version ready for release.

Sunday, May 13, 2012

Personalplaner sources are online

I uploaded all sources of the new Personalplaner to personalplaner.codeplex.com.

For development I use a different reopsitory. When I started on the project I didn't expect to ever complete it. So I chose to host it on unfuddle.com.
When I decided to host the setup on codeplex as shareware I also came to the decision to upload the code. Now whenever I create a new stable version I upload the code as well.

I guess it doesn't allways end as expected. Originaly I didn't expect to ever finish the project. And by now I created 14 stable releases that are finished, useable, free and open source :-)

Have fun!

Thursday, May 10, 2012

Personalplaner v2 is stable


The stable version of the Personalplaner is 2.0.1.12131.

http://personalplaner.codeplex.com/

For this version the Personalplaner was completely redesigned.
A complete new Look was created. This was accomplished by porting the Personalplaner to WPF.
The Application was split into different layers.

  1. The Visual layer 
  2. The Logic layer
  3. The Application Data layer
  4. The Storage Logic layer
  5. The Data Storage
The Data Storage was not touched much. This is still a MSSQL Server.

The Storage Logic layer still uses Stored Procedures. These were modified or recreated.

The Application Data layer is the connection to the Storage. This was redesigned to a kind of service provider so that it could easily be replaced/ported to eg. WebServices.

The Logic layer was completely recreated. This layer now has an MVVM implementation uses a ServiceLocator pattern. With this redesign the Visual Layer could easily be replaced.

The Visual Layer was a complete redesign. 
  • There is only one main view in the window.
  • The main view can be displayed in a dark or a gray style
  • Secondary views are allways in a white style
  • When a secondary view is created, it is displayed insted of the main view. 
  • All secondary views are designed to look alike. 
  • The same user handling was applied to all views. 
  • Ending a view allways leads back to the previous view.
  • A view can be ended with a cancel button, a ok button or a 'back' arrow button
  • Windows/Dialogs are seldomely used
  • The content of the main view can be extended with plugins
  • The main menu is redesigned and split into tabs that can be selected
  • Descriptions are displayed in most functions










Monday, September 12, 2011

Animated loading screen

When loading big data collections or switching between views that contain a lot of data, there is often a big timespan where the user is not sure if the application has crashed or if it is doing something.
So I wanted to draw a semi transparent overlaying layer over the window and create an animation that indicates that the application is doing some work.

Sounds easy... In reality it's something that's almost impossible!

In wpf the UI thread is not the same as the main application thread. But still they are linked to each other so that the UI thread gets blocked when the main thread is working hard. With this restriction there can't be any semi transparent layer and especialy no animation that gets shown or executed while the main thread is working.

When I was about to give up I stumbled upon a grea thread by Dwayne Need describing how single elements in wpf can be run in a separate thread. This means some complicated threading and trying to get the data binding and the resizing of the controls syncronized between the different threads, but in the end I managed to get it all worked out.

Now I am able to display an animation while the main tread is doing some hard work trying to accomplish whatever tasks I let it do.



Tuesday, August 23, 2011

Plan merged to new design

I was able to finish merging the main plan of the Personalplaner to the new platform with the new design. The new Style makes all much smoother to look at and makes it easier to use.



With this done I can eliminate one of my greatest fears for failing in this project.
- I absolutely had no idea how I would create the view and split the data so that it would fit into the grids
- I did not know if I should create a complete new type of grid control or if I should use/extend an existing implementation of a grid
- I didn't know how I wanted to fill the data into the grids
- I was not shure how I could link the different grids with each other and still ensure code abstraction
- I was not shure if I could setup the data correctly to be able to use my MVVM implenmentation correctly

In the end I was able to do it just the way it was supposed to be and it all works eaven better than it used to :-)

Doing it corectly this time, I was able to eliminate about 3/5 of the code I used in the previous version.



Thursday, July 14, 2011

VecDraw

VecDraw is a small lightweight vector based drawing application that I developed to get to know WPF. It's not as big as some other Vecotor based drawing applications, but hey! I'm the only developer and it's for free...

It can be found on vecdraw.codeplex.com. It's open source and free for installation. So go ahead and install it.



Personalplaner 2.0

The Personalplaner is an old school project that I made.
Unfortunately at that time I was not the developer I am now.
At the moment I am porting my old Personalplaner from WinForms to WPF.
Beside changing the layout and the graphics I am also implementing a MVVM Pattern, and splitting up the layers properly. Besides that I am implementing a proper ServiceLocator Pattern for providing services and the ability for UnitTesting.
Beside redesigning everything I also intend to get some more languages into it (at the moment german is the only option...)

I am still far away from finishing but I'm working on it.

The old Personalplaner can be found at personalplaner.codeplex.com. There is also a somewhat out of date blog that I will update some time soon (hopefuly...) personalplaner.blogspot.com/
The Personalplaner is open source and free for use. So there is no reason why you should not download and install it... :-)
The sources aren't up to date because I use a different repository for my development, but I will update the them when I have a somewhat stable version running.

Here is how the Personalplaner used to look:


Here is how it looks now: