Skip to content

sagidM/Kindergarten

Repository files navigation

Pay attention: Starting from June 2017, Kindergarten is no longer an open source project.

Please contact: [email protected]


Kindergarten

What is this?

Kindergarten is information system, which provides children management for any nursery school.

Application is divided into three project

  1. Camera is simply help-app for taking photos
  2. DAL is data layer, which consists of entity models. There's also migrations there
  3. WpfApp is main program.

WpfApp

Settings save

Window resolution and state (besides minimize) always save in settings.json.

You can save some settings using binding to [] with default value.

For example

<TextBox Text="{Binding '[font_size_tables, 12]'}" />

where "12" is default value

Settings load when program has started and save when it has shut down (see App.xaml.cs).

There are a few steps to add a new window:

  • to add new *.xaml into the View directory
  • to add class into the ViewModel (namespace) directory
  • to derive created view model from ViewModelBase or PipeViewModel classes
  • in the App.xaml to add <ViewViewModelPair> into <ViewViewModelPairs> as child

Example

How to open "OtherWindow" from "SomeWindow" uses Command


  • SomeViewModel.cs
public class SomeViewModel : ViewModelBase
{
    public IRelayCommand OpenOtherCommand { get; }

    public SomeViewModel()
    {
        AddChildCommand = new RelayCommand<string>(OpenOther);
    }

    public void OpenOther(string data)
    {
        // parameters
        var pipe = new Pipe(isDialog: true);
        pipe.SetParameter("the_first_argument", 1);
        pipe.SetParameter("the_second_argument", data);

        StartViewModel<OtherViewModel>(pipe);
    }
}
  • OtherViewModel.cs
public class OtherViewModel : ViewModelBase
{
    public override void OnLoaded()
    {
        int arg1 = (int) Pipe.GetParameter("the_first_argument");
        string arg2 = (string) Pipe.GetParameter("the_second_argument");
        string arg3 = Pipe.GetParameter("no argument", "this will be a default value");  // no cast
        MessageBox.Show($"Parameters: arg1 = {arg1}, arg2 = {arg2}, arg3 = {arg3}", "Title");
    }
    
    public override bool OnFinishing()
    {
        if (MessageBox.Show("Are you sure?", "Exit", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
            return false;  // false - cancel exit
    }
}
  • SomeWindow.xaml
<Window x:Class="WpfApp.View.SomeWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        Title="SomeWindow" Height="300" Width="300">
    <StackPanel>
        <TextBox Name="TextBox" Text="This is parameter for other window"/>
        <Button Content="Open other window" Command="{Binding OpenOtherCommand}" CommandParameter="{Binding ElementName=TextBox, Path=Text}"/>
    </StackPanel>
</Window>

DAL

It has models and provider to database.

There's code first approach are used (Entity Framework).

Camera

This project is stand-alone app, which is not depends on the others


Update as of June 14, 2017

Kindergarten 3.0

Main Window


Child Details


Groups


Parents


Activator