Click here to Skip to main content
15,880,608 members
Articles / Web Development / HTML

Signum Framework Tutorials Part 2 – Southwind Logic

Rate me:
Please Sign up or sign in to vote.
4.45/5 (6 votes)
15 Nov 2012LGPL325 min read 31.2K   1K   22  
In this part, we will focus on writing business logic, LINQ queries and explain inheritance
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;

namespace Signum.Windows
{
    /// <summary>
    /// Interaction logic for TypeSelectorWindow.xaml
    /// </summary>
    public partial class ValueLineBox : Window
    {

        public ValueLineBox()
        {
            InitializeComponent();        
        }


        private void btAccept_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
            Close(); 
        }

        public static bool Show<T>(ref T value, string title, string text, string labelText, string format, string unitText, Window owner)
        {
            object obj = value;
            if (ShowUntyped(typeof(T), ref obj, title, text, labelText, format, unitText, owner))
            {
                value = (T)obj;
                return true;
            }
            return false;
        }

        public static bool ShowUntyped(Type type, ref object value, string title, string text, string labelText, string format, string unitText, Window owner)
        {
            ValueLineBox vlb = new ValueLineBox();
            vlb.Title = title ?? Properties.Resources.ChooseAValue;

            vlb.tb.Text = text ?? Properties.Resources.PleaseChooseAValueToContinue;

            vlb.valueLine.Type = type;

            if (labelText == null)
                Common.SetLabelVisible(vlb.valueLine, false);
            else
                vlb.valueLine.LabelText = labelText;

            vlb.valueLine.Format = format;
            vlb.valueLine.UnitText = unitText;
            vlb.valueLine.Value = value;

            vlb.Owner = owner;

            if (vlb.ShowDialog() == true)
            {
                value = vlb.valueLine.Value;
                return true;
            }
            return false;
        }

        private void btCancel_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
            Close(); 
        }


    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Software Developer (Senior) Signum Software
Spain Spain
I'm Computer Scientist, one of the founders of Signum Software, and the lead developer behind Signum Framework.

www.signumframework.com

I love programming in C#, Linq, Compilers, Algorithms, Functional Programming, Computer Graphics, Maths...

Comments and Discussions