|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows;
using System.ServiceModel.Security;
using System.Threading;
using System.Globalization;
using Signum.Utilities;
using Signum.Windows;
using Signum.Services;
using Southwind.Services;
namespace Southwind.Windows
{
public class Program
{
[STAThread]
public static void Main(string[] args)
{
try
{
Server.SetNewServerCallback(NewServer);
Server.Connect();
App app = new App() { ShutdownMode = ShutdownMode.OnMainWindowClose };
app.Run(new Main());
}
catch (Exception e)
{
HandleException("Start-up error", e);
}
}
public static void HandleException(string errorTitle, Exception e)
{
if (e is MessageSecurityException)
{
MessageBox.Show("Session expired", "Session Expired", MessageBoxButton.OK, MessageBoxImage.Hand);
}
else
{
var bla = e.FollowC(ex => ex.InnerException);
MessageBox.Show(
bla.ToString(ex => "{0} : {1}".Formato(ex.GetType().Name, ex.Message), "\r\n\r\n"),
errorTitle + ":",
MessageBoxButton.OK, MessageBoxImage.Error);
}
}
static ChannelFactory<IServerSouthwind> channelFactory;
public static IBaseServer NewServer()
{
if (channelFactory == null)
channelFactory = new ChannelFactory<IServerSouthwind>("server");
//Add Login here
IServerSouthwind result = channelFactory.CreateChannel();
return result;
}
}
}
|
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.
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...