private void LoginMethod()
        {
            Stocky.Proxies.EndPointDefinitions.IsInDebugMode = CurrentSession.IsInDebugMode;
            Proxies.AuthenticationClient AuthenticationClient = new Proxies.AuthenticationClient();
            try
            {
                ApplicationSettings _App = new ApplicationSettings();
                if (userobj != null)
                {
                    var result = AuthenticationClient.LoginUser(userobj.UserName, userobj.Password);

                    if (result.IsValidUser)
                    {
                        userobj = result.UserObject;

                        CurrentSession.CurrentUserObject = userobj;
                        Stocky.Data.Helpers.SetDataContextUser(userobj);
                        UserPreference UserPref = new UserPreference();
                        Stocky.Application.ApplicationSettings AppSettings = new Application.ApplicationSettings();

                        UserPref.Load();
                        AppSettings.LoadSettings();

                        App.Current.Dispatcher.BeginInvoke((Action) delegate
                        {
                            MainWindowView MW      = new MainWindowView();
                            App.Current.MainWindow = MW;
                            MW.Show();
                            Stocky.UI.Enviroment.CloseWindow("LoginView");
                        });
                    }
                    else
                    {
                        ErrorMEssage = "Incorrect Password!";
                    }
                }
            }
            catch (Exception E)
            {
                App.Current.Dispatcher.BeginInvoke((Action) delegate
                {
                    ExepionLogger.Logger.LogException(E);
                    ExepionLogger.Logger.Show(E);
                });
            }
            finally
            {
                AuthenticationClient.Close();
            }
        }